Help in prmq problem of june challenge!

Link of my solution: Solution: 14364516 | CodeChef
I don’t know where my implementation is going wrong. I tried many test cases, but no luck :frowning:
Can someone provide me some test cases or point out the mistake in my code.

Take this test case-

Input
10
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000
1
1 9 1 100
Your Output
0
Correct Output
108

Thanks. It worked :slight_smile: