#include <bits/stdc++.h>
using namespace std;
long long inf = 1ll << 60;
long long t, a, b;
int check(long long t, long long a, long long b) {
  if (a == 1) return 0;
  vector<int> dv;
  long long cur = b;
  long long x = 1;
  long long sum = 0;
  bool big = false;
  while (cur != 0) {
    long long d = cur % a;
    dv.push_back(d);
    cur /= a;
    if (big && d != 0) {
      return 0;
    }
    if (d != 0 && (inf + d - 1) / d <= x) {
      return 0;
    }
    if (inf - x * d <= sum) {
      return 0;
    }
    sum += x * d;
    if ((inf + a - 1) / a <= x)
      big = true;
    else
      big = false;
    x = x * a;
  }
  if (sum != b) return 0;
  sum = 0;
  cur = a;
  sum = 0;
  x = 1;
  big = false;
  for (int i = 0; i < (int)dv.size(); i++) {
    long long d = dv[i];
    if (big && d != 0) return 0;
    if (d != 0 && (inf + d - 1) / d <= x) return 0;
    if (inf - x * d <= sum) return 0;
    sum += x * d;
    big = false;
    if ((inf + t - 1) / t <= x) big = true;
    x = x * t;
  }
  if (sum != a) return 0;
  return 1;
}
int main() {
  cin >> t >> a >> b;
  if (t == 1) {
    if (a == 1 && b == 1)
      puts("inf");
    else if (a == 1 && b != 1)
      puts("0");
    else {
      int x = 0;
      while (b % a == 0) {
        x++;
        b /= a;
      }
      if (b != 1 || x <= 0) {
        x = -1;
      }
      if (x != -1)
        puts("1");
      else
        cout << check(t, a, b) << endl;
    }
  } else {
    int ans = check(t, a, b);
    if (a == b) ans++;
    cout << ans << endl;
  }
  return 0;
}
