#include <bits/stdc++.h>
using namespace std;
int a[200001], d[200001], s[200001];
int minn, maxn;
int main() {
  int n, i, maxx = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &d[i]);
    s[i] = s[i - 1] + a[i];
    if (s[i] > maxx && i != n) {
      maxx = s[i];
    }
  }
  if (d[1] == 1) {
    minn = 0;
    maxn = -100000000;
  } else {
    maxn = 0;
    minn = 100000000;
  }
  for (i = 1; i <= n - 1; i++) {
    if (d[i + 1] == 1) {
      minn = min(minn, s[i]);
    } else {
      maxn = max(maxn, s[i]);
    }
  }
  if (maxn >= minn) {
    printf("Impossible\n");
    return 0;
  }
  if (minn == 100000000) {
    printf("%d\n", 1899 - maxx + s[n]);
    return 0;
  }
  if (maxn == -100000000) {
    printf("Infinity\n");
    return 0;
  }
  printf("%d\n", 1899 - maxn + s[n]);
  return 0;
}
