#include <bits/stdc++.h>
int n, C[200010], D[200010];
int ans;
int check(int lim) {
  int i, ret = 0;
  for (i = n; i; i--) {
    lim -= C[i];
    if (lim >= 1900 && D[i] == 2)
      ret = 1;
    else if (lim < 1900 && D[i] == 1)
      ret = -1;
  }
  return ret;
}
int work() {
  int head = -1e9 + 7, tail = 1e9 + 7, mid;
  while (head < tail) {
    mid = (head + tail + 1) >> 1;
    if (check(mid) > 0)
      tail = mid - 1;
    else
      head = mid;
  }
  return head;
}
int main() {
  int i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d%d", &C[i], &D[i]);
  ans = work();
  if (check(ans))
    printf("Impossible");
  else if (ans >= 1e9 + 7)
    printf("Infinity");
  else
    printf("%d", ans);
  return 0;
}
