# coding: utf-8 # yukicoder No.128 お年玉(1) N = int(input()) M = int(input()) print(int((N / M) // 1000 * 1000))