package no316; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long[] a = new long[3]; for(int i=0;i<3;i++) { a[i] = sc.nextLong(); } long count = 0; for(int i=1;i<8;i++) { long lcm = 1; for(int j=0;j<3;j++) { if ((i>>j&1)>0) { lcm = lcm(lcm,a[j]); } } count += (n / lcm) * (Integer.bitCount(i) % 2 == 1 ? 1 : -1); } System.out.println(count); } public static long gcd(long a,long b) { while(b!=0) { long r = a%b; a = b; b = r; } return a; } public static long lcm(long a,long b) { return a / gcd(a,b) * b; } }