Chef has an old machine if the chef enters any natural number, the machine will display 1, 2, …n, n-1, n-2, n-3,…1 series and in next line prints sum of cubes of each number in the series. Chef wants to create a computer program which can replicate the functionality of the machine. Help the chef to code.

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, $N$. 

-----Output:-----
For each test case, output in a single line answer.

-----Constraints-----
- $1 \leq T \leq 50$
- $1 \leq N \leq 50$

-----Sample Input:-----
2
1
3

-----Sample Output:-----
1
45

-----EXPLANATION:-----
For 2) series will be 1, 2, 3, 2, 1 and the sum will be = 1 + 8 + 27 + 8+ 1

Difficulty: interview

Starter code:

Solutions:
t=int(input())
while(t!=0):
    t=t-1
    n=int(input())
    ans=0
    for i in range(1,n+1,1):
        sum=0;
        for j in range(1,i+1,1):
            sum=sum+j
        s=sum-i
        sum=sum+s
        if(i!=n):
            ans=ans+2*sum*i
        else:
            ans=ans+sum*i
    print(ans)

# cook your dish here
t=int(input())
for _ in range(t):
    n=int(input())
    arr=[]
    sum1=0
    sum2=0
    for i in range(n):
        arr.append(i+1)
    #print(arr)
    #print(arr[0:n-1])
    arr2=arr[0:n-1]
    #print(arr2)
    for i in range(n):
        sum1=sum1+(arr[i]*arr[i]*arr[i])
        #sum2=sum2+(arr2[i]*arr[i]*arr[i])
    for i in range(len(arr2)):
        sum2=sum2+(arr2[i]*arr[i]*arr[i])
    if n==1:
        print("1")
    else:
        print(sum1+sum2)

t=int(input())
for i in range(t):
    ans=0
    n=int(input())
    for i in range(1,n+1):
        ans+=i*i*i
    m=n-1
    while(m>=1):
        ans+=m*m*m
        m-=1
    print(ans)

t = int(input())
while(t>0):
    n = int(input())
    temp1 = ((n*n)*(n+1)*(n+1))/4
    n = n-1
    temp2 =  ((n*n)*(n+1)*(n+1))/4
    print(int(temp1+temp2))
    t-=1

# cook your dish here
for _ in range(int(input())):
    k=int(input())
    # n=k-1
    a=k*(k+1)
    a=a/2
    a=a**2
    print(int((2*a)-(k**3)))

# cook your dish here
testcases = int(input())
for x in range(testcases):
    n = int(input())
    li = [(x+1)**3 for x in range(n)]
    print(sum(li)+sum(li[:-1]))

def solve(n):
    s=0
    for i in range(1,n):
        s+=2*i*i*i
    s+=n*n*n
    return s
for _ in range(int(input())):
    n=int(input())
    print(solve(n))


# cook your dish here
import math
for _ in range(int(input())):
    N=int(input())
    arr=[]
    for i in range(1,N+1):
        arr.append(math.pow(i,3))
    for i in range(1,N):
        arr.append(math.pow(i,3))
    print(int(sum(arr)))

testcases=int(input())
for i in range(testcases):
    n=int(input())
    sum1=n*n*(n+1)*(n+1)//4 +(n-1)*(n-1)*(n)*n//4
    print(sum1)

import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
for _ in range(int(input())):
    k = int(input())
    res = [] 
    for i in range(k):
        res.append(i+1)
    for j in range(k-1,0,-1):
        res.append(j)
    #print(res)
    s = 0
    for i in res:
        s = s + (i*i*i)
    print(s)

n = 51
dp = [0 for x in range(n)]
for i in range(1,n):
    dp[i] = dp[i-1]+i*i*i
#print(dp)
t = int(input())
for i in range(t):
    num = int(input())
    if num==1:
        print(1)
    else:
        print(dp[num]+dp[num-1])


T=int(input())
for i in range(T):
    n=int(input())
    sum=0
    x = (n * (n + 1)  / 2) 
    sum+= int((x * x))
    for i in range(n-1,0,-1):
        sum+=i*i*i
    print(sum)


# cook your dish here
t=int(input())
for i in range(t):
     n=int(input())
     s=0
     for i in range(1,n+1):
          s+=(i**3)
          # print(i,s)
     s*=2
     s-=n**3
     print(s)


# cook your dish here
a=int(input())
for i in range(0,a):
    s=int(input())
    j=s
    su=0
    while(j!=0):
        su=su+j**3
        j-=1
    j=1
    while(j!=s):
        su=su+j**3
        j+=1
    print(su)
        
        
        


# cook your dish here
t=int(input())
for w in range(t):
    n=int(input())
    l=l2=[]
    sm=0
    l=[i for i in range(1,n+1)]
    for a in range(n-1,0,-1):
        l.append(a)
    for p in l:
        sm=sm+p**3
    print(sm)

for _ in range(int(input())):
    N = int(input())
    print((N**3) + 2 * ((N**2) * ((N-1)**2) // 4) )

# cook your dish here
for i in range(int(input())):
    n = int(input())
    s = [x for x in range(1,n+1)]
    su = [n]
    summ = 0
    for i in range(len(s)-1):
        su.append(s[i])
        su.append(s[i])
    for x in range(len(su)):
        summ += su[x] ** 3
    print(summ)

t = int(input())
while t:
    n = int(input())
    z = ((n * (n + 1))//2)**2
    print(z*2 - (n**3))
    t -= 1


# cook your dish here
for _ in range(int(input())):
    n=int(input())
    a=n-1
    su=((n**2)*(n+1)**2)//4
    tu=((a**2)*(a+1)**2)//4
    print(su+tu)


t=int(input())
while t>0:
    sum=0
    s=[]
    n=int(input())
    for i in range(n):
        s.append((i+1))
    for i in range(n-1,0,-1):
        s.append((i))
    for i in range(len(s)):
        sum=sum + s[i]**3
    print(sum)

    t=t-1






# cook your dish here
T=int(input())

for _ in range(T):
    N=int(input())
    ans=(N*N*N)
    for i in range(1,N):
        v=2*i*i*i
        ans=ans+v
        
    print(ans)


for _ in range(int(input())):
    i =int(input())
    s = list(range(1,i+1))
    v = list(range(i-1,0,-1))
    l = s+v
    print(sum([x*x*x for x in l]))


t=int(input())
for i in range(t):
    n=int(input())
    a=0
    for i in range(1,n):
        a=a+(i*i*i)
    a=2*a
    a=a+(n*n*n)
    print(a)

import math
t = int(input())
for _ in range(t):
    n = int(input())
    s = 0
    for i in range(n+1):
        s += math.pow(i,3)
    print(int((s*2) - math.pow(n,3)))