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