#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char a = getchar();
  while (a < '0' || a > '9') {
    if (a == '-') f = -1;
    a = getchar();
  }
  while (a >= '0' && a <= '9') x = x * 10 + a - '0', a = getchar();
  return x * f;
}
int n, c[200005], d[200005], now, lim_down, lim_up;
int main() {
  n = read();
  lim_down = -1e9;
  lim_up = 1e9;
  for (int i = 1; i <= n; i++) c[i] = read(), d[i] = read();
  if (n == 1) {
    if (d[1] == 1)
      puts("Infinity");
    else
      printf("%d\n", 1899 + c[1]);
    return 0;
  }
  if (d[1] == 2)
    lim_up = 1899;
  else
    lim_down = 1900;
  for (int i = 1; i <= n; i++) {
    now += c[i];
    if (i == n) break;
    if (d[i + 1] == 1)
      lim_down = max(lim_down, 1900 - now);
    else
      lim_up = min(lim_up, 1899 - now);
    if (lim_up < lim_down) {
      puts("Impossible");
      return 0;
    }
  }
  if (lim_up == 1e9)
    puts("Infinity");
  else
    printf("%d\n", lim_up + now);
  return 0;
}
