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