cf 257 div2 A and B , linear recurrence, matrix expo