#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e9;
const int inf = 1e+9;
const double pie = acos(-1);
inline long long int in() {
  long long int _x = 0, _t = 1;
  char _ch = getchar();
  while ((_ch < '0' || _ch > '9') && _ch != '-') _ch = getchar();
  if (_ch == '-') _ch = getchar(), _t = -1;
  while (_ch >= '0' && _ch <= '9') _x *= 10, _x += (_ch - '0'), _ch = getchar();
  return _x * _t;
}
int main() {
  int i, j, k;
  int n, t, h, mn, mx;
  char c;
  n = in();
  h = 0;
  mn = -inf;
  mx = inf;
  for (i = 0; i < n; i++) {
    t = in();
    scanf("%c", &c);
    if (c == '1') {
      mn = max(mn, 1900 - h);
    } else {
      mx = min(mx, 1899 - h);
    }
    h += t;
  }
  if (mx == inf)
    puts("Infinity");
  else if (mn > mx)
    puts("Impossible");
  else
    printf("%d\n", mx + h);
  return 0;
}
