using System; using System.Collections.Generic; using System.Linq; public class Program { public static void Main() { int N = int.Parse(Console.ReadLine()); var s = Console.ReadLine().Split(' '); int a = int.Parse(s[0]); int b = int.Parse(s[1]); int c = int.Parse(s[2]); long ab = Lcm(a, b); long bc = Lcm(b, c); long ca = Lcm(c, a); long abc = Lcm(Lcm(a, b), c); int count = (int)(N / a + N / b + N / c - N / ab - N / bc - N / ca + N / abc); Console.WriteLine(count); } public static long Lcm(long a, long b) { return a * b / Gcd(a, b); } public static long Gcd(long a, long b) { if (a < b) return Gcd(b, a); while (b != 0) { var remainder = a % b; a = b; b = remainder; } return a; } }