#include <bits/stdc++.h>
int c[int(2e5 + 23)], d[int(2e5 + 23)], maxR(1e8), minR(-1e8), sum, n;
int main(int argn, char **args) {
  std::scanf("%d", &n);
  for (int k(n); k--; sum += c[k]) std::scanf("%d%d", c + k, d + k);
  for (int k(0); k < n; ++k) {
    if (maxR != 1e8) maxR -= c[k];
    if (minR != -1e8) minR -= c[k];
    if (d[k] == 2)
      maxR = std::min(1899, maxR);
    else
      minR = std::max(1900, minR);
    if (maxR < minR && minR != -1e8 && maxR != 1e8) {
      maxR = 1e8;
      minR = -1e8;
      break;
    }
  }
  if (minR == -1e8 && maxR == 1e8)
    std::printf("Impossible\n");
  else if (maxR == 1e8)
    std::printf("Infinity\n");
  else
    std::printf("%d\n", maxR + sum);
  return (0);
}
