#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void R(T &xx) {
  xx = 0;
  char ch = getchar();
  bool F = 0;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') F = 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    xx = xx + xx + (xx << 3) + ch - 48, ch = getchar();
  if (F) xx = -xx;
}
template <class T>
inline void add(int &x, T y) {
  for (x += y; x >= 2147483647; x -= 2147483647)
    ;
}
long long t, a, b;
int main() {
  R(t);
  R(a);
  R(b);
  if (t == 1 && a == 1 && b == 1) return puts("inf"), 0;
  if (t == 1 && a == 1) return puts("0"), 0;
  if (t == 1) {
    long long m = a;
    while (m < b) m *= a;
    if (m == b) return puts("1"), 0;
  }
  long long q = 0, x = 1;
  int ans = (a == b);
  if (t <= a)
    for (; b; b /= a) {
      q += b % a * x;
      x *= t;
    }
  if (q == a) ans++;
  printf("%d\n", ans);
  return 0;
}
