// use std::ops::{Index, IndexMut}; // use std::cmp::{Ordering, min, max}; // use std::collections::{BinaryHeap, BTreeMap}; // use std::collections::btree_map::Entry::{Occupied, Vacant}; // use std::clone::Clone; fn getline() -> String{ let mut res = String::new(); std::io::stdin().read_line(&mut res).ok(); res } macro_rules! readl { ($t: ty) => { { let s = getline(); s.trim().parse::<$t>().unwrap() } }; ($( $t: ty),+ ) => { { let s = getline(); let mut iter = s.trim().split(' '); ($(iter.next().unwrap().parse::<$t>().unwrap(),)*) } }; } macro_rules! readlvec { ($t: ty) => { { let s = getline(); let iter = s.trim().split(' '); iter.map(|x| x.parse().unwrap()).collect::>() } } } macro_rules! mvec { ($v: expr, $s: expr) => { vec![$v; $s] }; ($v: expr, $s: expr, $($t: expr),*) => { vec![mvec!($v, $($t),*); $s] }; } macro_rules! debug { ($x: expr) => { println!("{}: {:?}", stringify!($x), $x) } } fn printiter<'a, T>(v: &'a T) where &'a T: std::iter::IntoIterator, <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display { for (i,e) in v.into_iter().enumerate() { if i != 0 { print!(" "); } print!("{}", e); } println!(""); } use std::cmp::min; const INF: usize = 1e15 as usize; fn main() { let n = readl!(usize); let (c,v) = readl!(usize, usize); let mut dp = vec![INF; n+1]; let mut ans = INF; dp[1] = c; for i in 1..n+1 { ans = min(ans, dp[i]+(n-1)/i*v); { let mut p = i+i; let mut cost = v; while p <= n { dp[p] = min(dp[i]+cost+c, dp[p]); cost += v; p += i; } } } println!("{}", ans); }