#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  ;
  int precision = numeric_limits<double>::digits10;
  ;
  int n;
  cin >> n;
  vector<int> l, g;
  int r = 0;
  vector<int> c(n), d(n);
  for (int i = 0; i < n; i++) cin >> c[i] >> d[i];
  for (int i = 0; i < n; i++) {
    if (d[i] == 2) {
      l.push_back(1899 - r);
    } else if (d[i] == 1) {
      g.push_back(1900 - r);
    }
    r += c[i];
  }
  int gr, le;
  if (l.size() != 0) {
    sort(l.begin(), l.end());
    le = l[0];
  } else {
    le = INT_MAX;
  }
  if (g.size() != 0) {
    sort(g.rbegin(), g.rend());
    gr = g[0];
  } else {
    gr = INT_MIN;
  }
  if (gr <= le) {
    if (le == INT_MAX)
      cout << "Infinity" << endl;
    else {
      cout << le + r << endl;
    }
  } else
    cout << "Impossible" << endl;
}
