#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b;
  long long res = 0;
  cin >> t >> a >> b;
  if (t == a) {
    if (a == b) {
      if (b == 1)
        res = (int)1e9 + 7;
      else
        res = 2;
    } else
      res = 0;
  } else {
    if (a == b)
      res = 1;
    else if (t > a && a < b)
      res = 0;
    else if (t < a && a > b)
      res = 0;
    else {
      res = 0;
      if ((b - a) % (a - t) == 0) {
        if (t == 1) {
          long long sum = 0;
          if (b % a == 0)
            res++;
          else {
            while (b) {
              sum += b % a;
              b /= a;
            }
            if (a == sum) res++;
          }
        } else {
          vector<long long> rea, reb;
          while (b) {
            reb.push_back(b % a);
            b /= a;
          }
          while (a) {
            rea.push_back(a % t);
            a /= t;
          }
          if (rea == reb) res++;
        }
      }
    }
  }
  if (res >= (int)1e9)
    cout << "inf" << endl;
  else
    cout << res << endl;
  return 0;
}
