fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let s: Vec = s.split_whitespace().flat_map(str::parse).collect(); let n = (s[1] - s[2]) * s[0]; let mut x = s[3]; let mut ans = 0; for i in 1..=n { if i % 10 == 0 && s[4] <= x { x -= s[4]; } ans += x; } println!("{}", ans); }