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