Papa Kangaroo needs to catch his son, Little Kangaroo, but Little Kangaroo keeps playing around!
Papa Kangaroo starts at point and can hop an integer distance from to units, inclusive.
Little Kangaroo starts at point and can hop only a constant distance of exactly units.
Little Kangaroo, always watching Papa Kangaroo, loves to play. Whenever Papa Kangaroo hops any positive distance, Little Kangaroo simultaneously hops units in the exact same direction as Papa Kangaroo. No Kangaroo can hop diagonally.
What is the minimum number of hops Papa Kangaroo will need to catch his son?
Input Specification
The first line will contain the space separated integers , , and in that order.
The second line will contain space separated integers , , and in that order.
- For the first 3 out of the 15 points, .
- For the second 3 out of the 15 points, .
- For the third 3 out of the 15 points, .
- For the fourth 3 out of the 15 points, .
Output Specification
Output a single integer representing the minimum number of hops Papa Kangaroo will need for him to end at the same spot as Little Kangaroo.
Sample Input
10 10 3
5 5 2
Sample Output
10
Comments
do the two kangaroos jump simultaneously?
Yes.