#include <bits/stdc++.h>
using namespace std;
long long t, a, b;
int main() {
  cin >> t >> a >> b;
  if (t == 1) {
    if (a == 1) {
      if (b == 1) {
        cout << "inf" << endl;
        return 0;
      } else {
        cout << "0" << endl;
        return 0;
      }
    } else {
      long long tmp = a;
      while (tmp < b) tmp *= a;
      if (tmp == b) {
        cout << '1' << endl;
        return 0;
      }
    }
  }
  int ans = 0;
  if (a == b) ans++;
  long long x = 1;
  long long sum = 0;
  long long coef;
  if (a >= t)
    while (b) {
      coef = b % a, b /= a;
      sum += coef * x, x *= t;
    }
  if (sum == a) ans++;
  cout << ans << endl;
  return 0;
}
