import java.util.*; public class Yuki316 { public static void main(String[] args) { long N; int a; int b; int c; try (Scanner sc = new Scanner(System.in)) { N = sc.nextLong(); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt(); } System.out.println(N / a + N / b + N / c - N / lcm(a, b) - N / lcm(b, c) - N / lcm(c, a) + N / lcm(a, lcm(b, c))); } private static long gcd(long a, long b) { if (b == 0) { return a; } return gcd(b, (a % b)); } private static long lcm(long a, long b) { return a * b / gcd(a, b); } }