#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair Pr; ll L, K; int main() { cin >> L >> K; ll ans = 0; while (L > K) { L -= K * 2; if(L != 0) ans += K; } cout << ans << endl; return 0; }