class RangeSum:
    def __init__(self, nums):
        self.sums = [0 for _ in range(len(nums) + 1)]
        for i, num in enumerate(nums):
            self.sums[i + 1] = num + self.sums[i]
    
    def get_range_sum(self, start, end):
        return self.sums[end + 1] - self.sums[start]

nums = [1, 2, 3, 4, 5, 6, 7]
range_sum = RangeSum(nums)
print(range_sum.get_range_sum(1, 3))