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