#include <bits/stdc++.h>
using namespace std;
int n, c[200005], d[200005];
int main() {
  iostream::sync_with_stdio(0);
  cin >> n;
  bool any2 = 0;
  int tmp = 0;
  int di1 = (1 << 30), di2 = -(1 << 30);
  for (int i = 1; i <= n; i++) {
    cin >> c[i] >> d[i];
    if (d[i] == 1)
      di1 = min(di1, tmp);
    else
      di2 = max(di2, tmp);
    tmp += c[i];
  }
  if (di1 <= di2) return cout << "Impossible", 0;
  if (di2 == -(1 << 30)) return cout << "Infinity", 0;
  cout << 1899 + tmp - di2;
}
