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