Time limit
2s
Memory limit
128 MB
Sejun wants to walk home from school. The city is an infinite grid: there is a vertical road at every integer x-coordinate and a horizontal road at every integer y-coordinate. Sejun starts at (0, 0), and his home is at (X, Y).
In one move, he can either move one block horizontally or vertically along the roads, or cross one block diagonally.
Find the minimum time needed for Sejun to get home.
The first line contains four integers X Y W S. X and Y are the coordinates of the home. W is the time needed to move one block along a road, and S is the time needed to cross one block diagonally.
X and Y are integers between 0 and 1,000,000,000 inclusive. W and S are integers between 1 and 10,000 inclusive.
Print the minimum time needed to get home.