#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, ans;
  cin >> a >> b >> c;
  if (b > c || (a > b && b != c))
    cout << "0";
  else if (a == 1 && b == 1 && c == 1)
    cout << "inf";
  else if (a == b && b == c)
    cout << "2";
  else if (b == c)
    cout << "1";
  else {
    if (a == 1) {
      long long zz = c;
      if (b == 1) {
        cout << "0";
        return 0;
      }
      while (zz % b == 0) zz /= b;
      if (zz == 1) {
        cout << "1";
        return 0;
      }
    }
    long long d = 0, e = 1;
    while (c) {
      d += c % b * e;
      e *= a;
      c /= b;
    }
    if (d == b)
      cout << "1";
    else
      cout << "0";
  }
}
