N = int(input()) // 1000
M = int(input())

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