#include int main(){ int L,k,m,c=0; scanf("%d%d",&L,&k); m=2*k; while(L>m)L-=m,c++; printf("%d",c*k); return 0; }