Oleg and Data Science

아직 제출이 없습니다시간 제한2초메모리 제한256 MB

문제

Nowadays, everybody has heard about machine learning, neural networks and big data. And so has the student Oleg, who also wants to be in trend. He began to work hard at analyzing various datasets with Python. It's so nice to come to co-working, add a couple of layers to the neural network and, leaning back in the chair, sip the smoothies while the computer processes gigabytes of data! But today, something went wrong, and Oleg asks for your help.

Initially, he had an array aa containing very important data: all integers from LL to RR, inclusive. Then Oleg wrote a function f(a,m)f (a, m) which returns a new array where each integer is replaced by its remainder modulo mm. Finally, Oleg mistyped and executed the line a=f(a,Q)a = f (a, Q), thereby replacing the original array aa! To assess the scale of the tragedy, he wants to calculate the number of such positive integers XX that, regardless of the content of the original array aa, the result of the function f(a,X)f (a, X) will be the same as if Oleg had not executed that hapless line.

If the problem is not clear yet, here is the mathematical statement. It is required to calculate the number of such positive integers XX that, for all integers SS from the segment \[L,R]\[L, R], it is true that ((SmodQ)modX)=(SmodX).((S \bmod Q) \bmod X) = (S \bmod X)\text{.}

입력

The only line contains three integers separated by spaces: LL, RR and QQ (1L,R,Q10121 \leq L, R, Q \leq 10^{12}, LRL \leq R).

출력

If the number of suitable positive integers XX is finite, print it. Otherwise, print the word "infinity".