import sys
from collections import defaultdict

try:
    import mydebug

    def dprint(*objects):
        print(*objects)
except:
    def dprint(*objects, sep='', end='\n'): pass

n = int(input())
m = int(input())

n //= 1000
div = n // m
ans = div * 1000
print(ans)