Cubes#2986

Cubes

1 second
64 megabytes
Easy

A three-dimensional figure consists of unit cubes. Its front and right projections can be constructed from the figure, but it is not always possible to reconstruct the original figure exactly from these two projections alone.

Write a program CUBES that, given the front and right projections of the figure, determines the minimum and maximum number of unit cubes that could be used to build the figure corresponding to the given projections.

Input

The first line of the input contains three integers , , and , which define the sizes of the projections (1 \leq N, M, K \leq 100). After that, two projections follow: first the front, then the right. Each projection consists of rows, each containing numbers separated by spaces. The front projection has numbers in each row, and the right projection has numbers in each row. Each number is either (an empty cell) or (a filled cell).

Output

Output a single line with two integers: the minimum and maximum number of cubes that could correspond to the given projections.

Examples

Example 1

Loading
Loading