#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  long long t, a, b;
  cin >> t >> a >> b;
  if (t == 1 && a == 1 && b == 1) {
    cout << "inf\n";
  } else if (b < a || a < t) {
    cout << (a == b ? 1 : 0) << endl;
  } else if (a == t) {
    cout << (a == b ? 2 : 0) << endl;
  } else {
    long long q = b;
    while (q > 1 && q % a == 0) {
      q /= a;
    }
    if (t == 1 && q == 1) {
      cout << 1 << endl;
    } else {
      int c = a == b ? 1 : 0;
      vector<long long> coef(64);
      int idx = 0;
      while (b > 0) {
        coef[idx] = b % a;
        b /= a;
        idx++;
      }
      long long m = 0;
      for (--idx; idx >= 0; --idx) {
        m = m * t + coef[idx];
      }
      if (m == a) ++c;
      cout << c << endl;
    }
  }
  return 0;
}
