import math n = int(input()) m = int(input()) gift = math.floor(n / m / 1000) print(gift * 1000)