#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[200004];
int divw[200004];
long long valid(long long ra) {
  for (int i = 0; i < n; i++) {
    if (ra >= 1900) {
      if (divw[i] == 2) return 2;
    }
    if (ra < 1900) {
      if (divw[i] == 1) return 3;
    }
    ra += (a[i]);
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cin >> divw[i];
  }
  long long l = -20000001;
  long long r = 20000001;
  if (divw[0] == 1) l = 1900;
  if (divw[0] == 2) r = 1899;
  long long fl = 0;
  while (l < r) {
    long long mid = (l + r + 1) / 2;
    long long res = (valid(mid));
    if (res == 1) {
      l = mid;
      fl = 1;
    } else {
      if (res == 3) l = mid;
      if (res == 2) r = mid - 1;
    }
  }
  if (l == 20000001) {
    cout << "Infinity";
    return 0;
  }
  if (fl == 0) {
    cout << "Impossible";
    return 0;
  }
  long long ans = l;
  for (int i = 0; i < n; i++) {
    ans += a[i];
  }
  cout << ans;
  return 0;
}
