import java.util.*; public class Main { 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(); int k1 = n / a; int k2 = n / b; int k3 = n / c; int g1 = gcd(a, b); int g2 = gcd(a, c); int g3 = gcd(b, c); int g4 = gcd(a, g3); int l1 = g1 * (a / g1) * (b / g1); int l2 = g2 * (a / g2) * (c / g2); int l3 = g3 * (b / g3) * (c / g3); int l4 = g4 * (a / g4) * (b / g4) * (c / g4); int h1 = n / l1; int h2 = n / l2; int h3 = n / l3; int h4 = n / l4; int ans = k1 + k2 + k3 - l1 - l2 - l3 + l4; System.out.println(ans); } public static int gcd(int a, int b) { if(b == 0) return a; return gcd(b, (a % b)); } }