#include <bits/stdc++.h>
using namespace std;
long long int c, d;
int main() {
  long long int l = -999999999999999999;
  long long int r = 999999999999999999;
  int n;
  scanf("%d", &n);
  bool ok = true;
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &c, &d);
    if (d == 2) {
      if (l >= 1900) {
        ok = false;
      }
      if (1899 < r) r = 1899;
    } else {
      if (r < 1900) ok = false;
      if (1900 > l) l = 1900;
    }
    if (l > r) {
      ok = false;
    }
    l += c;
    r += c;
  }
  if (ok == false) {
    printf("Impossible\n");
  } else {
    if (r > 99999999999) {
      printf("Infinity\n");
    } else {
      printf("%lld\n", r);
    }
  }
}
