#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int high = 100000000, low = -100000000, pos = 0;
  int c, d;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &c, &d);
    if (d == 1) {
      if (high > pos) high = pos;
    } else if (d == 2) {
      if (low <= pos) low = pos + 1;
    }
    pos += c;
  }
  if (high < low)
    printf("Impossible\n");
  else if (low == -100000000) {
    printf("Infinity\n");
  } else {
    printf("%d\n", pos + 1900 - low);
  }
  return 0;
}
