import java.util.*; import java.util.Map.Entry; import java.math.*; import java.awt.geom.*; import java.io.*; 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 ac = N / a; long bc = N / b; long cc = N / c; long lcmAB = lcm(a,b); long lcmAC = lcm(a,c); long lcmBC = lcm(b,c); long lcmABC = lcm(a,b,c); long abc = N / (lcmAB); long acc = N / (lcmAC); long bcc = N / (lcmBC); long abcc = N / (lcmABC); System.out.println(( ac + bc + cc + abcc - abc - acc - bcc )); } static long lcm(long a, long b) { return a * b / gcd(a,b); } static long lcm(long a, long b, long c) { long lcm = lcm(a,b); return lcm * c / gcd(lcm,c); } static long gcd(long a, long b) { if (a < b) { long tmp = a; a = b; b = tmp; } while(b > 0) { long r = a % b; a = b; b = r; } return a; } }