#include <bits/stdc++.h>
using namespace std;
long long base_a[70];
int N;
int main() {
  int i;
  long long a, b, t, mul, num;
  ios_base::sync_with_stdio(0);
  cin >> t >> a >> b;
  if (a == 1) {
    cout << (b ^ 1 ? "0" : t ^ 1 ? "1" : "inf") << '\n';
    return 0;
  }
  num = b;
  long long ct = 0;
  while (num) {
    base_a[N++] = num % a;
    num /= a;
    ct += base_a[N - 1];
  }
  num = base_a[0];
  mul = 1;
  for (i = 1; i < N; ++i) {
    if (num > a) break;
    if (mul > a / t) break;
    mul *= t;
    if (base_a[i] > a / mul) break;
    num += (mul * base_a[i]);
  }
  if (i < N) num = 0;
  cout << (num == a) + (t ^ 1 ? (a == b) : (b > 1 && ct == 1)) << "\n";
  return 0;
}
