#### Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

With the introduction of RP and the removal of the O-levels for the Raffles schools, the annual school rankings for both RI and RGS have hit all-time lows, since the only O-level subject left is Mother Tongue. The teachers have decided that drastic action is required, and without considering the welfare of the students have demanded that remedial Higher Chinese lessons be conducted every night. However, if a teacher works above a certain number of minutes 0 < *x* ≤ 1,000 per day, the school has to pay that teacher overtime pay, at the rate of $100 per extra minute, since Higher Chinese is a particularly tiring and frustrating subject to teach.

Assume, for just a while, that you're actually trying to help put this nefarious scheme into action. Given a list of the durations (in minutes) of 0 < *n* ≤ 1,000 day shifts and *n* night shifts, help to pair up these day and night shifts such that the total amount of overtime pay that the school has to fork out is minimised. Of course, the number of minutes a teacher has to work each day is the sum of the length of his/her day and night shift.

## Input

The first line of the input contains the integer 0 <*n*≤ 1,000. The second line contains

*n*integers, 0 ≤

*D*

_{1},

*D*

_{2}, ...,

*D*≤ 1,000, representing the lengths of each day shift. The third line contains

_{n}*n*integers, 0 ≤

*N*

_{1},

*N*

_{2}, ...,

*N*≤ 1,000, representing the lengths of each night shift. The fourth and last line contains the integer 0 <

_{n}*x*≤ 1,000.

## Output

Output the total amount of overtime pay required, in dollars.## Sample Input 1

5 1 2 3 4 6 1 2 3 4 2 5

## Sample Output 1

300

## Explanation for Sample Output 1

One possible way of arranging the shifts is as such:

1 2 3 4 6 4 3 2 1 2

which would result in 4 shifts of 5 minutes, and 1 shift of 8. Overtime pay is only required for the shift of 8 minutes - which, in this case, is 3 minutes over the limit, and hence $300 must be paid.

### Tags

### Subtasks and Limits

Subtask | Score | #TC | Time | Memory | Scoring |
---|---|---|---|---|---|

1 | 0 | 1 | 1s | 32MB | Average |

2 | 100 | 5 | 1s | 32MB | Average |

### Judge Compile Command

g++ ans.cpp -o chinese -Wall -static -O2 -lm -m64 -s -w -std=gnu++14 -fmax-errors=512