n = long(raw_input())
m = long(raw_input())

gift = n / m
if gift % 1000L != 0:
	gift = gift - gift % 1000L + 1000L

print gift