#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b;
  cin >> t >> a >> b;
  if (t > a || a > b) {
    cout << ((a == b) ? '1' : '0') << endl;
    return 0;
  }
  if (t == 1) {
    if (a == 1) {
      cout << ((b == 1) ? "inf" : "0") << endl;
      return 0;
    }
    long long x = 1;
    long long b1 = b;
    while (b1 > 1) {
      if (b1 % a != 0) {
        x = 0;
        break;
      }
      b1 /= a;
    }
    vector<long long> aary;
    while (b > 0) {
      aary.push_back(b % a);
      b /= a;
    }
    for (int i = 0; i < aary.size(); ++i) {
      a -= (long long)pow(t, i) * aary[i];
    }
    cout << ((a == 0) ? x + 1 : x) << endl;
    return 0;
  }
  if (t > 1) {
    long long x = 0;
    if (a == b) x = 1;
    vector<long long> aary;
    while (b > 0) {
      aary.push_back(b % a);
      b /= a;
    }
    vector<long long> t1;
    t1.push_back(1);
    for (int i = 1; i < aary.size(); ++i) t1.push_back(t1[i - 1] * t);
    for (int i = 0; i < aary.size(); ++i) {
      a -= t1[i] * aary[i];
    }
    cout << ((a == 0) ? x + 1 : x) << endl;
    return 0;
  }
}
