#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0, l = -99999999, r = 99999999;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int rat, div;
    scanf("%d", &rat), scanf("%d", &div);
    if (div == 1)
      l = max(l, 1900 - sum);
    else
      r = min(r, 1899 - sum);
    sum += rat;
  }
  if (r >= 99999999)
    cout << "Infinity\n";
  else if (l > r)
    cout << "Impossible\n";
  else
    cout << sum + r << "\n";
  return 0;
}
