a, b = map(int, input().split()) print(a // (b * 2) * b if a % (b * 2) else 0)