# 「CF493E」Vasya and Polynomial

2014年12月4日3,1766

Vasya is studying in the last class of school and soon he will take exams. He decided to study polynomials. Polynomial is a function P(x) = a0 + a1x1 + … + anxn. Numbers ai are called coefficients of a polynomial, non-negative integer n is called adegree of a polynomial.

Vasya has made a bet with his friends that he can solve any problem with polynomials. They suggested him the problem: “Determine how many polynomials P(x) exist with integer non-negative coefficients so that , and , where and b are given positive integers”?

Vasya does not like losing bets, but he has no idea how to solve this task, so please help him to solve the problem.

Input

The input contains three integer positive numbers no greater than 1018.

Output

If there is an infinite number of such polynomials, then print “infwithout quotes, otherwise print the reminder of an answer modulo 109 + 7.

Sample test(s)
input

output

input

output

t=a=b=1，有无数解

t=a=b=n(n>1)，此时有两解 p(x)=a p(x)=x

—————————————————————————————-

p(t)=a可以得出多项式的系数和<a，t=1时系数和<=a下面会另外讨论

—–如 1497 = 2 × 93 + 4 ×9 + 3 -> p(x) = 2 x3 + 4 x + 3

—–如2 x3 + 4 x + 3 -> x3 + 13 x + 3

（p(x)系数和等于0的情况即a=b，若t<>a=b则显然只有一解p(x)=a）

*但若t=1，且p(x)系数和为1，调整后p'(x)系数和为a，形如p(1)=k，p(k)=k^q，则唯一解为p(x)=k*x^(q-1)

—————————————————————————————-

1 1 10