#include <bits/stdc++.h>
using namespace std;
const int inf = 2e8 + 5;
const long long l_inf = 9e18 + 5;
template <typename T>
inline T mod(T a, T b) {
  return (a % b + b) % b;
}
template <typename T, typename T2>
ostream &operator<<(ostream &s, const pair<T, T2> &p) {
  return s << p.first << ' ' << p.second << ' ';
}
template <typename T, typename T2>
istream &operator>>(istream &s, pair<T, T2> &p) {
  return s >> p.first >> p.second;
}
template <typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
  for (auto it : v) s << it << ' ';
  return s;
}
template <typename T>
istream &operator>>(istream &s, vector<T> &v) {
  for (auto it = (v).begin(), it_ = (v).end(); it != it_; it++) s >> *it;
  return s;
}
template <typename T>
void read_range(T beg, T end) {
  while (beg != end) cin >> *beg++;
}
template <typename T>
void print_range(T beg, T end) {
  while (beg != end) cout << *beg++ << ' ';
}
struct reader {
  template <typename T>
  reader &operator,(T &v) {
    cin >> v;
    return *this;
  }
} rdr;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << ", ";
    return *this;
  }
} dbg;
int main() {
  ios_base::sync_with_stdio(false);
  long long t, n, m;
  rdr, t, n, m;
  ;
  bool power = (n != 1);
  long long temp = m;
  while (temp)
    if (temp % n) {
      power = false;
      break;
    } else if (temp == n)
      break;
    else if (n == 1)
      break;
    else
      temp /= n;
  if (t == 1 and n == 1 and m == 1)
    cout << "inf";
  else if (t == 1 and n == 1)
    cout << 0;
  else if (t == 1 and power and m != 1)
    cout << 1;
  else {
    int cnt = (n == m);
    long long sum = 0;
    long long p = 1;
    if (n >= t) {
      while (m) {
        sum += p * (m % n);
        m /= n;
        p *= t;
      }
      cnt += (sum == n);
    }
    cout << cnt;
  }
  return 0;
}
