I've stumbled upon a version of this problem with smaller constraints on another site: 177 — G2 and managed to solve it using a naive approach (I believe it'd get me 30% of the points in this version aswell).
But I really want to know the intended solution that works with such large constraints, any help is appreciated, thanks
The solution I can think of is rather advanced, it involves linear-time string matching (KMP or Rabin-Karp) and matrix exponentiation.
If we can perform Berlekamp-Massey on the result for small fibonacci strings (at least $$$|s_i| \le |S| \le 10\cdot |s_i|$$$), the templates made for the algorithm should be able to take case of the rest.