#include using namespace std; int main(){ int n,m; cin >> n >> m; int a = n / m; cout << (a / 1000) * 1000 << "\n"; return 0; }