# -*- coding: utf-8 -*-
n = int(input())
m = int(input())

result = (n // (m * 1000)) * 1000
print(result)