def gcd(x,y): while x*y!=0: if x>y: x=x%y else: y=y%x return x+y a, b, c, d = list(map(int, open('input.txt','r').read().split())) outfile = open('output.txt','w') n = gcd(gcd(gcd(a, b), c), d) kl = int(a / n + b / n + c / n + d / n) outfile.write('%d\n' % (kl)) outfile.close()