using System;
using System.Linq;

namespace MottoFizzBuzz
{
    class Program
    {
        static void Main(string[] args)
        {
            Solver sol = new Solver();
            sol.Solve();
        }
    }
    class Solver
    {
        int N;
        int[] ABC;
        int[] lcm;
        long lcm_abc;

        public void Solve()
        {
            int ans;
            ans = N / ABC[0] + N / ABC[1] + N / ABC[2] - N / lcm[0] - N / lcm[1] - N / lcm[2] + (int)(N / lcm_abc);
            Console.WriteLine(ans);
        }

        public Solver()
        {
            N = ri();
            ABC = ria();
            lcm = new int[] {(int)LCM(ABC[0], ABC[1]), (int)LCM(ABC[0], ABC[2]), (int)LCM(ABC[1], ABC[2]) };
            lcm_abc = LCM(lcm[0], ABC[2]);
        }

        public int GCD(int a, int b)
        {
            int q, r;
            while (true)
            {
                q = a / b;
                r = a % b;
                if (r == 0) break;
                a = b;
                b = r;
            }
            return b;
        }

        public long LCM(int a, int b)
        {
            long gcd = GCD(a, b);
            long lcm = (long)a * b / gcd;
            return lcm;
        }

        static String rs() { return Console.ReadLine(); }
        static int ri() { return int.Parse(Console.ReadLine()); }
        static long rl() { return long.Parse(Console.ReadLine()); }
        static double rd() { return double.Parse(Console.ReadLine()); }
        static String[] rsa() { return Console.ReadLine().Split(' '); }
        static int[] ria() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); }
        static long[] rla() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); }
        static double[] rda() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); }
    }
}