import scala.annotation.tailrec import scala.io.StdIn.* def calcPrimeFactor(value: Long): List[(Long, Int)] = @tailrec def inner(v: Long, p: Long, e: Int, result: List[(Long, Int)]): List[(Long, Int)] = v match case 1 => if e == 0 then result else (p, e)::result case _ if v % p == 0 => inner(v / p, p, e + 1, result) case _ if e != 0 => inner(v, p + 1, 0, (p, e)::result) case _ if v < p * p => (v, 1)::result case _ => inner(v, p + 1, 0, result) inner(value, 2, 0, Nil) @main def main = val Array(x, a, y, b) = readLine().split(' ').map(_.toLong) @tailrec def isDividable(x: List[(Long, Int)], y: List[(Long, Int)]): Boolean = (x, y) match case (_, Nil) => true case (Nil, _) => false case ((px,ex)::xt, (py, ey)::yt) => if px == py then (ex * a) >= (ey * b) && isDividable(xt, yt) else isDividable(xt, y) val xp = calcPrimeFactor(x) val yp = calcPrimeFactor(y) val result = isDividable(xp, yp) println(if result then "Yes" else "No")