1def SubArraySum(arr, n):
2 n = len(arr)
3 temp,result = 0,0
4 # Pick starting point
5 for i in range(0, n):
6 # Pick ending point
7 temp=0;
8 for j in range(i, n):
9 # sum subarray between
10 # current starting and
11 # ending points
12 temp+=arr[j]
13 result += temp
14 return result