function main(input = ``) { let lines = input.split('\n'); let [totalLength, unitLength] = lines[0] .split(' ') .map((val) => parseInt(val)); totalLength / (unitLength * 2); if (totalLength % (unitLength * 2) === 0) { return (totalLength / (unitLength * 2) - 1) * unitLength; } else { return Math.floor(totalLength / (unitLength * 2)) * unitLength; } } const { readFileSync, existsSync } = require('fs'); const stdin = '/dev/stdin'; if (existsSync(stdin)) { const input = readFileSync(stdin, 'utf8'); console.log(main(input)); } module.exports = main;