use std::io::Read;

fn main() {
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).ok();
    let mut input = input
        .split_whitespace()
        .map(|x| x.parse::<usize>().unwrap());
    let (n, m) = (input.next().unwrap(), input.next().unwrap());

    println!("{}", (n / (1000 * m)) * 1000);
}