BIT 09 Update It

I can’t visualize how the cumulative sum is the required answer and why not query(pos) - query(pos-1) not the answer?

Please add the problem link.