#include<set>
#include<map>
#include<ctime>
#include<cmath>
#include<stack>
#include<queue>
#include<bitset>
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
#define rep(i,j,k) for (int i = j; i <= k; i++)
#define per(i,j,k) for (int i = j; i >= k; i--)
#define loop(i,j,k) for (int i = j;i != -1; i = k[i])
#define lson x << 1, l, mid
#define rson x << 1 | 1, mid + 1, r
#define fi first
#define se second
#define mp(i,j) make_pair(i,j)
#define pii pair<string,string>
using namespace std;
typedef long long LL;
const int low(int x) { return x&-x; }
const double eps = 1e-8;
const int INF = 0x7FFFFFFF;
const int mod = 9973;
const int N = 5e3 + 10;
const int read()
{
char ch = getchar();
while (ch<'0' || ch>'9') ch = getchar();
int x = ch - '0';
while ((ch = getchar()) >= '0'&&ch <= '9') x = x * 10 + ch - '0';
return x;
}
LL a, b, c, d, e;
LL exgcd(LL a, LL b, LL &x, LL &y)
{
if (!b) { x = 1, y = 0; return a; }
LL g = exgcd(b, a%b, x, y);
LL z = x - a / b * y;
x = y; y = z; return g;
}
int main()
{
while (scanf("%lld%lld%lld%lld%lld", &a, &b, &c, &d, &e) != EOF)
{
LL x, y, g = exgcd(c - d, e, x, y);
if ((b - a) % g) printf("Impossible\n");
else
{
LL f = (b - a) / g * x, h = e / (g > 0 ? g : -g);
printf("%lld\n", (f % h + h) % h);
}
}
return 0;
}