Alice has three different types of sweets. There are \(N\) sweets of each type, and each sweet has a tastiness value. The tastiness values for sweets are given in three arrays \(A\), \(B\), and \(C\). The tastiness value of two sweets of a particular type can differ.
Alice wants to choose three sweets, exactly one of each type. Let the chosen sweets’ tastiness values be \(a\), \(b\), and \(c\). You need to choose the sweets such that the value of the equation \(abs(a - b) + abs(b - c) + abs(c - a)\) is minimized. Here, \(abs(x)\) is the absolute value function.
Input Format
- The first line contains a single integer \(N\) denoting the number of sweets of each type.
- The second line contains \(N\) space-separated integers denoting the array \(A\).
- The third line contains \(N\) space-separated integers denoting the array \(B\).
- The fourth line contains \(N\) space-separated integers denoting the array \(C\).
Output Format
Print the minimum value of the equation mentioned in the problem statement if we can choose exactly one sweet of each type.
Constraints
\(1 \leq N \leq 10^5 \\ 1 \leq A[i], B[i], C[i] \leq 10^8\)