#include <bits/stdc++.h>
using namespace std;
long long t, a, b;
vector<long long> cof;
int main() {
  cin >> t >> a >> b;
  if (t == 1 && a == 1 && b == 1) return 0 * printf("inf\n");
  if (t != 1 && a == 1 && b == 1) return 0 * printf("1\n");
  if (a == 1 && b > 1) return 0 * printf("0\n");
  int ans = 0;
  long long b_ = b;
  while (b_) {
    cof.push_back(b_ % a);
    b_ /= a;
  }
  long long tmp = 1, sum = 0;
  for (int i = 0; i < cof.size(); i++) {
    sum += tmp * cof[i];
    tmp *= t;
  }
  if (sum == a) ans++;
  if (a == b) ans++;
  tmp = a;
  while (t == 1 && a <= b) {
    if (2e18 / tmp < a) break;
    a *= tmp;
    if (a == b) {
      ans++;
      break;
    }
  }
  printf("%d\n", ans);
}
