N = int(input()) M = int(input()) ans = (N // M) // 1000 * 1000 print(ans)