Theater revenue#4749

Theater revenue

1 second
128 megabytes
Very easy

There are rows in the theater, each containing seats. Two matrices are given. The first matrix contains the ticket prices. The second matrix indicates which tickets are sold and which are not ( means the ticket is sold, and means it is not).

Determine the total revenue from ticket sales.

Input

The first line contains the integers and m~(n, m \le 500). Next comes the matrix of ticket prices — rows with integers each, every value being in the range from to . Then the matrix of sold tickets is given — rows with integers.

Output

Print the total revenue from ticket sales.

Examples

Example 1

Loading
Loading