N = int(input()) M = int(input()) res = 0 bill = N // 1000 res = 1000 * (bill // M) print(res)