scan = string.gmatch(io.read(),"%d+") l = scan() - 0 k = scan() - 0 dk = k * 2 if dk > l then print(0) elseif l % dk == 0 then print((math.floor(l/dk)-1)*k) else print(math.floor(l/dk)*k) end