#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, M = N * 20;
int n, sz, A, B, ls[M], rs[M];
long long c0[M], c1[M], c2[M];
void pu(int o) {
  c0[o] = c0[ls[o]] + c0[rs[o]];
  c1[o] = c1[ls[o]] + c1[rs[o]];
  c2[o] = c2[ls[o]] + c2[rs[o]] + c1[ls[o]] * c0[rs[o]];
}
int node(int p, int l, int r) {
  int o = ++sz;
  c0[o]++, c1[o] += p;
  if (p > ((l + r) / 2))
    rs[o] = node(p, ((l + r) / 2) + 1, r);
  else if (l < r)
    ls[o] = node(p, l, ((l + r) / 2));
  return o;
}
void join(int& o, int oo) {
  if (!o || !oo) {
    o += oo;
    return;
  }
  join(ls[o], ls[oo]), join(rs[o], rs[oo]), pu(o);
}
set<pair<int, int>, greater<pair<int, int>>> s;
int main() {
  cin >> n;
  long long as = 0;
  for (int i = (1); i <= (n); i++) {
    scanf("%d%d", &A, &B);
    auto it = s.lower_bound({A, 1e9});
    s.insert({A, node(B, 1, 200000)});
    if (it == s.end() || A > it->first + c0[it->second]) it--;
    auto [l, t] = *it;
    while (it != s.begin()) {
      auto [L, T] = *--it;
      it++;
      if (L <= l + c0[t])
        as -= c1[T] * (L - l) + c2[t] + c2[T], join(t, T), as += c2[t],
            s.erase({L, T});
      else
        break;
    }
    printf("%lld\n", as);
  }
  return 0;
}
