Theater revenue#132

Theater revenue

1 second
128 megabytes
Very easy (≈850)

The theater has rows with seats. Two matrices are given. The first matrix contains the ticket prices for each seat. The second matrix tells which tickets are sold and which are not ( means the ticket is sold for a corresponding seat, is not sold).

Determine the total revenue from the performance.

Input

The first line contains and m~(n, m \le 500). Then the matrix with ticket prices is given ( lines with numbers, each number ranges from to ). Then given the matrix of sold tickets — lines with numbers.

Output

Print the total revenue from the ticket sales.

Examples

Example 1

Loading
Loading