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