#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int from = -inf, to = inf;
  int del = 0;
  for (int i = 0; i < (int)n; ++i) {
    int d, cur;
    cin >> cur >> d;
    if (d == 1) {
      from = max(from, 1900 - del);
    } else {
      to = min(to, 1899 - del);
    }
    del += cur;
  }
  if (from > to) {
    puts("Impossible");
    return 0;
  }
  if (to == inf) {
    puts("Infinity");
    return 0;
  }
  cout << to + del << endl;
  return 0;
}
