n = int(input()) m = int(input()) res = n // 1000 // m * 1000 print(res)