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