#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,abm,mmx,tune=native")
using namespace std;
const int64_t INF = (int64_t)(2e18);
const int maxn = 500 * 1000 + 100;
chrono::time_point<chrono::steady_clock> cl;
double current_time() {
  return (double)(chrono::steady_clock::now() - cl).count() / 1e9;
}
void no() {
  cout << "0";
  exit(0);
}
void inf() {
  cout << "inf";
  exit(0);
}
void ans(long long a) {
  cout << a;
  exit(0);
}
int32_t main() {
  cl = chrono::steady_clock::now();
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  cin.tie(nullptr);
  long long x, y, z;
  cin >> x >> y >> z;
  if (x == y && y != z) no();
  if (x != y && y == z) ans(1);
  if (x == z && y != z) no();
  if (x == y && y == z) {
    if (x == 1) inf();
    if (x != 1) ans(2);
  }
  if (x > y) no();
  if (y > z) no();
  bool flag = false;
  if (x == 1ll) {
    flag = true;
    long long zz = z;
    while (z > 1) {
      if (z % y != 0) flag = false;
      z /= y;
    }
    z = zz;
  }
  vector<int> a;
  long long zcp = z;
  while (zcp > 0) {
    a.push_back(zcp % y);
    zcp /= y;
  }
  long long cur = 0;
  long long curx = 1;
  for (auto& it : a) {
    cur += it * curx;
    curx *= x;
  }
  int res = 0;
  if (cur == y) ++res;
  if (flag) ++res;
  cout << bool(res);
  return 0;
}
