#include <stdio.h>
__int64 externed_gcd(__int64 a,__int64 b,__int64 * x,__int64 * y)
{
__int64 ret,tmp;
if(!b)
{
* x=1;
* y=0;
return a;
}
ret=externed_gcd(b,a%b,x,y);
tmp=* x;
* x=* y;
* y=tmp-a/b*(* y);
return ret;
}
int main()
{
__int64 x,y,m,n,L,tx,ty,tc;
scanf("%I64d%I64d%I64d%I64d%I64d",&x,&y,&m,&n,&L);
tc=externed_gcd(n-m,L,&tx,&ty);
if((x-y)%tc!=0)
{
printf("Impossible\n");
}
else
{
tx=tx*((x-y)/tc);
tx=(tx%(L/tc)+L/tc)%(L/tc);
printf("%I64d\n",tx);
}
return 0;
}