#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, a, b;
  cin >> t >> a >> b;
  if (t == 1) {
    if (a == 1) {
      if (b == 1) {
        printf("inf\n");
        return 0;
      } else {
        printf("0\n");
        return 0;
      }
    } else {
      int digit[100];
      int len = 0;
      memset(digit, 0, sizeof digit);
      long long int sum = 0;
      int ans = 0;
      int ok = 1;
      if (a > b) ok = 0;
      while (b != 0) {
        digit[len++] = b % a;
        if (b % a != 0 && b != 1) ok = 0;
        sum += b % a;
        b = b / a;
      }
      if (ok) ans++;
      if (sum == a) {
        printf("%d\n", ++ans);
        return 0;
      } else {
        printf("%d\n", ans);
        return 0;
      }
    }
  } else {
    if (a == 1) {
      if (b != 1) {
        printf("0\n");
        return 0;
      } else {
        printf("1\n");
        return 0;
      }
    } else {
      int digita[100];
      int len1 = 0;
      int digitb[100];
      int len2 = 0;
      int ans = 0;
      if (a == b) ans = 1;
      while (b != 0) {
        digitb[len2++] = b % a;
        b = b / a;
      }
      while (a != 0) {
        digita[len1++] = a % t;
        a = a / t;
      }
      if (len1 != len2) {
        printf("%d\n", ans);
        return 0;
      } else {
        for (int i = 0; i < len1; i++)
          if (digita[i] != digitb[i]) {
            printf("%d\n", ans);
            return 0;
          }
        printf("%d\n", ++ans);
        return 0;
      }
    }
  }
  return 0;
}
