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