n = int(input()) m = int(input()) res = n // m q, r = divmod(res, 1000) print(q * 1000)