# ICL21C -(problems with modulo answer technique)

Hi All,

This is my first post. so apologies if there is any mistake in the writings.

I used the below method to solve the ICL21C problem tag but I think due to the large answer modulo some number I was keep getting WA.

https://www.codechef.com/viewsolution/43962180

So my question is if we need to give an answer modulo some number then we need to use the same method used by the problem setter which beats the creativity to solve the problem.

Apologies again if I made any mistakes in the post

Didn’t go through it fully, but the linked stack exchange post gives a recurrence:

a_{n + 1} = 2 \times a_{n} + a_{n - 2} + a_{n - 3},

or reducing the indices:

a_{n} = 2 \times a_{n - 1} + a_{n - 3} + a_{n - 4}

However in your code, you wrote:

a_{n} = 2 \times a_{n - 1} + a_{n - 2} + a_{n - 3}

Note the difference in the last two terms.

Hi,

the reoccurrence relationship is below

2an−an−2+an−3