use std::collections::HashMap; fn main() { let mut xayb = String::new(); std::io::stdin().read_line(&mut xayb).ok(); let xayb: Vec = xayb.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let x = xayb[0]; let a = xayb[1]; let y = xayb[2]; let b = xayb[3]; if y == 1 { println!("Yes"); return; } let mut xfactors = HashMap::new(); let mut yfactors = HashMap::new(); let mut xtarget = x; let mut ytarget = y; for i in 2..=(x as f64).sqrt().floor() as usize { while xtarget % i == 0 { xtarget /= i; *xfactors.entry(i).or_insert(0usize) += 1; } } if xtarget > 1 { xfactors.insert(xtarget, 1); } for i in 2..=(y as f64).sqrt().floor() as usize { while ytarget % i == 0 { ytarget /= i; *yfactors.entry(i).or_insert(0usize) += 1; } } if ytarget > 1 { yfactors.insert(ytarget, 1); } let mut flg = true; for (&key, &ycnt) in yfactors.iter() { if let Some(&xcnt) = xfactors.get(&key) { flg &= (xcnt * a) % (ycnt * b) == 0; } else { flg = false; } } if flg { println!("Yes"); } else { println!("No"); } }