#include using namespace std; int main(){ int n,m,i; cin >> n >> m; i = 0; while ((n - 1000 * i * m) >= 0 ) { i++; } cout << (i - 1) * 1000 << "\n"; return 0; }