use std::io::{self, BufRead}; fn main() { let input = io::stdin() .lock() .lines() .map(|l| { l.unwrap() .split_whitespace() .map(std::string::ToString::to_string) .collect::>() }) .collect::>(); let l = input[0][0].parse::().unwrap(); let k = input[0][1].parse::().unwrap(); println!("{}", (l / (2 * k) + (l % (2 * k)).signum() - 1) * k); }