spent too much time at his school's Computer Club (every Thursday in Room 221) and he is about to be late for the bus. He needs your help to determine the minimum time necessary to get to the bus stop.
The area around the school and the bus stop can be divided into a grid of squares.
starts on one of these squares and can travel to any adjacent square or to a square directly diagonal to his square. Given the position of the school and the bus stop, as well as the travel time, determine the minimum amount of time to get to the bus stop from the school.Input Specification
The first line contains representing the cost in minutes to travel to any adjacent square.
The second line contains representing the cost in minutes to travel diagonally.
The next line contains two space separated integers, representing the 0 indexed and coordinates of the school, with being the top left corner of the grid.
The final line contains two space separated integers, representing the 0 indexed and coordinates of the bus stop, the final destination.
Output Specification
Output the minimum number of minutes
needs to travel from the school to the bus stop.Sample Input
2
3
0 0
4 4
Sample Output
12
Comments