import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.System.in; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(in)); long N = Long.parseLong(reader.readLine()); long M = Long.parseLong(reader.readLine()); findMaximunOtosidama(N, M); } private static void findMaximunOtosidama(long N, long M) { int lo = 1; int hi = 10000; while (lo < hi) { int mid = lo + (hi - lo + 1) / 2; if (isFeasible(N, M, mid)) { lo = mid; } else { hi = mid - 1; } } System.out.println((lo / 1000) * 1000); } private static boolean isFeasible(long N, long M, int money) { return money * M <= N; } }