#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long t, a, b, h;
long long f[60];
long long pow(long long x, int y) {
  long long t = 1;
  for (int i = 1; i <= y; i++) t *= x;
  return t;
}
void solve(long long t, long long a) {
  for (int i = h; i; i--) {
    long long base = pow(t, i);
    f[i] = a / base;
    a %= base;
  }
  f[0] = a;
}
int main() {
  t = read();
  a = read();
  b = read();
  if (a == b && b == t) {
    if (a == 1)
      puts("inf");
    else
      puts("2");
  } else if (a == b)
    puts("1");
  else {
    if (t == 1) {
      h = log(b) / log(a);
      for (int i = 1; i <= h; i++)
        if (pow(a, i) == b) {
          puts("1");
          return 0;
        }
    }
    h = log(b) / log(a);
    solve(a, b);
    long long sum = 0;
    for (int i = 0; i <= h; i++) sum += f[i] * pow(t, i);
    if (sum != a)
      puts("0");
    else
      puts("1");
  }
  return 0;
}
