# https://www.hackerrank.com/challenges/np-sum-and-prod/problem

import numpy
N, M = map(int, input().split())
A = numpy.array([input().split() for _ in range(N)],int)
print(numpy.prod(numpy.sum(A, axis=0), axis=0))


# https://www.hackerrank.com/challenges/np-sum-and-prod/problem

import numpy
N, M = map(int, input().split())
A = numpy.array([input().split() for _ in range(N)],int)
print(numpy.prod(numpy.sum(A, axis=0), axis=0))


# https://www.hackerrank.com/challenges/np-sum-and-prod/problem