#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int c[maxn + 10], d[maxn + 10];
  int minrat[maxn + 10], maksrat[maxn + 10];
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> d[i];
    if (d[i] == 1)
      d[i] = 2;
    else
      d[i] = 1;
  }
  for (int i = 0; i < n - 1; i++) {
    minrat[i] = INT_MIN;
    maksrat[i] = INT_MAX;
    if (d[i + 1] == 1) {
      maksrat[i] = 1899 - c[i];
    } else {
      minrat[i] = 1900 - c[i];
    }
  }
  int mins = INT_MIN, maks = INT_MAX;
  for (int i = 0; i < n; i++) {
    if (i < n - 1) {
      mins = max(mins, minrat[i]);
      maks = min(maks, maksrat[i]);
    }
    if (d[i] == 1) {
      maks = min(1899, maks);
    } else {
      mins = max(1900, mins);
    }
    if (mins != INT_MIN) {
      mins += c[i];
    }
    if (maks != INT_MAX) {
      maks += c[i];
    }
  }
  if (maks < mins) {
    cout << "Impossible\n";
  } else if (maks == INT_MAX) {
    cout << "Infinity\n";
  } else {
    cout << maks << endl;
  }
}
