#include <bits/stdc++.h>
using namespace std;
int n, c[200000 + 5], d[200000 + 5];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  while (cin >> n) {
    int left = -0x3f3f3f3f, right = 0x3f3f3f3f, cur = 0;
    for (int i = 0; i < n; i++) cin >> c[i] >> d[i];
    for (int i = n - 1; i >= 0; i--) {
      cur += c[i];
      if (d[i] == 1)
        left = max(left, cur + 1900);
      else
        right = min(right, cur + 1899);
    }
    if (right == (0x3f3f3f3f))
      cout << "Infinity" << endl;
    else if (left > right)
      cout << "Impossible" << endl;
    else
      cout << right << endl;
  }
  return 0;
}
