t = int(input()) n = [int(input()) for _ in range(n)] for nn in n: print(nn * nn + nn)