package yukicoder;

import java.util.Scanner;

public class Yuki11 {
	
	public static void main(String[] args) {
		
		final int thousand = 1000;
		
		Scanner scan = new Scanner(System.in);
		long n = scan.nextLong();
		int m = scan.nextInt();
		scan.close();
		
	    if(n >= m*thousand && m > 0){
	    	System.out.println(thousand*(n/(m*thousand)));
	    }else{
	    	System.out.println(0);
	    }
	}
}