(define (gcd x y)
  (let ((r (mod x y)))
    (if (= r 0)
	y
	(gcd y r))))

(define (lcm x y)
  (/ (* x y) (gcd x y)))

(define (sum n a b c)
  (-
   (+ (quotient n a)
      (quotient n b)
      (quotient n c)
      (quotient n (lcm a (lcm b c))))
   (quotient n (lcm a b))
   (quotient n (lcm b c))
   (quotient n (lcm c a))))

(let ((n (read))
      (a (read))
      (b (read))
      (c (read)))
  (print (sum n a b c)))