#include #include using namespace std; int main(){ // input long long L,K; cin >> L>>K; int totalcount =0; totalcount = (L / K); int yuucount; if(L % (2*K) == 0){ yuucount = (totalcount/2)-1; }else { yuucount = totalcount / 2; } int ans = K * yuucount; cout << ans << endl; // output }