#include <bits/stdc++.h>
using namespace std;
int main() {
  long long unsigned int t, a, b;
  cin >> t >> a >> b;
  if (a == 1) {
    int ans = 0;
    if (t == 1) {
      if (b == 1) {
        cout << "inf";
        return 0;
      } else {
        cout << 0;
      }
    } else {
      if (a == b) {
        cout << 1;
      } else {
        cout << 0;
      }
    }
  } else {
    long long unsigned int bt = b;
    vector<long long unsigned int> r;
    while (bt > 0) {
      r.push_back(bt % a);
      bt /= a;
    }
    reverse(r.begin(), r.end());
    long long unsigned int res = 0;
    for (auto x : r) {
      res *= t;
      res += x;
    }
    if (t > 1) {
      int ans = 0;
      if (res == a) {
        ans++;
      }
      if (a == b) ans++;
      cout << ans;
    } else {
      int ans = 0;
      if (res == a) ans++;
      if (b != 1) {
        while (b % a == 0) b /= a;
        if (b == 1) ans++;
      }
      cout << ans;
    }
  }
}
