object Main extends App{
def gcd(a: Long, b: Long):Long=if (b==0) a else gcd(b, a%b)
def lcm(a: Long, b: Long)=(a*b) / gcd(a,b)
  import java.{util => ju}
  import scala.annotation._
  import scala.collection._
  import scala.collection.{mutable => mu}
  import scala.collection.JavaConverters._
  import scala.math._
  val sc = new ju.Scanner(System.in)
  val n = sc.nextLong
  val a,b,c = sc.nextLong
  println(n / a + n / b + n / c - n / lcm(a,b) - n / lcm(b,c) - n / lcm(c,a) + n / lcm(lcm(a,b),c))
}