#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p1, p2, sum = 0;
  int maxn = 1e9 + 7, minn = -1e9 - 7;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p1 >> p2;
    if (p2 == 1)
      minn = max(minn, 1900 - sum);
    else
      maxn = min(maxn, 1899 - sum);
    sum += p1;
  }
  if (minn > maxn)
    cout << "Impossible";
  else if (maxn == 1e9 + 7)
    cout << "Infinity";
  else
    cout << maxn + sum;
}
