#include <bits/stdc++.h>
using namespace std;
int di[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dj[] = {1, -1, 0, 0, -1, 1, 1, -1};
const int N = 20, inf = 1e9;
bool Check(int x, int p) {
  int i = (x / 50) % 475;
  for (int a = 0; a < 25; ++a) {
    i = (i * 96 + 42) % 475;
    if (26 + i == p) {
      return true;
    }
  }
  return false;
}
int main() {
  int mn = -inf, mx = inf;
  int n;
  cin >> n;
  int rate, div;
  bool in = 1;
  while (n--) {
    cin >> rate >> div;
    if (div == 2) in = 0;
    if (mn > 1899 && div == 2) {
      cout << "Impossible\n";
      return 0;
    }
    if (mx < 1900 && div == 1) {
      cout << "Impossible\n";
      return 0;
    }
    if (mx > 1899 && div == 2) {
      mx = 1899;
    }
    if (mn < 1900 && div == 1) {
      mn = 1900;
    }
    mx += rate;
    mn += rate;
  }
  if (in)
    cout << "Infinity\n";
  else
    cout << mx << '\n';
  return 0;
}
