You are viewing a single comment's thread. Return to all comments →
Hi, as the output can be very large (exceeding the limits of 64 bits integer) modulo operation common way to check the correctness of output.
It is only a explanation that first series is power of two, while second is power of three. You don't have to find such patter.
Thank you very much ismailmarmoush and abhiranjan :) you guys saved my day.
Also, 10^9+7 wasn't chosen randomly.
It could be any prime number.