N = int(input()) M = int(input()) a = N//1000 b = a//M c = 1000*b print(c)