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