#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
const int output_precision = 15;
const long double pi = acos(-1);
const bool debug = true;
long long t, a, b;
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(output_precision);
  cout << fixed;
  cout.tie(0);
  cin >> t >> a >> b;
  if (t == 1 && a == 1 && b == 1) {
    cout << "inf" << '\n';
  } else if (t == 1 && a == 1 && b > 1) {
    cout << 0 << '\n';
  } else if (t > 1 && a == 1) {
    cout << (b == 1 ? 1 : 0) << '\n';
  } else {
    int ans = 0;
    if (b == a) ans++;
    if (t == 1) {
      long long tmp = b;
      int cnt = 0;
      while (tmp % a == 0) {
        tmp /= a;
        cnt++;
      }
      if (tmp == 1 && cnt >= 2) ans++;
    }
    vector<long long> v;
    while (b > 0) {
      v.push_back(b % a);
      b /= a;
    }
    long long sum = 0;
    long long cur = 1;
    for (int(i) = 0, j1234 = v.size(); (i) < j1234; (i)++) {
      sum += cur * v[i];
      cur *= t;
    }
    if (sum == a) {
      ans++;
    }
    cout << ans << '\n';
  }
}
