#include <bits/stdc++.h>
using namespace std;
int main() {
  long int min = -211111;
  long int max = 211111;
  long int flag = 0;
  long int up = max;
  long int low = min;
  long int rating;
  long int temp = 0;
  long int n;
  long int* c;
  long int* div;
  long int flag1 = 0;
  cin >> n;
  c = new long int[n];
  div = new long int[n];
  long int c1 = 0;
  long int sum = 0;
  for (long int i = 0; i < n; i++) {
    cin >> c[i];
    cin >> div[i];
    if (i != 0) c1 = c1 + c[i - 1];
    sum = sum + c[i];
    if (div[i] == 1) {
      if (low < 1900 - c1 || flag1 == 0) {
        low = 1900 - c1;
        flag1 = 1;
      }
    } else {
      if (up > 1899 - c1 || flag == 0) {
        up = 1899 - c1;
        flag = 1;
      }
    }
  }
  if (up == max && flag == 0) {
    cout << "Infinity" << endl;
  } else if (low == min && up != max) {
    cout << up + sum << endl;
  } else if (low > up) {
    cout << "Impossible" << endl;
  } else {
    cout << up + sum << endl;
  }
  return 0;
}
