import java.util.*; public class Main { static long gcd(long a,long b){ return b == 0 ? a : gcd(b, a%b); } static long lcm(long a, long b){ return a*b/gcd(a, b); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); 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))); } }