#include using namespace std; int main(){ int L, K; cin >> L >> K; int i=0; while(L>0){ L -= 2*K; i++; } cout << (i-1)*K << endl; return 0; }