#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll exgcd(ll a, ll b, ll &x, ll &y)
{
if (!b)
{
x = 1, y = 0;
return a;
}
ll d = exgcd(b, a % b, y, x);
y -= a / b * x;
return d;
}
ll x, y, n, m, l;
int main()
{
scanf("%lld%lld%lld%lld%lld",&x,&y,&m,&n,&l);
ll a,b;
ll d=exgcd(m-n, l, a, b);
if((y-x)%d!=0) printf("Impossible\n");
else
{
a*=(y-x)/d;
ll t=abs(l/d);
printf("%lld\n",(a%t+t)%t);
}
return 0;
}
11-23
03-05