import math L, K = map(int,(input().split())) if math.floor(L / K) <= 2: ans = 0 else: ans = math.floor(L / K / 2) * K print(ans)