fn getline() -> String{ let mut ret = String::new(); std::io::stdin().read_line(&mut ret).ok(); ret } fn getvec(string: String) -> Vec { string.trim().split_whitespace() .map(|s| s.parse().unwrap()) .collect() } fn main() { let v = getvec(getline()); let l = v[0]; let k = v[1]; let a = if l%(k*2) == 0 { (l/k/2-1)*k } else { l/k/2*k }; println!("{}",a); }