#include <bits/stdc++.h>
using namespace std;
int const N = 200 * 1000 + 16;
int n;
int a[N];
int d[N];
void die() {
  puts("Impossible");
  exit(0);
}
long long ans = 0;
long long chk(long long x) {
  for (int i = 0; i < n; ++i) {
    if (d[i] == 1 && x < 1900) return 1900 - x;
    if (d[i] == 2 && x > 1899) return 1899 - x;
    x += a[i];
  }
  ans = x;
  return 0;
}
int main() {
  scanf("%d", &n);
  int ones = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", a + i, d + i);
    ones += (d[i] & 1);
  }
  if (ones == n) {
    puts("Infinity");
    exit(0);
  }
  long long inf = 1000 * 1000 * 1000 + 889;
  long long l = -inf;
  if (d[0] == 1) l = 1900;
  long long r = inf;
  bool f = false;
  long long best = 0;
  while (l <= r) {
    auto m = l + r >> 1;
    auto x = chk(m);
    if (0 == x) {
      f = true;
      best = ans;
      l = m + 1;
    } else if (0 < x) {
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  if (f == false) die();
  if (inf == best) {
    puts("Infinity");
  } else {
    printf("%lld\n", best);
  }
}
