#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int l = -INF, r = INF, a = 0;
  while (n--) {
    int a_, d;
    cin >> a_ >> d;
    if (d == 1)
      l = max(l, 1900 - a);
    else
      r = min(r, 1899 - a);
    a += a_;
  }
  if (r != INF && l <= r)
    cout << r + a << '\n';
  else if (r == INF)
    cout << "Infinity\n";
  else
    cout << "Impossible\n";
  return 0;
}
