#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int N = 200000 + 5;
int n;
int s[N], d[N];
int main() {
  read(n);
  for (int i = 1; i <= n; i++) read(s[i]), read(d[i]);
  for (int i = 1; i <= n; i++) s[i] += s[i - 1];
  int d1 = -0x7FFFFFFF, d2 = 0x7FFFFFFF;
  for (int i = 1; i <= n; i++) {
    if (d[i] == 1) d1 = max(d1, 1900 - s[i - 1]);
    if (d[i] == 2) d2 = min(d2, 1899 - s[i - 1]);
  }
  if (d2 == 0x7FFFFFFF) {
    printf("Infinity\n");
    return 0;
  }
  if (d1 <= d2) {
    printf("%d\n", d2 + s[n]);
    return 0;
  }
  if (d1 > d2) {
    printf("Impossible\n");
    return 0;
  }
  return 0;
}
