#include <bits/stdc++.h>
using namespace std;
void pre() {}
void solve() {
  long long n, i, j, l, m, k, a, b, s;
  cin >> n >> a >> b;
  if (n == 1) {
    if (a == 1 && b == 1)
      cout << "inf\n";
    else if (a == 1)
      cout << "0\n";
    else {
      long long ans = 0, sum = 0, pa = 1, cb = b, sum1 = 0;
      while (b > 0) {
        k = b % a;
        b /= a;
        sum += k * pa;
        sum1 += k;
        pa = pa * a;
      }
      if (sum == cb && sum1 == a) ans++;
      if (cb % a == 0) ans++;
      cout << ans << endl;
    }
  } else {
    long long ans = 0, sum = 0, pa = 1, cb = b;
    if (a > 1) {
      while (b > 0) {
        k = b % a;
        b /= a;
        sum += k * pa;
        pa = pa * n;
      }
      if (sum == a) ans++;
    }
    if (a == cb) ans++;
    cout << ans << endl;
  }
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
