A construction is a number of cubes arranged on a square base as in the diagram below.

This is a four by four square supporting stacks of cubes. No stack will contain more than 8 cubes. The front and side projections of the construction are shown below.
![]() |
|
| Front | Side |
Obviously there are a number of constructions that will satisfy both these projections. The constructions with the maximum and minimum number of blocks that will satisfy both projections are shown below.

Here the maximum number of blocks is 17, and the minimum is 7. Your job is to find the maximum and minimum number of blocks given the front and side projections.
The first line contains k, (1 <= k <= 8), the length of the side of the square base. The next two lines contain descriptions of the construction (the front projection followed by the side projection). Each description consists of k integers. Each integer indicates the height of the corresponding projection of a stack of blocks.
The output will be one line containing the maximum number of blocks followed by a line containing the minimum number of blocks.
Input
4 2 0 3 1 1 1 2 3
Output
17 7
Input
1 1 1
Output
1 1