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