#include <bits/stdc++.h>
const int inf = 1e9 + 5;
const long long linf = 5e18 + 5;
const long double eps = 1e-9;
const long long dd = 2e5 + 7;
const long long maxn = 2e3 + 10;
const long long mod = 1e9 + 7;
using namespace std;
const int qq = 1e5;
map<char, long long> qwe;
void imp() {
  cout << "Impossible\n";
  exit(0);
}
void iin() {
  cout << "Infinity\n";
  exit(0);
}
int x1[dd], c1[dd];
int main() {
  ios_base::sync_with_stdio(0);
  if (0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  } else {
    if (!01) {
      freopen(
          "sufpref"
          ".in",
          "r", stdin);
      freopen(
          "sufpref"
          ".out",
          "w", stdout);
    }
  }
  int n;
  cin >> n;
  int l = -inf;
  int r = inf;
  int now = 0;
  int past = 0;
  for (long long i = 0; i < n; ++i) {
    int xx, cc;
    cin >> xx >> cc;
    x1[i + 1] = xx;
    c1[i] = cc;
  }
  x1[0] = 0;
  for (long long i = 0; i < n + 1; ++i) {
    int x = x1[i];
    int c = c1[i];
    now += x;
    if (i) {
      if (past == 2 && c == 1) {
        l = max(l, now - x);
        r = min(r, now);
      }
      if (past == 1 && c == 2) {
        l = max(l, now);
        r = min(r, now - x);
      }
      if (past == 1 && c == 1) {
        if (now <= l) {
          imp();
        }
      }
      if (past == 2 && c == 2) {
        if (now >= r) {
          imp();
        }
      }
    }
    if (c == 1) r = min(r, now);
    if (c == 2) l = max(l, now);
    if (l >= r) imp();
    past = c;
  }
  if (l == -inf) {
    iin();
  }
  if (now > l)
    cout << 1899 + (now - l);
  else
    cout << 1899 - (l - now);
}
