Facto sum problem in test cases?

MY CODE:
https://ide.codingblocks.com/#/s/20813

PROBLEM:
https://hack.codingblocks.com/practice/p/359/56

I am having problems getting through 3/6 test cases.

(a+b)%c = ((a%c)+(b%c))%c
So in your code you’ll have to do
sum%(107) also