#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int f = 0;
  cin >> n;
  int min1 = 201, max2 = -201;
  int m, d, now = 0;
  int f1 = 0, f2 = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> m >> d;
    if (d == 1) {
      if (f1 == 0) {
        f1 = 1;
        min1 = now;
      } else {
        min1 = min(min1, now);
      }
    }
    if (d == 2) {
      if (f2 == 0) {
        f2 = 1;
        max2 = now;
      } else {
        max2 = max(max2, now);
      }
    }
    if ((f1 != 0) && (f2 != 0) && (min1 <= max2)) {
      f = 1;
    }
    now += m;
  }
  if (f1 == 0) {
    ans = 1899 - max2 + now;
  } else if (f2 == 0) {
    f = 2;
  } else {
    ans = 1899 - max2 + now;
  }
  if (f == 0) cout << ans << endl;
  if (f == 1) puts("Impossible");
  if (f == 2) puts("Infinity");
}
