In Ringworld, there are cities numbered from to which lie uniformly spaced along a circular, two-way road. It takes one hour to travel between city and city for and one hour to travel between city and city .

There are students and teachers living in the cities. You would like to assign every teacher to a distinct student such that the sum of the times needed for each student to travel to their assigned teacher's city is minimized.

What is the minimum sum of the travel times for a teacher-student assignment?

#### Input Specification

The standard input will contain 10 datasets. Each dataset begins with two integers and .

The next line contains integers such that student lives in city . The third line contains integers such that teacher lives in city . At most one student or teacher lives in each city.

for the first 4 cases, .

#### Output Specification

For each dataset, output the minimum sum of the travel times for a teacher-student assignment.

#### Sample Input (Two Datasets Shown)

```
2 5
1 4
5 3
5 100
10 20 30 40 50
60 70 80 90 100
```

#### Sample Output

```
2
130
```

Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org

## Comments

no judge, and problem type should be brute force. No kidding. Shouldn't do that...