#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int tot = 0, n, up = 0x3f3f3f3f, down = -0x3f3f3f3f, c, d;
  scanf("%lld", &n);
  scanf("%lld %lld", &c, &d);
  if (d == 1)
    down = 1900;
  else
    up = 1899;
  long long int ori = c;
  for (long long int i = 1; i <= n - 1; i++) {
    scanf("%lld %lld", &c, &d);
    tot += ori;
    if (d == 1) {
      down = max(down, 1900 - tot);
    } else {
      up = min(up, 1899 - tot);
    }
    ori = c;
  }
  if (up == 0x3f3f3f3f) {
    printf("Infinity\n");
    return 0;
  }
  if (up < down) {
    printf("Impossible\n");
    return 0;
  }
  printf("%lld\n", up + ori + tot);
  return 0;
}
