#include using namespace std; typedef long long ll; typedef vector VI; typedef vector VVI; #define ITER(c) __typeof__((c).begin()) #define FOREACH(it, c) for (ITER(c) it=(c).begin(); it != (c).end(); ++it) #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) #define RREP(i, n) for(int(i)=(n)-1;(i)>=0;--(i)) const int MOD = (int)1e9+7; ll N,M,W,H; int main(){ cin >> N >> M; cout << N/1000/M*1000 << endl; }