n = input() x = raw_input() [a,b,c] = x.split(' ') [a,b,c] = [int(a),int(b),int(c)] print n/a+n/b+n/c-n/(a*b)-n/(a*c)-n/(b*c)+n/(a*b*c)