#include <bits/stdc++.h>
using namespace std;
pair<int, int> pr[200100];
int main() {
  int n;
  cin >> n;
  long long l, r;
  for (int i = 0; i < n; i++) {
    cin >> pr[i].first >> pr[i].second;
  }
  if (pr[0].second == 1)
    l = 1900, r = 1e9;
  else
    l = -1e9, r = 1899;
  long long sum = 0;
  bool flag = 0;
  for (int i = 0; i < n - 1; i++) {
    sum = pr[i].first;
    if (pr[i].second == 2 && pr[i + 1].second == 1 && pr[i].first <= 0)
      return puts("Impossible");
    if (pr[i].second == 1 && pr[i + 1].second == 2 && pr[i].first >= 0)
      return puts("Impossible");
    if (pr[i].second == 2 && pr[i + 1].second == 1) {
      if (r + sum < 1900)
        return puts("Impossible");
      else
        l = max(1900ll, l + sum), r = r + sum, sum = 0;
      flag = 1;
    }
    if (pr[i].second == 1 && pr[i + 1].second == 2) {
      if (l + sum >= 1900)
        return puts("Impossible");
      else
        l = l + sum, r = min(1899ll, r + sum), sum = 0;
      flag = 1;
    }
    if (pr[i].second == 2 && pr[i + 1].second == 2) {
      if (l + sum >= 1900)
        return puts("Impossible");
      else
        l += sum, r = min(1899ll, r + sum);
    }
    if (pr[i].second == 1 && pr[i + 1].second == 1) {
      if (r + sum < 1900)
        return puts("Impossible");
      else
        r += sum, l = max(1900ll, l + sum);
    }
  }
  if (flag)
    cout << r + pr[n - 1].first << endl;
  else if (pr[0].second == 1)
    cout << "Infinity" << endl;
  else {
    cout << r + pr[n - 1].first << endl;
  }
  return 0;
}
