import java.util.Scanner; public class Main { int N; int M; int Dist; int Digit; int Divide; Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().solve(); } void solve() { N = sc.nextInt(); M = sc.nextInt(); Dist = N / M; Digit = (int)Math.log10(Dist) + 1; Divide = 1; for(int i = 0; i < Digit - 1; i ++) { Divide = Divide * 10; } Dist = (Dist / Divide) * Divide; if(Dist < 1000) { System.out.println(0); } else { while(Dist * M > N) { Dist = Dist - 1000; } System.out.println(Dist); } } }