import java.util.Scanner object Main extends App { def gcd(a: Long, b: Long): Long = if (b == 0) a.abs else gcd(b, a % b) def lcm(a: Long, b: Long) = (a * b).abs / gcd(a, b) def proc(n: Long, a: Long, b: Long, c: Long): Int = { val ab = lcm(a, b) val ac = lcm(a, c) val bc = lcm(b, c) val abc = lcm(a, bc) (n / a + n / b + n / c - n / ab - n / ac - n / bc + n / abc).toInt } def blute(n: Int, a: Int, b: Int, c: Int): Int = { (1 to n).count { x => x % a == 0 || x % b == 0 || x % c == 0 } } val sc = new Scanner(System.in) val n = sc.nextInt() val a = sc.nextInt() val b = sc.nextInt() val c = sc.nextInt() val result = proc(100, 2, 3, 5) println(result) }