N = gets.chomp.to_i a, b, c = gets.chomp.split.map(&:to_i) ans = 0 (0...N).each { |e| ans += 1 if e % a == 0 || e % b == 0 || e % c == 0 } puts ans