import math._ object Main { def gcd(n: Long, m: Long): Long = if (m == 0) n else gcd(m, n % m) def lcm(n: Long, m: Long): Long = n * m / gcd(n, m) def main(args: Array[String]) { val sc = new java.util.Scanner(System.in) val n, a, b, c = sc.nextLong val x = n/a + n/b + n/c val y = n/lcm(a, b) + n/lcm(b, c) + n/lcm(c, a) val z = n/lcm(a, lcm(b, c)) val ans = x - y + z println(ans) } }