#include<iostream>#include<cstdio>#include<iomanip>#include<string>#include<cstdlib>#include<cstring>#include<queue>#include<set>#include<vector>#include<map>#include<algorithm>#include<cmath>#include<stack>#include<stdlib.h>#include<stdio.h>#define INF 0x3f3f3f3f#define LINF 0x3f3f3f3f3f3f3f3f#define ll long long#define ull unsigned long long#define uint unsigned int#define l(x) x<<1#define r(x) x<<1|1#define ms(a,b) memset(a,b,sizeof(a))usingnamespace std;template<typename T>
T ext_gcd(T a, T b, T& x, T& y){
T d = a;if(!b){
x =1; y =0;}else{
d =ext_gcd(b, a%b, y, x);
y -= a / b * x;}return d;}
ll x, y, m, n, l,a,b,c,d;intmain(){while(cin >> x >> y >> m >> n >> l){
a = m - n;
c = y - x;if(a <0){
a =-a;
c =-c;}
b = l;
d =ext_gcd(a, b, x, y);if(c % d ==0){
x = x * c / d;
y = b / d;
x =(x%y + y)% y;
cout << x << endl;}else{
cout <<"Impossible"<< endl;}}return0;}