If you know Square Root Decomposition algorithm, then this problem will be a piece of cake for you. Just save the summation for each block.
Update: update the value of the index and update the summation of the corresponding block.
If you can do the update part, I believe solving the query part won't be any problem for you.