#include<cstdio>
using namespace std;
long long x1,y1,m,n,L;
long long x,y;
long long exgcd(long long a,long long b)
{
if(b==0)
{
x=1;
y=0;
return a;
}
long long gcd=exgcd(b,a%b);
long long t=x;
x=y;
y=t-a/b*x;
return gcd;
}
int main()
{
scanf("%lld%lld%lld%lld%lld",&x1,&y1,&m,&n,&L);
long long at=((m-n)%L+L)%L,bt=L,ct=((y1-x1)%L+L)%L;
long long gcd=exgcd(at,bt);
if(ct%gcd!=0)
{
printf("Impossible\n");
return 0;
}
at/=gcd;bt/=gcd;ct/=gcd;
x*=ct;
x=(x%bt+bt)%bt;
printf("%lld\n",x);
return 0;
}
11-15
11-15