N = int(input()) M = int(input()) maisuu = N // 1000 hitori = maisuu // M print(1000 * hitori)