WA in single test-case in Carol and Skulls

I am getting a WA in a single test case in Carol and Skulls. I think it is a tricky edge case but am not able to find the error.

Here, is the link to my solution.

Please help.
Thanks. :slight_smile:

your code fails here

1

1

-5

Expected output:-5

Your output:0

Answer should be -5 because in the question it is mentioned that you need to select atleast one element.

@hruday968 I’ve updated my code and the output to the given test case is -5 but still I get a WA. Here’s the link: https://www.codechef.com/viewsolution/14744946

@hruday968 I got an AC. It’s because I was turning in a negative modulo 1e9 + 7. I added 1e9+7 to the result and the moduloed it as the output. It was mentioned in the question, I somehow missed it. Anyways, thanks for your answer. :slight_smile:

//