import { readFileSync } from 'fs'; function Main(input: string) { const data = input.split('\n'); const firstLine = data[0].split(' ').map(Number); const pockeyLength = firstLine[0]; const oneBite = firstLine[1]; // 一口も食べない if (pockeyLength <= oneBite * 2) { console.log(0); process.exit(); } const maxBiteCount = Math.round(Math.round(pockeyLength / oneBite) / 2); console.log(maxBiteCount * oneBite); } Main(readFileSync('/dev/stdin', 'utf8'));