#include using namespace std; int main(){ int l,k; cin >> l >> k; int a=l/(2*k); if(l%(2*k)==0)a--; cout << a*k << endl; return 0; }