import java.util.Scanner; public class Test { public static Scanner sc = new Scanner(System.in); public static void main(String[] args) { long n = sc.nextLong(), a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong(), cnt = 0; cnt += n / a; cnt += n / b; cnt += n / c; cnt -= n / (lcm(a, b)); cnt -= n / (lcm(a, c)); cnt -= n / (lcm(b, c)); cnt += n / (lcm(a, lcm(b, c))); System.out.println(cnt); } public static long lcm(long a, long b) { return a * b / gcd(a, b); } public static long gcd(long a, long b) { long tmp = a % b; while (tmp > 0) { a = b; b = tmp; tmp = a % b; } return b; } }