#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int main() {
  int n, c, d, i, j, c_sum = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &c);
    scanf("%d", &d);
    if (d == 1) {
      v.push_back(make_pair(1900 - c_sum, 1000000000));
    } else {
      v.push_back(make_pair(-1000000000, 1899 - c_sum));
    }
    c_sum += c;
  }
  int l = v[0].first, r = v[0].second;
  for (i = 0; i < n; i++) {
    l = max(l, v[i].first);
    r = min(r, v[i].second);
  }
  if (r == 1000000000)
    return printf("Infinity\n"), 0;
  else if (r < l)
    return printf("Impossible\n"), 0;
  else
    return printf("%d\n", r + c_sum), 0;
}
