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