#include <bits/stdc++.h>
using namespace std;
int n, l, r, k, c[200005], d[200005];
int main() {
  int i;
  cin >> n;
  l = -(1 << 30), r = (1 << 30);
  for (i = 1; i <= n; i++) scanf("%d %d", &c[i], &d[i]);
  for (i = 1; i <= n; i++) {
    if (d[i] == 1)
      l = max(1900 - k, l);
    else
      r = min(r, 1899 - k);
    k += c[i];
  }
  if (r == (1 << 30))
    printf("Infinity");
  else {
    if (l > r)
      printf("Impossible");
    else {
      for (i = 1; i <= n; i++) r += c[i];
      cout << r;
    }
  }
  return 0;
}
