n=gets.to_i a,b,c=gets.split.map(&:to_i) d=a.lcm b e=a.lcm c f=c.lcm b p n/a+n/b+n/c-n/d-n/e-n/f+n/(f.lcm a)