#include main(){ int L,K; scanf("%d%d",&L,&K); if(L % (K*2) == 0){ printf("%d",(L/(K*2)-1) * K); }else{ printf("%d",(L/(K*2)) * K); } }