In the lab, Jesse & Heisenberg were experimenting with some formulas that they made for synthesizing their product. To come up with a new product, Heisenberg arranged different molecular weights which are integers in the form of a series. The resulting series goes like -
1,1,2,3,5,8,13....
"Yo, Mr. White! I don't understand any damn thing."
"Just do as I say, Jesse. This is how things work in science."
In order to synthesize a new product, Heisenberg needs to find out HCF (Highest Common Factor) of given two terms from the series modulo 109+7.
He gives this job to Jesse, and asks him to complete this as soon as possible. Jesse has no clue about the series, so he wants your help.
"Yo, Help me out bro!"
INPUT
OUTPUT
CONSTRAINTS
For the first case,
M=3 & N=6
Mth term = 3rd term = 2
Nth term = 6th term = 8
HCF of 2 & 8 = 2