#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b;
  while (~scanf("%I64d%I64d%I64d", &t, &a, &b)) {
    if (t == a) {
      if (a == b)
        printf("%s\n", a == 1 ? "inf" : "2");
      else
        printf("0\n");
    } else if (a == b)
      printf("1\n");
    else if (a < t || b < a)
      printf("0\n");
    else {
      long long p = 1, c = 0;
      while (b) c += (b % a) * p, b /= a, p *= t;
      if (t == 1)
        printf("%d\n", (c == a || c == 1) ? 1 : 0);
      else
        printf("%d\n", c == a ? 1 : 0);
    }
  }
  return 0;
}
