#include <bits/stdc++.h>
using namespace std;
vector<long long> polynomial;
int main() {
  long long t, a, b;
  cin >> t >> a >> b;
  if (t == 1) {
    if (a == 1 && b == 1) {
      cout << "inf" << endl;
      return 0;
    } else if (a == 1 && b != 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  if (t == 1 && a != 1 && b != 1) {
    long long temp = b;
    long long o(0);
    while (temp % a == 0) temp = temp / a;
    if (temp == 1) {
      cout << 1 << endl;
      return 0;
    }
  }
  if (t > a || a > b)
    if (a == b) {
      cout << 1;
      return 0;
    } else if (a != b) {
      cout << "0";
      return 0;
    }
  long long ans(0);
  if (a == b) ans++;
  while (b != 0) {
    polynomial.push_back(b % a);
    b = b / a;
  }
  long long sum(0);
  for (long long i = polynomial.size() - 1; i >= 0; i--)
    sum = sum * t + polynomial[i];
  if (sum == a) ans++;
  cout << ans << endl;
  return 0;
}
