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.
- Walk: move distance 1 in 1 second.
- Jump: spend
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.