L, K = map(int, input().split()) K2 = 2 * K a = 0 if L % K2 == 0: a = (L // K2) - 1 else: a = L // K2 print(a * K)