import java.util.*; public class Exercise58{ public static void main (String[] args){ Scanner sc = new Scanner(System.in); long n = sc.nextInt(); long a = sc.nextInt(); long b = sc.nextInt(); long c = sc.nextInt(); long count = 0; count += n / a; count += n / b; count += n / c; long lcmAB = getLcm(b, a); count -= n / lcmAB; long lcmBC = getLcm(c, b); count -= n / lcmBC; long lcmAC = getLcm(c, a); count -= n / lcmAC; long lcmAll = getLcm(lcmBC, a); count += n / lcmAll; System.out.println(count); } private static long ea(long biggerNum, long smallerNum){ long mod = biggerNum % smallerNum; if (mod == 0){ return smallerNum; } else { return ea(smallerNum, mod); } } private static long getLcm(long biggerNum, long smallerNum){ long gcm = ea(biggerNum, smallerNum); long lcm = biggerNum * smallerNum / gcm; return lcm; } }