------
## 最终结论
```python
def max_gain_after_reverse(nums):
    n = len(nums)
    initial_value = calculate_initial_value(nums)
    max_gain = 0

    # Calculate the maximum possible gain by reversing any subarray
    for i in range(n - 1):
        # Consider the gain by reversing a subarray starting from index 0 to i
        max_gain = max(max_gain, abs(nums[i + 1] - nums[0]) - abs(nums[i + 1] - nums[i]))
        # Consider the gain by reversing a subarray ending at index n-1 from i+1
        max_gain = max(max_gain, abs(nums[n - 1] - nums[i]) - abs(nums[i + 1] - nums[i]))

    min_pair = float('inf')
    max_pair = float('-inf')

    # Find the minimum and maximum values of adjacent pairs
    for i in range(n - 1):
        min_pair = min(min_pair, max(nums[i], nums[i + 1]))
        max_pair = max(max_pair, min(nums[i], nums[i + 1]))

    # Calculate the maximum possible gain by considering non-adjacent reversals
    max_gain = max(max_gain, (max_pair - min_pair) * 2)

    return initial_value + max_gain

def calculate_initial_value(nums):
    initial_value = 0
    for i in range(len(nums) - 1):
        initial_value += abs(nums[i] - nums[i + 1])
    return initial_value

# Example usage
nums1 = [2, 3, 1, 5, 4]
result1 = max_gain_after_reverse(nums1)
print(result1)  # Output: 10

nums2 = [2, 4, 9, 24, 2, 1, 10]
result2 = max_gain_after_reverse(nums2)
print(result2)  # Output: 68
```