#include <bits/stdc++.h>
int main() {
  int i, n, level, dert;
  int cnt = 0;
  int max = -2147480000;
  int min = 2147480000;
  scanf("%d", &n);
  int flag = 1;
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &dert, &level);
    if (level == 1 && cnt < min) min = cnt;
    if (level == 2 && cnt > max) max = cnt;
    if (min <= max && max != -2147480000 && min != 2147480000) {
      flag = 0;
      break;
    }
    cnt += dert;
  }
  if (max == -2147480000)
    printf("Infinity");
  else if (flag)
    printf("%d", 1899 - max + cnt);
  else
    printf("Impossible");
}
