N = int(input())
M = int(input())

new_N = N // 1000
ans = (new_N // M) * 1000

print(ans)