# include # include # include # include # include # include # include # include # include # include # include # include # include # include # include #include #include #include #include #include using namespace std; typedef long long int ll; const int N = 1000000; const ll INF = std::numeric_limits::max(); #define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i) #define ALL(x) x.begin(),x.end() #define pp pair #define fi first #define se second #define sz size const ll mod = 1000000007; string YN(bool b) { return(b ? "YES" : "NO"); } string yn(bool b) { return(b ? "Yes" : "No"); } ll l, k; int main() { cin >> l >> k; cout << ((l / k / 2)-(l%(k*2)==0?1:0))*k << endl; return 0; }