R.T.
//#define DEBUG
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <cstdlib>
#include <utility>
#include <queue>
#include <stack>
#include <deque>
#include <iomanip>
#include <vector>
#include <list>
#include <set>
using namespace std;
using ll=long long ;
ll Exgcd(ll a,ll b,ll &p,ll &q)
{
if(!b) {
p=1,q=0;
return a;
}
ll ret=Exgcd(b,a%b,p,q);
ll tmp=p;
p=q,q=tmp-a/b*q;
return ret;
}
int main()
{
ll x,y,m,n,L,p,q;
scanf("%lld%lld%lld%lld%lld",&x,&y,&m,&n,&L);
ll gcd=Exgcd(m-n,L,p,q);
if((y-x)%gcd) {
printf("Impossible");
return 0;
}
/**/
ll k=(y-x)/gcd;
p*=k,q*=k;ll t=L/gcd;
#ifdef DEBUG
printf("a:%lld,b:%lld,c:%lld,gcd:%lld\n",m-n,L,y-x,gcd);
printf("p:%lld,q:%lld,t:%lld\n",p,q,t);
#endif
/*?不理解这一句,请Dalao改正后解释一下呗~~~*/
p=(p%L+L)%L;
printf("%lld",p);
return 0;
}