#include#include using namespace std;long long exgcd(long long a,long long b,long long &x,long long &y) {if(b==0) {x=1; y=0; return a;} long long t=exgcd(b,a%b,y,x); y-=a/b*x; return t; }int main() { long long p,q,m,n,l,x,y,c; scanf("%lld%lld%lld%lld%lld",&p,&q,&m,&n,&l); c=p-q; long long d=exgcd(n-m,l,x,y); if(c%d!=0) printf("Impossible"); else {long long ans=x*(c/d),s=l/d; printf("%lld",(ans%s+s)%s); } return 0; }