#include <bits/stdc++.h>
using namespace std;
int s[200006], a[200006], ma = 2e9, mi = -2e9, n, t, kq;
int main() {
  scanf("%d", &n);
  int x, i;
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &x, &a[i]);
    s[i] = s[i - 1] + x;
  }
  for (i = 1; i <= n; i++) {
    if (a[i] == 1) {
      t = 1900 - s[i - 1];
      if (t > ma) {
        printf("Impossible");
        return 0;
      }
      mi = max(mi, t);
    } else {
      t = 1899 - s[i - 1];
      if (t < mi) {
        printf("Impossible");
        return 0;
      }
      ma = min(t, ma);
    }
  }
  if (ma == 2e9)
    printf("Infinity");
  else {
    ma += s[n];
    printf("%d", ma);
  }
  return 0;
}
