I see you edited some more, now really fixing that uninteresting off-by-one error. But it still doesn't work, as the main error is still there. It works until n = 5 (not "N", btw) but fails for n = 6 and higher. Submitting it would've shown that to you.
Can you fix it? Maybe it's possible, but I don't see how. Can't find the mistake in your reasoning if I don't know your reasoning.
Every addition just use mod 1000000007 before you store it.
add(add(add(newA0L0, A0L0), A0L1), A0L2);
could be rewritten to newA0L0 = (A0L0+A0L1+A0L2) % 1000000007 , where all variables are long type.
Thus it only requires 1 mod operation instead of calling int& add(int& a, int b) 3 times.