The question is, how many multiplication and addition operations are required to determine:

And modify the sum to reduce the number of computations.

Are there (n-1) + n(i-1) addition operations (outer loop and inner loop respectively) and n*i multiplication operations?

Also, can it be rewritten as

Thanks.