Staircase
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
In the fairy land of Vegetables there is a longest staircase in the world, leading to the top of the Watermelon mountain. The bunny is located on the step number x, it can jump a stairs up or b stairs down. At the level of the stair number y there is a magic cabbage, which bunny likes very much. Help him to find, can he jump to the stair number y.
Input
Four integers x, y, a, b (0 < x, y < 10^6
, 0 < |a|, |b| < 100).
Output
Print the minimum number of jumps enough to reach the target, or -1 if its not possible.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 2K
Acceptance rate 14%