#include <bits/stdc++.h>
using namespace std;
int const N = 2e5 + 10, M = N * 100, mod = 1e9 + 7;
unsigned long long t, a, b;
unsigned long long solve(unsigned long long a, unsigned long long b,
                         unsigned long long c, unsigned long long d) {
  if (b == 0 && d == 0) return 1;
  if (b == 0 || d == 0) return 0;
  unsigned long long ret = 0;
  for (int i = 0; i < 2; i++) {
    unsigned long long a0 = d % c + i * c;
    if (a0 <= b && !((b - a0) % a))
      ret = (ret + solve(a, (b - a0) / a, c, (d - a0) / c)) % mod;
  }
  return ret;
}
int main() {
  cin >> t >> a >> b;
  if (t == a && a == 1) {
    if (b == 1)
      cout << "inf" << endl;
    else
      cout << 0 << endl;
  } else
    cout << solve(t, a, a, b) << endl;
  return 0;
}
