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