#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmax(T& x, T y) {
  if (x < y) x = y;
}
template <typename T>
void chkmin(T& x, T y) {
  if (x > y) x = y;
}
inline int read() {
  int x = 0;
  char c = getchar();
  bool f = 0;
  while (c < 48) f |= c == '-', c = getchar();
  while (c > 47) x = x * 10 + (c ^ 48), c = getchar();
  return f ? -x : x;
}
int N, p[114];
long long getv(long long x) {
  long long res = 0;
  for (int i = (N - 1), iend = (0); i >= iend; --i) {
    if ((long double)res * x + p[i] > 1e18) return -1;
    res = res * x + p[i];
  }
  return res;
}
void solve() {
  long long t, a, b;
  cin >> t >> a >> b;
  int res = a == b ? 1 : 0, tt = -1, ct = 0;
  if (t > a || a > b || (t == a && a == 1 && b > 1))
    return printf("%d\n", res), void();
  if (b == 1) return puts("inf"), void();
  if (a != 1) {
    for (long long tp = b; tp; tp /= a) p[N++] = tp % a, ct += tp % a != 0;
    res += getv(t) == a && getv(a) == b;
    if (ct == 1) tt = N - 1;
  }
  long long zzh = 1, yyh = 1;
  for (int i = (1), iend = (60); i <= iend; ++i) {
    if ((long double)yyh * a > 1e18) break;
    zzh *= t, yyh *= a;
    if (i != tt && a % zzh == 0 && b % yyh == 0 && a / zzh == b / yyh) res++;
  }
  cout << res << endl;
}
signed main() {
  solve();
  return 0;
}
