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