#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c, d, curY = 0, min1 = 2000000000, max2 = -2000000000;
  bool inf = true;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c >> d;
    if (d == 2) {
      inf = false;
      max2 = (((max2) > (curY)) ? (max2) : (curY));
    } else {
      min1 = (((min1) < (curY)) ? (min1) : (curY));
    }
    curY += c;
  }
  if (inf)
    cout << "Infinity" << endl;
  else if (min1 <= max2)
    cout << "Impossible" << endl;
  else {
    int dif = 1899 - max2;
    curY += dif;
    cout << curY << endl;
  }
  return 0;
}
