P1516 Frogs' Date

Description

Two frogs met online and enjoyed chatting, so they thought it necessary to meet. They happily discovered that they live on the same line of latitude and agreed to jump westward until they meet. However, before setting off, they forgot something important: they neither asked each other's characteristics nor agreed on the exact meeting point. Still, the frogs are optimistic and believe that as long as they keep jumping in one direction, they will eventually meet. But unless both frogs land on the same point at the same time, they can never meet. To help these two optimistic frogs, you are asked to write a program to determine whether they can meet and when they will meet. Call the two frogs frog A and frog B. On the latitude line, set the origin at $0^\circ$E, take the direction from east to west as positive, and set the unit length to $1$ meter. In this way, we obtain a circular number line. Let the starting position of frog A be $x$, and the starting position of frog B be $y$. Frog A jumps $m$ meters per jump, and frog B jumps $n$ meters per jump. One jump takes the same time for both frogs. The total length of the latitude line is $L$ meters. Now you need to find after how many jumps they will meet.

Input Format

The input consists of one line with five integers $x,y,m,n,L$.

Output Format

Output the number of jumps needed for them to meet. If they can never meet, output a single line containing the string `Impossible`.

Explanation/Hint

For $100\%$ of the testdata, $1 \le x, y, m, n \le 2 \times 10^9$, $x \ne y$, $1 \le L \le 2.1 \times 10^9$. Translated by ChatGPT 5