#include <bits/stdc++.h>
using namespace std;
long long a, b, c;
int ans;
int main() {
  scanf("%lld%lld%lld", &a, &b, &c);
  if (a > b || b > c) return puts(b == c ? "1" : "0"), 0;
  if (b == 1) {
    if (c == 1)
      return puts("inf"), 0;
    else
      return puts("0"), 0;
  } else {
    for (long long t = b; t <= c; t *= b) {
      if (t == c) ans++;
      if (t > c / b) break;
    }
    long long sum = 0, w = 1;
    while (c) sum += w * (c % b), w *= a, c /= b;
    ans += sum == b;
    printf("%d\n", ans);
  }
}
