#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
long long num[maxn];
int main() {
  long long t, a, b;
  scanf("%lld%lld%lld", &t, &a, &b);
  if (t == a && a == b && b == 1)
    printf("inf\n");
  else if (t == a && a == b)
    printf("2\n");
  else if (a == b)
    printf("1\n");
  else {
    if (t == 1) {
      if (a > b) {
        printf("0\n");
        return 0;
      }
      long long x = 1;
      while (x < b) {
        if (a == 1) break;
        x *= a;
      }
      if (x == b) {
        printf("1\n");
        return 0;
      }
    }
    if (a == 1) {
      printf("0\n");
      return 0;
    }
    long long p = 0, sum = 0, t1 = 1;
    while (b) {
      num[p++] = b % a;
      b /= a;
    }
    for (int i = 0; i < p; i++) {
      sum += num[i] * t1;
      t1 *= t;
    }
    if (sum == a)
      printf("1\n");
    else
      printf("0\n");
  }
}
