import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextInt(); long a = sc.nextInt(); long b = sc.nextInt(); long c = sc.nextInt(); long ans = n / a + n / b + n / c - n / lcm(a, b) - n / lcm(b, c) - n / lcm(c, a) + n / lcm(lcm(a, b), c); System.out.println(ans); } static long lcm(long x, long y) { return x / gcd(x, y) * y; } static long gcd(long x, long y) { if (x % y == 0) { return y; } else { return gcd(y, x % y); } } }