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