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