# coding: UTF-8 import math provided = input().split(' ') L = float(provided[0]) K = float(provided[1]) count = math.ceil(L / (2 * K)) - 1 answer = int(count * K) print(answer)