#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long Max(long long a, long long b) { return a > b ? a : b; }
long long Min(long long a, long long b) { return a < b ? a : b; }
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = ((res % p) * (x % p)) % p;
    y = y >> 1;
    x = ((x % p) * (x % p)) % p;
  }
  return res;
}
bool isprime(long long n) {
  if (n == 2) return true;
  if (n % 2 == 0) return false;
  for (long long i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, lo = 0, hi = 1000000007LL, ans = -1000000007LL, flag = 0;
  cin >> n;
  vector<pair<long long, long long> > arr(n);
  vector<pair<long long, long long> > poss(n + 1);
  for (long long i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
    if (arr[i].second == 2) flag = 1;
  }
  if (arr[0].second == 1) {
    poss[0].first = 1900;
    poss[0].second = 1000000007LL;
  } else {
    poss[0].first = -1000000007LL;
    poss[0].second = 1899;
  }
  for (long long i = 1; i < n; i++) {
    poss[i].first = poss[i - 1].first + arr[i - 1].first;
    poss[i].second = poss[i - 1].second + arr[i - 1].first;
    if (poss[i].first > poss[i].second) {
      cout << "Impossible";
      return 0;
    }
    if (arr[i].second == 1) {
      poss[i].first = Max(poss[i].first, 1900);
      if (poss[i].second < poss[i].first) {
        cout << "Impossible";
        return 0;
      }
    } else {
      poss[i].second = Min(poss[i].second, 1899);
      if (poss[i].second < poss[i].first) {
        cout << "Impossible";
        return 0;
      }
    }
  }
  poss[n].first = poss[n - 1].first + arr[n - 1].first;
  poss[n].second = poss[n - 1].second + arr[n - 1].first;
  if (poss[n].first > poss[n].second) {
    cout << "Impossible";
    return 0;
  } else if (flag == 0) {
    cout << "Infinity";
  } else {
    cout << poss[n].second;
  }
  return 0;
}
