<doocs>1508.Range Sum of Sorted Subarray Sums_1.py
def rangeSum( nums: List[int], n: int, left: int, right: int) -> int:
    arr = []
    for i in range(n):
        s = 0
        for j in range(i, n):
            s += nums[j]
            arr.append(s)
    arr.sort()
    MOD = 10**9 + 7
    return sum(arr[left - 1 : right]) % MOD
def sample_funcname ( var_0 : List [ int ] , var_3 : int , var_4 : int , var_5 : int ) -> int :
    var_6 = [ ]
    for var_8 in range ( var_3 ) :
        var_10 = 0
        for var_11 in range ( var_8 , var_3 ) :
            var_10 += var_0 [ var_11 ]
            var_6.append ( var_10 )
    var_6.sort ( )
    var_17 = 10 ** 9 + 7
    return sum ( var_6 [ var_4 - 1 : var_5 ] ) % var_17
