#include <bits/stdc++.h>
using namespace std;
long long INF = 200000000000;
int main() {
  long long lb = -INF, ub = INF;
  long long pos = 1900;
  long long sum = 0;
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long e, d;
    cin >> e >> d;
    if (d == 1) {
      lb = max(lb, pos);
    } else {
      ub = min(ub, pos);
    }
    pos -= e;
    sum += e;
  }
  if (ub == INF) {
    cout << "Infinity" << endl;
  } else if (ub - 1 >= lb) {
    long long ans = ub - 1 + sum;
    cout << ans << endl;
  } else {
    cout << "Impossible" << endl;
  }
}
