#include <bits/stdc++.h>
using namespace std;
long long modexp(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res *= a;
    b >>= 1;
    a = (a * a);
    if (res > 1000000000000000000) break;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  long long t, a, b;
  cin >> t >> a >> b;
  if (a == 1 && t == 1 && b == 1)
    cout << "inf\n";
  else if (a == b && a != t)
    cout << 1 << "\n";
  else if (a == t && a == b)
    cout << 2 << "\n";
  else if (a == t && a != b)
    cout << 0 << "\n";
  else if ((b - a) % (a - t))
    cout << 0 << "\n";
  else if ((b - a) * (a - t) < 0)
    cout << 0 << "\n";
  else if (t == 1)
    cout << 1 << "\n";
  else {
    long long h1 = log(b) / log(a);
    long long h2 = log(a) / log(t);
    if (h1 == h2)
      cout << "1\n";
    else
      cout << "0\n";
  }
  return 0;
}
