# -*- coding:utf-8 -*- import math N = input() M = input() def otoshidama(N, M): dama = N / M dama = dama / 1000 return math.floor(dama) * 1000 print int(otoshidama(N, M))