def solve(): L, K = map(int, input().split()) top = 10**9 + 1 btm = 0 while top - btm > 1: mid = (top + btm) // 2 if L - 2 * K * mid <= 0: top = mid else: btm = mid ans = btm * K print(ans) if __name__ == '__main__': solve()