#include <bits/stdc++.h>
using namespace std;
long long t, a, b, bb;
long long p[1001], tp = 0;
int ans = 0;
int main() {
  int i, j, k;
  scanf("%I64d%I64d%I64d", &t, &a, &b);
  bb = b;
  if (t == 1 && a == 1) {
    if (b == 1)
      printf("inf\n");
    else
      printf("0\n");
    return 0;
  }
  if (t == 1) {
    if (b == 1) {
      printf("0\n");
      return 0;
    }
    while (b % a == 0) b /= a;
    if (b == 1) {
      printf("1\n");
      return 0;
    }
  }
  if (a > 1) {
    while (b > 0) {
      p[++tp] = b % a;
      b /= a;
    }
    long long s = 0;
    for (i = tp; i >= 1; i--) {
      s *= t;
      s += p[i];
    }
    if (s == a) ans++;
  }
  if (a == bb) ans++;
  printf("%d\n", ans);
  return 0;
}
