#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = unsigned int;
using u64 = unsigned long long;
char buf[10];
void NO() {
  puts("Impossible");
  exit(0);
}
ll update(ll x, ll c) {
  if (x == LLONG_MAX || x == LLONG_MIN) return x;
  return x + c;
}
int main() {
  int n;
  scanf("%d", &n);
  ll max_r = LLONG_MAX;
  ll min_r = LLONG_MIN;
  for (int i = (0); i < (n); ++i) {
    ll c_i, d_i;
    scanf("%lld%lld", &c_i, &d_i);
    ;
    if (d_i == 2) {
      if (min_r >= 1900) NO();
      if (max_r >= 1900) max_r = 1899;
    } else if (d_i == 1) {
      if (max_r < 1900) NO();
      if (min_r < 1900) min_r = 1900;
    }
    max_r = update(max_r, c_i);
    min_r = update(min_r, c_i);
  }
  if (max_r == LLONG_MAX)
    puts("Infinity");
  else
    printf("%lld", max_r);
  return 0;
}
