#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c, d, delta = 0;
  int lb = -INT_MAX, ub = INT_MAX;
  cin >> n;
  while (n--) {
    cin >> c >> d;
    if (d == 1)
      lb = max(lb, 1900 - delta);
    else
      ub = min(ub, 1899 - delta);
    delta += c;
    if (lb > ub) {
      cout << "Impossible" << endl;
      return 0;
    }
  }
  if (ub == INT_MAX)
    cout << "Infinity" << endl;
  else
    cout << ub + delta << endl;
  return 0;
}
