from sys import stdin

t = tuple()
rcol = True # whether to read a column index
for line in stdin:
    if rcol:
        col = int(line.strip())
        rcol = False
    elif line.startswith("=="): 
        print(prod_col(col, t))
        t = tuple()
        rcol = True
    else:
        t += ( tuple(map(int, line.split())), )