#include <bits/stdc++.h>
using namespace std;
long long int infinity = 90000000000000000, ans, sum;
int n, c[200001], d[200001];
long long int possible(long long int num) {
  for (int i = 0; i < n; ++i) {
    if (d[i] == 1) {
      if (num >= 1900)
        num += c[i];
      else
        return -1;
    } else {
      if (num <= 1899)
        num += c[i];
      else
        return 1;
    }
  }
  return 0;
}
long long int search(long long int i, long long int j) {
  if (i == j) {
    if (possible(i) == 0)
      return i;
    else
      return -infinity;
  } else if (i + 1 == j) {
    if (possible(j) == 0)
      return j;
    else if (possible(i) == 0)
      return i;
    else
      return -infinity;
  } else {
    long long int mid = (i + j) / 2;
    if (possible(mid) == 0)
      return search(mid, j);
    else if (possible(mid) == -1)
      return search(mid + 1, j);
    else
      return search(i, mid - 1);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> c[i] >> d[i];
    sum += c[i];
  }
  if (d[0] == 1)
    ans = search(1900, infinity);
  else
    ans = search(-infinity, 1899);
  if (ans == infinity)
    cout << "Infinity" << endl;
  else if (ans == -infinity)
    cout << "Impossible" << endl;
  else
    cout << (ans + sum) << endl;
  return 0;
}
