import collections import decimal import math import sys import time #mod = 1_000_000_007 def resolve(): a,b,c,d,e = int1d() gcd = math.gcd(a+b,c+d) lcm = (a+b)*(c+d)//gcd div,mod = divmod(e,lcm) rest = 0 loop = 0 for i in range(lcm): if mod==i: rest = loop if i%(a+b)