#include <iostream> using namespace std; int exGcd(__int64 a, __int64 b, __int64 &x, __int64 &y) { if (b == 0) { x = 1; y = 0; return a; } __int64 r = exGcd(b, a % b, x, y); __int64 t = x; x = y; y = t - a / b * y; return r; } void linear_equation_solver(__int64 a,__int64 b,__int64 n)//解方程ax=b(mod n) //必须保证n是正数 { __int64 x,y,d; if(a<0) a%=n,a+=n; if(b<0) b%=n,b+=n; d=exGcd(a,n,x,y); if (b%d) printf("Impossible/n" ); else { x=(x*b/d)%n; if(x<0) x+=n; while(x>(n/d)) x-=n/d; printf("%I64d/n",x); } } int main() { __int64 x,y,m,n,L; scanf("%I64d%I64d%I64d%I64d%I64d",&x,&y,&m,&n,&L); linear_equation_solver(m-n,y-x,L); return 0; }