#include <bits/stdc++.h>
using namespace std;
unsigned long long int typedef li;
const li mod = 1000000007;
li power(li a, li n) {
  if (!n) return 1;
  li c = 1;
  while (n > 1) {
    if (n & 1) c = c * a % mod;
    a = a * a % mod;
    n /= 2;
  }
  return a * c % mod;
}
li geom(li a, li n) {
  if (a == 1) return 1;
  return (power(a, n + 1) - 1) * (power(a - 1, mod - 2)) % mod;
}
bool div(li a, li b) {
  if (a == 1) return true;
  if (b % a) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  li t, a, b, k = 69;
  cin >> t >> a >> b;
  li amod = t, bmod = a;
  if (t == a) {
    if (a == b) {
      if (a == 1)
        cout << "inf";
      else
        cout << 2;
    } else
      cout << 0;
  } else if (a == b)
    cout << 1;
  else if (b == t)
    cout << 0;
  else if (b < a || a < t)
    cout << 0;
  else if (!div(a - t, b - a))
    cout << 0;
  else {
    while (k--) {
      if (b % bmod % amod != a % amod) goto kraj;
      a /= amod;
      b /= bmod;
    }
    goto end;
  }
  return 0;
end:
  cout << 1;
  return 0;
kraj:
  cout << 0;
  return 0;
}
