import math N = int(input()) M = int(input()) n1 = N / 1000 m1 = math.floor(n1 / M) answer = m1 * 1000 print(answer)