use std::collections::*; fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } fn main() { let n: usize = read(); let v: Vec = read_vec(); let (c, v) = (v[0], v[1]); let mut dp: Vec> = vec![vec![std::u32::MAX; n + 1]; n + 1]; dp[1][1] = c; for i in 1..n + 1 { for j in 1..n + 1 { if dp[i][j] == std::u32::MAX { continue; } let index = std::cmp::min(i + j, n); if dp[index][j] > dp[i][j] + v { dp[index][j] = dp[i][j] + v; dp[index][index] = std::cmp::min(dp[index][j] + c, dp[index][index]); } } } let mut ans = std::u32::MAX; // println!("{:?}", dp[n]); for j in 1..n + 1 { ans = std::cmp::min(ans, dp[n][j]); } println!("{:?}", ans); }