'''
转换成求解裴蜀定理中系数的问题,用拓展欧几里得算法求解
'''
# 求a, b最大公约数,同时求出裴蜀定理中的一组系数x, y, 满足x*a + y*b = gcd(a, b)
def exp_gcd(a, b):
flag = True
if a > b:
flag = False
a, b = b, a
if a == 0:
return (b, 0, 1) if flag else (b, 1, 0)
gcd_val, x, y = exp_gcd(b%a, a)
new_x = y - x * (b // a)
new_y = x
return (gcd_val, new_x, new_y) if flag else (gcd_val, new_y, new_x)
a, b, m, n, L = map(int, input().split())
if m < n:
m, n = n, m
a, b = b, a
gcd_val, x, y = exp_gcd(m-n, L)
if (b-a) % gcd_val != 0:
print('Impossible')
else:
x = x % (L // gcd_val)
x = x * ((b-a) // gcd_val)
x %= L // gcd_val
print(x)