#include //cin, cout #include //vector #include //sort,min,max,count #include //string,getline, to_string #include //abs(int) #include //swap, pair using namespace std; int main() { int L, K; cin >> L >> K; int ans; int mod; if (L <= K * 2) { ans = 0; } else { ans = (L / (2 * K)) * K; mod = L % (2 * K); if (mod == 0) { ans -= K; } } cout << ans << endl; return 0; }