fn read<T: std::str::FromStr>() -> Vec<T>
where
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut b = String::new();
    std::io::stdin().read_line(&mut b).unwrap();
    b.split_whitespace()
        .map(|x| x.trim().parse::<T>().unwrap())
        .collect()
}

fn gcd(x: u64, y: u64) -> u64 {
    let (x, y) = if x < y { (x, y) } else { (y, x) };
    if x == 0 {
        return y;
    }

    return gcd(x, y % x);
}

fn main() {
    let iv = read::<u64>();
    let a = iv[0];
    let b = iv[1];
    let ag = gcd(a + b, a);
    let bg = gcd(a + b, b);
    println!("{}", gcd(a + b, ag / gcd(ag, bg) * bg));
}