#include <bits/stdc++.h>
using namespace std;
long long T, A, B, res;
vector<long long> P;
int main() {
  cin >> T >> A >> B;
  if (T == 1) {
    if (A == 1) {
      if (B == 1) {
        res = -1;
      }
    } else {
      if (B % A == 0) {
        ++res;
      }
      while (B > 0) {
        P.push_back(B % A);
        B /= A;
      }
      long long cp = 1;
      for (int i = 0; i < ((int)P.size()); i++) {
        A -= P[i] * cp;
        cp *= T;
      }
      if (A == 0) {
        ++res;
      }
    }
  } else {
    if (A < T) {
      if (B == A) {
        res = 1;
      }
    } else if (A == T) {
      if (B == A) {
        res = 2;
      }
    } else {
      if (A == B) {
        ++res;
      }
      while (B > 0) {
        P.push_back(B % A);
        B /= A;
      }
      long long cp = 1;
      for (int i = 0; i < ((int)P.size()); i++) {
        A -= P[i] * cp;
        cp *= T;
      }
      if (A == 0) {
        ++res;
      }
    }
  }
  if (res == -1) {
    cout << "inf\n";
  } else {
    cout << res << '\n';
  }
  return 0;
}
