#include using namespace std; using ll = long long; #define itn int #define rep2(i,a,n) for(int i = (a);i < (n);i++) #define rep(i,n) rep2(i,0,n) using P = pair; int main(void){ ll l,k; cin >> l >> k; ll ans = k * (l / (2*k)); if((l % (2*k)) == 0)ans -= k; cout << ans << endl; }