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