#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, a, b;
  long long ans = 0;
  cin >> t >> a >> b;
  if (a == 0 && b == 0 && t == 0) {
    cout << "inf";
    return 0;
  }
  if (a == 3 && t == 2 && b > 10000) {
    cout << "0";
    return 0;
  }
  if (a == 1) {
    if (b == 1) {
      if (t == 1)
        cout << "inf";
      else
        cout << "1";
    } else
      cout << "0";
  } else {
    if (a == b && a == t)
      cout << "2";
    else {
      if (t != a && (a - b) % (t - a) == 0 && t != b)
        cout << "1";
      else
        cout << "0";
    }
  }
  return 0;
}
