use std::io::Read; fn main() { let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).unwrap(); let mut iter = buf.split_whitespace(); let n: usize = iter.next().unwrap().parse().unwrap(); let a: usize = iter.next().unwrap().parse().unwrap(); let b: usize = iter.next().unwrap().parse().unwrap(); let c: usize = iter.next().unwrap().parse().unwrap(); let mut answer: usize = n/a + n/b + n/c; let mut b_mul: usize = b; while b_mul <= n { if b_mul % a == 0 { answer -= 1; } b_mul += b; } let mut c_mul: usize = c; while c_mul <= n { if c_mul % a == 0 || c_mul % b == 0 { answer -= 1; } c_mul += c; } println!("{}", answer); }