def lcm(x,y): def gcd(x, y): if y == 0: return x else: return gcd(y,x%y) return (x*y)//gcd(x,y) s = list(map(int,input().split())) lc = lcm(s[0]+s[1],s[2]+s[3]) sec = [0]*lc for i in range(0,lc): x = i%(s[0]+s[1]) y = i%(s[2]+s[3]) if x