#include<bits/stdc++.h>
using namespace std;
#define int long long
int x,y,m,n,l;
int p = 0,q = 0,pp = 0,qq = 0;
void exgcd(int a,int b) {
if (b == 0) {
p = 1,q = 0;
} else {
exgcd(b,a % b);
pp = p,qq = q;
p = qq,q = pp - qq * (a / b);
}
}
signed main() {
cin >> x >> y >> m >> n >> l;
x %= l,y %= l,m %= l,n %= l;
if (m < n) {
swap(m,n);
swap(x,y);
}
int c1 = m - n;
int c2 = y - x;
c1 = (c1 % l + l) % l;
c2 = (c2 % l + l) % l;
int g = __gcd(c1,c2);
c1 /= g,c2 /= g;
if (__gcd(c1,l) != 1) {
cout << "Impossible";
exit(0);
}
exgcd(c1,l);
p = (p % l + l) % l;
cout << ((p * c2) % l + l) % l;
return 0;
}