using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static long N; static long a, b, c; static void Main() { N = int.Parse(Console.ReadLine()); string[] s = Console.ReadLine().Split(' '); a = int.Parse(s[0]); b = int.Parse(s[1]); c = int.Parse(s[2]); long cnt = N / a + N / b + N / c; cnt += N / LCM(a, b, c); cnt -= N / LCM(a, b) + N / LCM(a, c) + N / LCM(b, c); Console.WriteLine(cnt); } static long LCM(long a,long b) { long r; long x = a * b; if (a < b) { long t = a; a = b; b = t; } r = a % b; while (r > 0) { a = b; b = r; r = a % b; } return x / b; } static long LCM(long a,long b,long c) { return LCM(LCM(a, b), c); } }