Parade
In a sports parade, there were initially plans for two columns of athletes carrying flags. However, just before the parade began, it was discovered that the path was too narrow for two columns. As a result, an urgent decision was made to merge the two columns into one. Initially, the plan was to have the first column proceed entirely before the second. However, to ensure fairness and avoid any offense, it was decided to interleave the two columns. The goal was to arrange the participants such that the sum of the differences in heights between neighboring flags was minimized, enhancing the visual appeal of the parade.
Given the heights of the flags and their order in each column, determine the minimum possible sum of the differences in heights between neighboring flags when the columns are combined, while maintaining the original order of participants within each column.
Input
The first line contains two integers l_1 and l_2, representing the number of participants in each column (1 ≤ l_1, l_2 ≤ 1000). The second line provides the l_1 flag heights of the first column in their parade order. The third line provides the l_2 flag heights of the second column in their parade order. Each height is an integer between 0 and 10000.
Output
Output the minimum possible sum of the absolute differences in heights between neighboring flags in the combined column.