#include using namespace std; int main(){ int N; int M; cin>>N; cin>>M; N=N/1000; cout<<(N/M)*1000<