#include using namespace std; int main(){ long long N,M; cin >> N >> M; cout <<((N/1000)/M)*1000 << endl; return 0; }