Time limit
2s
Memory limit
128 MB
Eunjin is currently at coordinate (X, Y), and her home is at the origin (0, 0). She wants to get home as quickly as possible.
There are two ways to move.
T seconds to move exactly distance D in a straight line.Each jump is straight, and a single jump must have length exactly D. Walking and jumping may be used in any order and any combination. Find the minimum time needed to reach home.
The first line contains four integers X Y D T, separated by spaces.
Print the minimum time needed to reach home. An absolute or relative error of at most 10^-9 is accepted.
1 <= X, Y <= 10001 <= D, T <= 10000