```python
def leg_gain(start: int, end: int) -> int:
    """
    Calculate the height gained on one leg.
    
    Args:
    start (int): The starting height.
    end (int): The ending height.
    
    Returns:
    int: The height gained on one leg.
    """
    if start > end:
        return end - start
    elif start < end:
        return start - end
    else:
        return 0

def climb_gain(heights: list) -> int:
    """
    Calculate the total height gained from a walk.
    
    Args:
    heights (list): A list of heights representing the walk.
    
    Returns:
    int: The total height gained from the walk.
    """
    if len(heights) < 2:
        return 0
    
    total_gain = 0
    for i in range(1, len(heights)):
        total_gain += leg_gain(heights[i], heights[i - 1])
    
    return total_gain
```