#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const long long INF_LL = 1000000000000000000LL;
const double pi = 2 * acos(0.0);
template <class T>
void smin(T& a, T b) {
  if (a > b) a = b;
}
template <class T>
void smax(T& a, T b) {
  if (a < b) a = b;
}
template <class T>
T gcd(T a, T b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <class T>
T sqr(T a) {
  return a * a;
}
template <typename Iterator>
void print(const char* fmt, Iterator begin, Iterator end,
           const char* separator = " ") {
  for (Iterator it = begin; it != end; ++it) {
    if (it != begin) printf(separator);
    printf(fmt, *it);
  }
  printf("\n");
}
long long t, a, b;
int main() {
  scanf("%I64d%I64d%I64d", &t, &a, &b);
  int ans = 0;
  if (a == b) ++ans;
  if (t > a || a > b) {
    printf("%d\n", ans);
    return 0;
  }
  if (a > 1) {
    vector<int> c;
    while (b) c.push_back(b % a), b /= a;
    for (int i(int((c).size()) - 1), _b(0); i >= _b; --i) {
      b *= t;
      b += c[i];
    }
    if (b == a) ++ans;
    if (t == 1 && b == 1 && int((c).size()) > 2) ++ans;
  } else {
    if (b == 1) ans = -1;
  }
  if (ans == -1)
    printf("inf\n");
  else
    printf("%d\n", ans);
  return 0;
}
