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