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