#include using namespace std; int main(void) { int L, K; cin >> L >> K; cout << (L - 1) / (K * 2) * K << "\n"; return 0; }