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