(l, k) = list(map(int, input().split())) count = 0 (a, b) = divmod(l, k * 2) if b == 0: a -= 1 print(a * k)