#include <bits/stdc++.h>
using namespace std;
long long c[1111];
int main(void) {
  long long t, a, b, ans = 0, cnt = 0, tmp;
  scanf("%I64d %I64d %I64d", &t, &a, &b);
  if (t == 1 && a == 1 && b == 1) return puts("inf");
  if (t == 1 && a == 1) return puts("0");
  if (a == 1 && b == 1) return puts("1");
  if (a == 1) return puts("0");
  for (tmp = a; tmp <= b; tmp *= a) {
    if (tmp == b) ans++;
    if (log(tmp) + log(a) > log(b) + 1e-9) break;
  }
  while (b) c[++cnt] = b % a, b /= a;
  tmp = 0;
  for (int i = cnt; i; i--) tmp = tmp * t + c[i];
  if (tmp == a && cnt > 1) ans++;
  printf("%d\n", ans);
  return 0;
}
