#include <bits/stdc++.h>
using namespace std;
long long t, a, b;
int main() {
  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" << endl;
      else
        cout << 2;
    else
      cout << 0;
  else if ((a - b) % (t - a) == 0)
    if (t != b)
      cout << 1;
    else
      cout << 0;
  else
    cout << 0 << endl;
  return 0;
}
