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