Building Construction
Given buildings of height , the objective is to make every building has equal height. This can be done by removing bricks from a building or adding some bricks to a building. Removing a brick or adding a brick is done at certain cost which will be given along with the heights of the buildings. Find the minimal cost at which you can make the buildings look beautiful by reconstructing the buildings such that the buildings satisfy ( can be any non-negative integer).
For convenience, all buildings are considered to be vertical piles of bricks, which are of same dimensions.
Input
The first line contains number of buildings . The second line contains integers which denotes the heights of the buildings . The third line contains integers which denotes the cost of adding or removing one unit of brick from the corresponding building.
Output
Print the minimal cost to make all the buildings look beautiful.