use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; use std::iter::FromIterator; fn main() { let cin = stdin(); let mut scan = Scanner::new(cin.lock()); let t = scan.read::(); let a = scan.read::(); let b = scan.read::(); let l = lcm(a, b); println!("{}", (t-1) / a + 1 + (t-1) / b + 1 - ((t-1) / l + 1)); } #[allow(dead_code)] pub fn gcd(a: i64, b: i64) -> i64 { if b == 0 { a } else { gcd(b, a % b) } } #[allow(dead_code)] pub fn lcm(a: i64, b: i64) -> i64 { a / gcd(a, b) * b } // region template #[allow(dead_code)] fn iu(i: i64) -> usize { i as usize } #[allow(dead_code)] fn ui(i: usize) -> i64 { i as i64 } #[allow(dead_code, deprecated)] fn join(slice: &[T], sep: &str) -> String { let strings = slice.iter().map(|t| format!("{}", t)).collect::>(); strings.connect(sep) } #[allow(dead_code)] fn arr<'a, S, T>(n: usize, mut f: S) -> Vec where S: FnMut(usize) -> T + 'a { (0..n).map(|i| f(i)).collect::>() } #[allow(dead_code)] fn alt(v: Vec) -> T where T: FromIterator { v.into_iter().collect::() } #[allow(dead_code)] fn dup(v: &[S]) -> T where T: FromIterator, S: Clone { v.iter().cloned().collect::() } struct Scanner<'a> { cin: StdinLock<'a>, } #[allow(dead_code)] impl<'a> Scanner<'a> { fn new(cin: StdinLock<'a>) -> Scanner<'a> { Scanner { cin: cin } } fn read1(&mut self) -> Option { let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::(); token.parse::().ok() } fn read(&mut self) -> T { self.read1().unwrap() } fn readn(&mut self, n: usize) -> Vec { (0..n).map(|_| self.read::()).collect() } fn chars(&mut self) -> Vec { self.read::().chars().collect() } } // endregion