Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time
0), height of Xaniar is
h1 and height of Abol is
h2. Each second, Mike waters Abol and Xaniar.
So, if height of Xaniar is
h1 and height of Abol is
h2, after one second height of Xaniar will become
and height of Abol will become
where
x1,y1,x2 and
y2 are some integer numbers and
denotes the remainder of
a modulo
b.
Mike is a competitive programmer fan. He wants to know the minimum time it takes until height of Xania is
a1 and height of Abol is
a2.
Mike has asked you for your help. Calculate the minimum time or say it will never happen.