#include <bits/stdc++.h>
using namespace std;
int main() {
  int r[242424];
  int d[242424];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> r[i] >> d[i];
  int s = -1000000007;
  int rating = -1000000007;
  int t = 0;
  int mx = -1000000007;
  int mxi = -1000000007;
  int mn = 1000000007;
  int mni = -1000000007;
  int rr[242244];
  rr[0] = 0;
  for (int i = 0; i < n; i++) {
    t += r[i];
    if (t > mx) {
      mx = t;
      mxi = i + 1;
    }
    if (t < mn) {
      mn = t;
      mni = i + 1;
    }
    rr[i + 1] = t;
  }
  if (count(d, d + n, 1) == n) {
    cout << "Infinity\n";
  } else {
    int d2m = -1000000007;
    for (int i = 0; i < n; i++)
      if (d2m < rr[i] && d[i] == 2) d2m = rr[i];
    for (int i = 0; i <= n; i++) rr[i] = rr[i] + 1899 - d2m;
    for (int i = 0; i < n; i++) {
      if (rr[i] >= 1900 && d[i] == 1)
        continue;
      else if (rr[i] < 1900 && d[i] == 2)
        continue;
      else {
        cout << "Impossible\n";
        return 0;
      }
    }
    cout << rr[n] << endl;
  }
  return 0;
}
