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