#include <bits/stdc++.h>
#define int long long
using namespace std;
int t1,t2,m,n,L;
int t,k;
int a,b;
inline void exgcd(int x,int y) {
if (y==0) {
a=1,b=0;
return ;
}
exgcd(y,x%y);
int tmp=a;
a=b;
b=tmp-b*(x/y);
}
signed main(){
scanf("%lld%lld%lld%lld%lld",&t1,&t2,&m,&n,&L);
t=(t2-t1+L)%L;
k=(m-n+L)%L;
int g=__gcd(k,L);
if (t%g) {
printf("Impossible\n");
return 0;
}
k/=g,L/=g,t/=g;
exgcd(k,L);
printf("%lld\n",(a%L+L)*t%L);
return 0;
}