from functools import reduce
p = [print(reduce((lambda x, y: x * y), list(map(int, input())))) for i in range(int(input()))]
from functools import reduce p = [print(reduce((lambda x, y: x * y), list(map(int, input())))) for i in range(int(input()))]