def _sum(a, i, j):
    """Return the sum of the elements from a[i] to a[j]."""
    if i > j:                        # T(n) = 0 
        return 0
    if i == j:                       # T(n) = 1
        return a[i]
    mid = (i+j)//2
    return _sum(a, i, mid) + _sum(a, mid+1, j)