#include <bits/stdc++.h>
using namespace std;
long long mul(long long a, long long b) {
  if (a == 0 || b == 0) return 0;
  if (a > (1ll << 60) / b)
    return (1ll << 60);
  else
    return a * b;
}
long long add(long long a, long long b) { return min((1ll << 60), a + b); }
void solve(long long t, long long a, long long b) {
  if (t > a) {
    printf("%d", (a == b));
    return;
  }
  vector<long long> coef;
  long long _b = b;
  while (b) {
    coef.push_back(b % a);
    b /= a;
  }
  long long p = 1, sum = 0;
  for (int i = 0; i < coef.size(); ++i) {
    sum = add(sum, mul(p, coef[i]));
    p = mul(p, t);
  }
  int ans = (sum == a) + (coef.size() > 1 && a == _b);
  printf("%d", ans);
}
int main() {
  long long t, a, b;
  cin >> t >> a >> b;
  if (t > 1) {
    solve(t, a, b);
  } else {
    if (a == 1) {
      if (b == 1)
        printf("inf");
      else
        printf("0");
    } else {
      if (a == b)
        printf("1");
      else {
        long long _t = a;
        bool ck = 0;
        while (true) {
          _t = mul(_t, a);
          if (_t == b) ck = 1, printf("1");
          if (_t >= b) break;
        }
        if (!ck) solve(t, a, b);
      }
    }
  }
}
