#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long a, b, c;
  while (~scanf("%lld %lld %lld", &a, &b, &c)) {
    if (b == 1) {
      if (a == 1 && c == 1)
        printf("inf\n");
      else if (c == 1)
        printf("1\n");
      else
        printf("0\n");
      continue;
    }
    if (b == c) {
      if (a == b)
        printf("2\n");
      else
        printf("1\n");
    } else if (b < c) {
      if (a > b) {
        printf("0\n");
        continue;
      }
      long long ans = 0, ap = 1, cc = c;
      bool flag = true;
      while (c) {
        ans += c % b * ap;
        if (c % b && c != 1) flag = false;
        c /= b;
        ap *= a;
      }
      if (ans == b)
        printf("1\n");
      else if (c / b == b / a)
        printf("1\n");
      else {
        if (flag && a == 1)
          printf("1\n");
        else
          printf("0\n");
      }
    } else
      printf("0\n");
  }
  return 0;
}
