#include <bits/stdc++.h>
using namespace std;
long long G(long long a, long long b) {
  if (b == 0) return a;
  return G(b, a % b);
}
long long co[1000];
int main() {
  ios_base::sync_with_stdio(false);
  long long t, a, b;
  cin >> t >> a >> b;
  long long cur = 0, res = 0;
  if (t != 1) {
    if (a != 1) {
      long long bb = b;
      while (bb) {
        co[cur++] = bb % a;
        bb /= a;
      }
      long long tmp = 0, powT = 1;
      for (int i = 0; i < cur; i++) {
        tmp += co[i] * powT;
        powT *= t;
      }
      if (tmp == a) res++;
    }
    if (a == b) res++;
    cout << res;
    return 0;
  }
  if (a == 1 && b == 1) {
    cout << "inf";
    return 0;
  }
  if (a == 1) {
    cout << 0;
    return 0;
  }
  long long bb = b;
  if (bb == 1) res--;
  while (bb % a == 0) bb /= a;
  if (bb == 1) res++;
  while (b) {
    co[cur++] = b % a;
    b /= a;
  }
  long long tmp = 0, powT = 1;
  for (int i = 0; i < cur; i++) {
    tmp += co[i] * powT;
    powT *= t;
  }
  if (tmp == a) res++;
  cout << res;
}
