import math

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

print(1000 * math.floor(math.floor(n / 1000)/ m))