N = input() M = input() max = N / M give = (max / 1000) * 1000 print give