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