#include <bits/stdc++.h>
using namespace std;
long long ara[200005][2];
int n;
bool yes = false;
long long bs() {
  long long low = -200500 * 100;
  long long high = 200500 * 100;
  long long mid, ret = -1;
  while (low < high) {
    mid = (high + low) / 2;
    long long st = mid;
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if (ara[i][1] == 2) {
        if (st >= 1900) {
          high = mid - 1;
          ok = false;
          break;
        } else
          st += ara[i][0];
      } else if (ara[i][1] == 1) {
        if (st < 1900) {
          low = mid + 1;
          ok = false;
          break;
        } else
          st += ara[i][0];
      }
    }
    if (ok) {
      ret = st;
      low = mid + 1;
      yes = true;
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  int ct = 0;
  for (int i = 0; i < n; i++) {
    cin >> ara[i][0] >> ara[i][1];
    if (ara[i][1] == 1) ct++;
  }
  if (ct == n)
    cout << "Infinity";
  else {
    long long temp = 0;
    long long div2 = -1LL << 62;
    int pos;
    for (int i = 0; i < n; i++) {
      if (ara[i][1] == 2) {
        if (temp > div2) {
          div2 = temp;
          pos = i;
        }
      }
      temp += ara[i][0];
    }
    int present = 1899;
    for (int i = pos - 1; i >= 0; i--) {
      present -= ara[i][0];
    }
    for (int i = 0; i < n; i++) {
      if (ara[i][1] == 1 && present < 1900) {
        cout << "Impossible";
        return 0;
      } else if (ara[i][1] == 2 && present >= 1900) {
        cout << "Impossible";
        return 0;
      } else
        present += ara[i][0];
    }
    cout << present;
  }
  return 0;
}
