n = gets.strip.to_i a, b, c = gets.strip.split(' ').map(&:to_i).sort # p a, b, c if c % a != 0 && c % b != 0 && b % a != 0 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) elsif c % a == 0 && b % a == 0 p n / a elsif c % a == 0 && c % b != 0 || c % a != 0 && c % b == 0 p n / a + n / b - n / a.lcm(b) else p n / a + n / c - n / a.lcm(c) end