imos=[0]*(10**6+1) imos[3]=4 for _ in range(4): for i in range(1,10**6+1): imos[i]+=imos[i-1] T=int(input()) for t in range(T): N=int(input()) ans=imos[N] print(ans)