#include <bits/stdc++.h>
using namespace std;
long long t, a, b;
long long MOD = 1000000007LL;
pair<long long, long long> bez(long long a, long long b) {
  if (b == 0) return make_pair(1, 0);
  if (a == 0) return make_pair(0, 1);
  if (a < b) {
    pair<long long, long long> mp = bez(a, b % a);
    return make_pair(mp.first - mp.second * (b / a), mp.second);
  } else {
    pair<long long, long long> mp = bez(a % b, b);
    return make_pair(mp.first, mp.second - mp.first * (a / b));
  }
}
long long com(long long x1, long long r1, long long x2, long long r2) {
  pair<long long, long long> b = bez(x1, x2);
  long long i1 = b.first * x1;
  long long i2 = b.second * x2;
  long long p = r2 * i1 + r1 * i2;
  if (p < 0) p += x1 * x2;
  if (p % x1 != r1 || p % x2 != r2) return -1;
  return p;
}
int go(long long x1, long long y1, long long x2, long long y2) {
  if ((y2 - y1) % (x2 - x1) != 0) return 0;
  if (y1 > y2) return 0;
  if (y1 < 0 || y2 < 0) return 0;
  if (y1 == y2) return 1;
  long long r1 = y1 % x1, r2 = y2 % x2;
  y2 -= r2, y1 -= r2;
  while (y1 >= 0 && y1 % x1 != 0) {
    y1 -= x2;
    y2 -= x2;
  }
  if (y1 < 0) return 0;
  return go(x1, y1 / x1, x2, y2 / x2);
}
int solve() {
  if (t == a && a == b) {
    if (t == 1) return -1;
    return 2;
  }
  if (a == b) {
    return 1;
  }
  if (t == a) return 0;
  if (t > a || a > b) return 0;
  if ((b - a) % (a - t) != 0) return 0;
  return go(t, a, a, b);
}
int main() {
  scanf("%lld %lld %lld", &t, &a, &b);
  int s = solve();
  if (s == -1) {
    printf("inf\n");
  } else {
    printf("%d\n", s);
  }
}
