#include int main(void){ int L, K; int ans = 0; scanf("%d %d", &L, &K); while(L>2*K){ L -= 2*K; ans += K; } printf("%d\n", ans); return 0; }