#include <bits/stdc++.h>
using namespace std;
bool test(long long t, long long a, long long b) {
  long long result = 0LL;
  long long mult = 1LL;
  while (b) {
    long long temp = b % a;
    b /= a;
    result += (mult * temp);
    mult *= t;
    if (result > a) break;
  }
  return result == a;
}
int main() {
  long long t, a, b;
  cin >> t >> a >> b;
  if (t == 1) {
    if (a == b && a == 1)
      cout << "inf" << endl;
    else if (a == b)
      cout << 1 << endl;
    else if (b < a)
      cout << 0 << endl;
    else if (a == 1)
      cout << 0 << endl;
    else if (t <= a) {
      bool moze = test(t, a, b);
      while (b % a == 0) b /= a;
      if (b == 1) moze = true;
      cout << moze << endl;
    } else {
      cout << 0 << endl;
    }
  } else {
    if (a == b && a == t) {
      cout << 2 << endl;
    } else if (a == b) {
      cout << 1 << endl;
    } else if (a < t || b < a) {
      cout << 0 << endl;
    } else {
      cout << test(t, a, b) << endl;
    }
  }
  return 0;
}
