#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b;
  cin >> t >> a >> b;
  if (t == a) {
    if (a == b) {
      if (t == 1) {
        cout << "inf" << endl;
      } else {
        cout << "2" << endl;
      }
    } else {
      cout << "0" << endl;
    }
  } else if (t < a) {
    if (a > b) {
      cout << "0" << endl;
    } else if (a == b) {
      cout << "1" << endl;
    } else {
      long long ret = 0;
      long long pow = 1;
      while (b) {
        long long mod = b % a;
        ret += mod * pow;
        b /= a;
        pow *= t;
      }
      if (ret == a || t == 1 && ret == 1)
        cout << "1" << endl;
      else
        cout << "0" << endl;
    }
  } else {
    if (a == b)
      cout << "1" << endl;
    else
      cout << "0" << endl;
  }
  return 0;
}
