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); int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int 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))); } }