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