#include <bits/stdc++.h>
using namespace std;
long long sum, a, b, n, dq, dqsum, ans, flag;
long long c[100];
int main() {
  scanf("%I64d%I64d%I64d", &n, &a, &b);
  if (n == 1) {
    if (a == 1 && b == 1) {
      printf("inf\n");
      return 0;
    }
    if (a == 1 && b != 1) {
      printf("0\n");
      return 0;
    }
    flag = 1;
    while (b > 0) {
      if (b == a) break;
      if (b % a != 0) flag = 0;
      b /= a;
    }
    if (flag == 1) {
      printf("1\n");
      return 0;
    }
  }
  if (a == b)
    ans = 1;
  else
    ans = 0;
  if (a == 1) {
    printf("%I64d\n", ans);
    return 0;
  }
  sum = 0;
  while (b > 0) {
    c[sum++] = b % a;
    b /= a;
  }
  dq = 1, dqsum = 0;
  for (int i = 0; i < sum; ++i) {
    dqsum += dq * c[i];
    dq *= n;
  }
  if (dqsum == a) ans++;
  printf("%I64d\n", ans);
  return 0;
}
