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