#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, c, d, l = INT_MIN, r = INT_MAX, sum = 0;
  cin >> n;
  pair<int, int> t[n];
  for (int i = 0; i < n; i++) cin >> t[i].first >> t[i].second;
  for (int i = 0; i < n; i++) {
    if (t[i].second == 1)
      l = max(l, 1900 - sum);
    else
      r = min(r, 1899 - sum);
    sum += t[i].first;
  }
  if (r < l)
    cout << "Impossible";
  else if (r == INT_MAX)
    cout << "Infinity";
  else
    cout << r + sum;
  return 0;
}
