#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, j, x, y, q, m, l = -1, k, t, z;
  double sg, fg, second, d, tt;
  string a, b, c;
  cin >> n;
  x = 0;
  k = 0;
  y = 1;
  b = "Impossible";
  c = "Infinity";
  vector<long long> m1;
  vector<long long> m2;
  long long mn1, mn2;
  k = 0;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    if (y == 1) {
      m1.push_back(k);
      if (m1.size() == 1)
        mn1 = m1[0];
      else
        mn1 = min(mn1, k);
    } else {
      m2.push_back(k);
      if (m2.size() == 1)
        mn2 = m2[0];
      else
        mn2 = max(mn2, k);
    }
    k += x;
  }
  if (m2.size() == 0)
    cout << c << "\n";
  else if (m1.size() > 0 && mn1 <= mn2)
    cout << b << "\n";
  else {
    cout << 1899 - mn2 + k << "\n";
  }
  return 0;
}
