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