Almost no one believed in the virtuous abilities of the composer Marin. Specifically, not until the day he composed his 9th symphony.
The symphony can be represented as a series of frequencies that are integer numbers. In order for Marin to prove his talent and demonstrate that this symphony is not just one of many, he decided to compare it with the ancient symphony "Little Night Fiesta" of the best musician in history, Stjepan. In the stars it is written that the lengths of these two symphonies are equal to
Marin compares the symphonies by writing them one under the other to a piece of paper. The symphony diversity is defined as the sum of the absolute differences of the corresponding frequencies. The diversity of symphonies
Before comparing the two symphonies, Marin will do two things. First, he will modulate his symphony by adding an integer number
Marin will choose
Input
In the first line there are integer numbers
In the second line there are
In the third line there are
Output
In the only line print out the smallest possible diversity between Marin and Stjepan's symphony.
Scoring
In the test samples totally worth 40% of the points it will hold
Sample Input 1
3 0
1 2 3
4 5 7
Sample Output 1
1
Sample Input 2
3 1
1 2 3
4 5 7
Sample Output 2
0
Explanation for Sample Output 2
If Marin modulates his symphony for
Sample Input 3
4 1
1 2 1 2
5 6 7 8
Sample Output 3
2
Comments