#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e9;
long long powm(long long a, long long p, long long m) {
  long long r = 1 % m;
  while (p) {
    if (p & 1) r = r * a % m;
    p >>= 1;
    a = a * a % m;
  }
  return r;
}
int main() {
  long long t, a, b;
  cin >> t >> a >> b;
  if (t == 1) {
    if (a == 1 && b == 1)
      puts("inf");
    else if (a == 1)
      puts("0");
    else {
      long long tb = b;
      while (tb % a == 0) tb /= a;
      if (tb == 1 && b >= a)
        puts("1");
      else {
        long long ta = a, tb = b;
        while (tb) {
          ta -= tb % a;
          tb /= a;
        }
        if (ta == 0)
          puts("1");
        else
          puts("0");
      }
    }
  } else {
    long long ta = a, tb = b;
    while (ta && tb) {
      if (ta % t != tb % a) {
        cout << (a == b) << endl;
        return 0;
      }
      ta /= t;
      tb /= a;
    }
    cout << (ta == tb) + (a == b) << endl;
  }
  return 0;
}
