import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
m=int(input())
ans=(n//m)//1000*1000
print(ans)