#include <bits/stdc++.h>
using namespace std;
long long t, a, b, B[105], sum;
int main() {
  int i, n = 0, ans = 0;
  cin >> t >> a >> b;
  if (t > 1) {
    if (b == a) ans = 1;
    if (a != 1) {
      while (b) B[n++] = b % a, b /= a;
      for (i = n - 1; i >= 0; i--) sum = sum * t + B[i];
    }
    if (sum == a)
      printf("%d", ans + 1);
    else
      printf("%d", ans);
  } else {
    if (b == 1) {
      printf(a == 1 ? "inf" : "0");
      return 0;
    } else {
      if (a != 1) {
        while (b) {
          B[n++] = b % a, b /= a;
          sum += B[n - 1];
        }
        if (sum < a) sum += a - 1;
      }
      printf("%d", sum == a);
    }
  }
  return 0;
}
