#include <bits/stdc++.h>
using namespace std;
const string problemName = "";
const string inputFile = problemName + ".in";
const string outputFile = problemName + ".out";
const int INF = (1LL << 31) - 1;
const long long int LINF = (1LL << 62) - 1;
const int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
const int MOD = (int)(1e9) + 7;
const int NMAX = 100000 + 5;
const int MMAX = 100000 + 5;
const int KMAX = 100000 + 5;
const int PMAX = 100000 + 5;
const int LMAX = 100000 + 5;
const int VMAX = 100000 + 5;
long long int t, a, b, n, i, tt, q, sol = 0;
long long int A[NMAX];
int putere(long long int b, long long int a) {
  if (a == 1 && b != 1) return 0;
  if (a != 1 && b == 1) return 0;
  while (b != 1 && b % a == 0) b /= a;
  return b == 1;
}
int main() {
  scanf("%lld%lld%lld", &t, &a, &b);
  if (t != 1 || (t == 1 && !putere(b, a))) {
    if (a == b) sol++;
    for (n = 0; b && a > 1; n++) {
      A[n] = b % a;
      b /= a;
    }
    for (i = q = 0, tt = 1; i < n; i++) {
      q += A[i] * tt;
      tt *= t;
      if (q < 0 || q > a) break;
    }
    if (q == a) sol++;
    printf("%lld", sol);
  } else {
    if (a == 1 && b == 1)
      printf("inf");
    else
      printf("%d", putere(b, a));
  }
  return 0;
}
