#include <bits/stdc++.h>
using namespace std;
long long i, j, t, n, m, l, r, k, z, y, x;
long long a, b, ans;
int main() {
  scanf("%I64d%I64d%I64d", &t, &a, &b);
  if (t == 1) {
    if (a == 1) {
      if (a == b)
        printf("inf\n");
      else
        printf("0\n");
      return 0;
    } else if (b >= a) {
      while (b % a == 0) b /= a;
      if (b == 1) {
        printf("1\n");
        return 0;
      }
    }
  }
  ans = (a == b) ? 1 : 0;
  x = z = 0;
  y = 1;
  if (t <= a) {
    while (b) {
      x = b % a;
      b /= a;
      z += y * x;
      y *= t;
    }
  }
  if (z == a) ans++;
  printf("%I64d\n", ans);
  return 0;
}
