#include <bits/stdc++.h>
using namespace std;
long long t, a, b;
long long ans;
void solve() {
  if (a == 1) return;
  vector<long long> arr;
  long long copy_b = b;
  while (copy_b > 0) {
    arr.push_back(copy_b % a);
    copy_b /= a;
  }
  if (arr.size() < 2) return;
  long long val = 0, add = 1;
  for (long long i = 0; i < arr.size(); ++i) {
    val += arr[i] * add;
    add *= t;
  }
  if (val == a) ans++;
}
int main() {
  cin >> t >> a >> b;
  if (t != 1) {
    solve();
  } else {
    if (a == 1) {
      if (b == 1)
        cout << "inf\n";
      else
        cout << "0\n";
      return 0;
    }
    {
      long long pa = a;
      while (a <= (long long)1e9 && pa < b) {
        pa *= a;
      }
      if (pa == b) {
        cout << "1\n";
        return 0;
      }
    }
    solve();
  }
  if (a == b) ans++;
  cout << ans << '\n';
}
