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