#include using namespace std; int main() { int L, K; cin >> L >> K; int T = (L-1)/(K*2); cout << T * K << endl; }