Fixes simplification of more than two summations
Merge pull request #8608 from shivamvats/shivam/8596

Fixes simplification of more than two summations