#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma warning(disable : 4996)
using namespace std;
int c[200005], d[200005];
int main() {
  int n;
  scanf("%d", &n);
  int val = 0;
  int lb, ub;
  lb = -1000000000;
  ub = 1000000000;
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &c[i], &d[i]);
    if (d[i] == 1) {
      lb = ((lb) > (1900 - val) ? (lb) : (1900 - val));
    } else {
      ub = ((ub) < (1899 - val) ? (ub) : (1899 - val));
    }
    val += c[i];
  }
  if (lb > ub) {
    printf("Impossible\n");
    return 0;
  }
  val = ub;
  for (int i = 1; i <= n; i++) {
    val += c[i];
  }
  if (val >= 100000000)
    printf("Infinity\n");
  else
    printf("%d\n", val);
  return 0;
}
