#include <iostream>
#include<cstdio>
#include<algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;
long long exgcd(long long a,long long b,long long &x,long long &y)
{
	if(b==0)
	{
		//x,y没赋初值
		x=1;
		y=0;
		return a;
	}
	long long ret=exgcd(b,a%b,x,y);
	long long tmp=x;
	x=y;
	y=tmp-a/b*y;
	return ret;
}
int main()
{
	long long x,y,m,n,l;
	scanf("%lld%lld%lld%lld%lld",&x,&y,&m,&n,&l);//%lld没打
	long long a=m-n,b=l,c=y-x;
	if(a<0)//负值没处理好
	{
		a*=-1;
		c*=-1;
	}
	long long x0,y0;
	long long g=exgcd(a,b,x0,y0);
	if(c%g!=0)printf("Impossible");//WA 罪魁祸首
	else printf("%lld",(c/g*x0%(b/g)+b/g)%(b/g));//负值没处理好
	return 0;
}