package Yukicoder /** * Created by hichikawa on 2015/11/02. */ fun main(args: Array) { fun readLineLongArray() : List { val str = readLine() as String val arrStr = str.split(" ") val ret = arrStr.map { it.toLong() } return ret } fun readLineLong() : Long { val str = readLine() as String return str.toLong() } val inputNum = readLineLongArray() val pokeyLen = inputNum[0] val eatLen = inputNum[1] val eatLenTwo = eatLen * 2 if (pokeyLen / eatLenTwo * eatLenTwo - pokeyLen == 0.toLong()) { println(pokeyLen / eatLenTwo * eatLen - eatLen) } else { println(pokeyLen / eatLenTwo * eatLen) } }