British: Title Link：https://codeforces.com/contest/1105/problem/C From the title , what we need is sequence sum divided by 3 ，no matter what mess it's stuffed with。Think about "dp". The shift formula is obvious：

f[i][j]=∑(k=l) (r) f[i-1][(j-k)%3];

Complexity of time is O(n(r-l)）, Complexity of memory is O(n). We can find that n is quivalent to n%3，The shift formula turn to：