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