Theater#1963

Theater

1 second
64 megabytes
Very easy

In the theater, there are rows with seats in each row. Two matrices are given: the first contains the ticket prices, and the second indicates which tickets have been sold ( means the ticket is sold, means it is not sold).

Vasya and his company want to go to the theater, but they are only willing to buy the cheapest tickets available. Determine the maximum possible size of the group that can go to the theater (in other words, find out how many of the cheapest tickets remain unsold).

Input

First, the numbers and are given. Then the ticket price matrix is provided ( rows with numbers each, and each number is an integer from to ). Next, the matrix indicating tickets sold is given (again rows with numbers). and do not exceed .

Output

Print the required number.

Examples

Example 1

Loading
Loading