Google interview question

An array is given. Find the sum of elements in every possible substring.