using System; class SuperFizzBuzz { static public void Main(string[] args) { long N, a, b, c; string[] abc; long count = 0; N = long.Parse(Console.ReadLine()); abc = Console.ReadLine().Split(' '); a = long.Parse(abc[0]); b = long.Parse(abc[1]); c = long.Parse(abc[2]); long lcm_ab = lcm(a, b); long lcm_ac = lcm(a, c); long lcm_bc = lcm(b, c); long lcm_abc = lcm(lcm_ab, lcm_bc); count = N / a + N / b + N / c - N / lcm_ab - N / lcm_ac - N / lcm_bc + N / lcm_abc; Console.WriteLine(count); } static long gcd(long x, long y) { long t; if(x < y) { t = x; x = y; y = t; } if(x % y == 0) return y; else return gcd(y, x % y); } static long lcm(long x, long y) { return (x * y) / gcd(x, y); } }