#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 62;
vector<long long> C;
int main() {
  long long t, a, b;
  cin >> t >> a >> b;
  if (t == 1) {
    if (a == 1 && b == 1) return puts("inf");
    if (a == 1) return puts("0");
    long long p = b;
    int c = 0;
    while (p % a == 0) p /= a, ++c;
    if (p == 1 && c) return puts("1");
  }
  int ans = 0;
  if (a == b) ++ans;
  if (a != 1) {
    while (b) C.push_back(b % a), b /= a;
    long long p = 1, v = 0;
    for (int i = 0; i < (int)C.size(); ++i) {
      v += C[i] * p;
      p *= t;
      if (v > a || v < 0) break;
    }
    if (v == a) ++ans;
  }
  printf("%d\n", ans);
  return 0;
}
