q = int(input()) for i in range(q): s = input() x = int(s,0) print(x)