# include # include # include # include # include # include # include # include # include # include # include # include # include # include using namespace std; using LL = long long; using ULL = unsigned long long; constexpr long long MOD = 1000000000 + 7; constexpr long long INF = 1000000000; const double PI = acos(-1); int main() { int l, k; cin >> l >> k; cout << (l % (k * 2) != 0 ? k*(l / (k * 2)) : k*(l / (k * 2) - 1)) << endl; }