Q = int(input()) S = [input() for _ in range(Q)] for i in range(Q): print(int(S[i], 0))