#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int MOD = 1e9 + 7;
const int oo = 1e9;
const double EPS = 1e-7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<pair<int, int> > pp;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    pp.push_back({a, b});
  }
  int net_change = 0;
  int upper = oo, lower = -oo;
  for (int j = n - 1; j >= 0; j--) {
    net_change -= pp[j].first;
    if (pp[j].second == 2) {
      upper = min(upper, 1899 - net_change);
    } else {
      lower = max(lower, 1900 - net_change);
    }
  }
  if (upper == oo)
    cout << "Infinity" << endl;
  else if (upper < lower)
    cout << "Impossible" << endl;
  else
    cout << upper << endl;
}
