#include #define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false)) using namespace std; int main() { fastIO; int l, k; cin >> l >> k; if ((l % k == 0) && (l / k % 2 == 0)) { cout << ((l / k / 2 - 1) * k) << '\n'; } else { cout << ((l / k / 2) * k) << '\n'; } return 0; }