//(x + km)%l == (y + kn)%l
//s*l + k(m - n) = y - x
//用扩展欧几里得求出k
//注意一下k需要为最小正数
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std ;
typedef __int64 ll ;
ll exgcd(ll a , ll b , ll &x , ll &y)
{
if(b == 0)
{
x = 1;
y = 0;
return a ;
}
ll r = exgcd(b , a%b , x , y) ;
ll temp = x ;
x = y ;
y = temp - a/b*y ;
return r;
}
int main()
{
ll x_1 , y_1 , m , l , n ;
while(~scanf("%I64d%I64d%I64d%I64d%I64d" , &x_1 , &y_1 , &m ,&n ,&l))
{
ll x , y ;
ll r = exgcd(l , m-n , x , y) ;
if((x_1 - y_1) % r != 0)
puts("Impossible") ;
else
{
y *= ((y_1 - x_1)/r);
while(y > 0){y -= l;}
while(y < 0){y += l;}
printf("%I64d\n" ,y) ;
}
}
}