#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
  int n;
  scanf("%d", &n);
  int c, d;
  int l = -2e8 + 500, r = 2e8 + 500;
  int s = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &c, &d);
    if (d == 1) {
      l = max(l, 1900 - s);
    } else {
      r = min(r, 1899 - s);
    }
    s += c;
  }
  if (l > r)
    puts("Impossible");
  else if (r == 2e8 + 500)
    puts("Infinity");
  else
    printf("%d\n", r + s);
  return 0;
}
