#include <bits/stdc++.h>
using namespace std;
inline 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;
}
inline void write(long long a) {
  if (a < 0) {
    printf("-");
    a = -a;
  }
  if (a >= 10) write(a / 10);
  putchar(a % 10 + '0');
}
inline void writeln(long long a) {
  write(a);
  printf("\n");
}
long long bin[110];
int main() {
  long long t = read(), a = read(), b = read();
  if (t == a && a == b) {
    if (t == 1ll) printf("inf\n");
    if (t != 1ll) printf("2\n");
    return 0;
  }
  if (t > a) {
    if (a != b)
      puts("0");
    else
      puts("1");
    return 0;
  }
  if (a == b) {
    puts("1");
    return 0;
  }
  int len = 0, cnt = 0;
  if (t == 1 && a == 1 && b != 1) {
    puts("0");
    return 0;
  }
  while (b) {
    bin[++len] = b % a;
    cnt += bin[len];
    b /= a;
  }
  long long ans = 0;
  for (int i = len; i >= 1; i--) {
    ans = ans * t + bin[i];
  }
  if (cnt == 1) {
    if (ans != a) {
      ans = 0;
      len--;
      bin[len] = a;
      for (int i = len; i >= 1; i--) ans = ans * t + bin[i];
    }
  }
  printf("%d\n", ans == a);
}
