-- yukicoder My Practice
-- author: Leonardone @ NEETSDKASU

n = io.read()
m = io.read()

x = math.floor(n / m)
y = math.floor(x / 1000) * 1000

print(string.format('%d', y))