#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int divi[n];
  int ch[n];
  int low = -1000000000;
  int high = 1000000000;
  int mark = 0;
  for (int i = 0; i < n; i++) {
    cin >> ch[i];
    cin >> divi[i];
    {
      if (divi[i] == 1 && high < 1900) {
        cout << "Impossible";
        return 0;
      }
      if (divi[i] == 2 && low >= 1900) {
        cout << "Impossible";
        return 0;
      }
      if (divi[i] == 2 && high > 1899) {
        high = 1899;
        mark = 1;
      }
      if (divi[i] == 1 && low < 1900) low = 1900;
      low += ch[i];
      high += ch[i];
    }
  }
  if (mark)
    cout << high;
  else
    cout << "Infinity";
  return 0;
}
