from sys import stdin

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