Chocolate
Time limit1sMemory limit128 MB
Find the minimum total cost to split an m by n chocolate bar into unit squares, where each vertical or horizontal cut costs a fixed price regardless of the piece size.
Problem
We are given a bar of chocolate made up of unit squares, and we want to break it into individual unit squares.
A part of the chocolate can be broken along one of its vertical or horizontal grid lines. A single break splits one part into two smaller parts. The cost of a break depends only on the line it is made along, not on the size of the part being broken. Breaking along vertical line costs (for ), and breaking along horizontal line costs (for ).

For example, for the bar in the picture (, ), if we first break along all horizontal lines and then break each resulting strip along the vertical lines, the total cost is .
The total cost of breaking the whole bar into unit squares is the sum of the costs of all the breaks performed. Write a program that reads the values and and computes the minimum possible total cost of breaking the whole bar into unit squares.
Input
The first line contains two integers and separated by a single space ().
Each of the next lines contains one integer (), the cost of the -th vertical line.
Each of the following lines contains one integer (), the cost of the -th horizontal line.
Output
Print a single integer: the minimum total cost of breaking the whole bar into unit squares.