l, k = [int(x) for x in input().split()] print(l // (k * 2) * k if l / (k * 2) != 1 else 0)