#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct SegmentTree {};
long long n;
pair<long long, long long> rate[200005];
void input() {}
void solve() {}
signed main(signed argc, char** argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> rate[i].second >> rate[i].first;
  long long l = -30000000, r = 30000000, ans = -30000000;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    long long score = mid;
    long long possible = 2;
    for (long long i = 1; i <= n; i++) {
      if (rate[i].first == 2 && score > 1899) {
        possible = 0;
        break;
      }
      if (rate[i].first == 1 && score < 1900) {
        possible = 1;
        break;
      }
      score += rate[i].second;
    }
    if (possible > 0) {
      if (possible == 2) ans = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  if (ans >= 30000000)
    cout << "Infinity";
  else if (ans <= -30000000)
    cout << "Impossible";
  else {
    for (long long i = 1; i <= n; i++) ans += rate[i].second;
    cout << ans;
  }
  return 0;
}
