def main(): import sys from math import log, gcd, floor input = sys.stdin.buffer.readline div = [set() for _ in range(41)] for i in range(1, 41): for j in range(2, 41): if i%j==0: div[i].add(j) for _ in range(int(input())): N = int(input()) ans = 0 sqrtN = int(N**0.5) seen = [0] * (sqrtN + 1) for a in range(2, sqrtN+1): if seen[a]: continue L = floor(log(N, a)) for i in range(1, L): if a**i <= sqrtN: seen[a**i] = 1 for j in range(i+1, L+1): g = gcd(i, j) ans += N // (j // g) ans *= 2 ans += N**2 # b==d ans += N**2-N # a==c==1 print(ans) if __name__ == '__main__': main()