function Main(input) { // const data = input.split("\n"); let data = input.split(" "); let L = data[0]; let K = data[1]; let count = 0; if ( L/K <= 2 ) { count = 0; } else { if ( L%K === 0 ) { if ( (L/K)%2 === 0 ) { count = ((L/K)-2)/2; } else { count = ((L/K)-1)/2; } } else { if ( Math.floor(L/K)%2 === 0 ) { count = (Math.floor(L/K))/2; } else { count = (Math.floor(L/K)-1)/2; } } } console.log(count * K); } Main(require("fs").readFileSync("/dev/stdin", "utf8"));