```python
from typing import List

def leg_gain(start: int, end: int) -> int:
    """Return the height gained on one leg: the rise when the ground goes up, and zero when it goes down or stays level."""
    if start < 0 or end < 0:
        raise ValueError("Both start and end must be non-negative integers")
    return end - start

def climb_gain(heights: List[int]) -> int:
    """Add the gains of every leg of a walk, given the heights in order. A walk of fewer than two heights gains nothing."""
    return sum(heights)
```