#include <bits/stdc++.h>
using namespace std;
function<void(void)> ____ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
};
const int MAXN = 4e5 + 7;
int n;
pair<int, int> A[MAXN];
struct Disjoint_Set_Union {
  int fa[MAXN], sz[MAXN];
  void clear() {
    for (int i = 1; i < MAXN; i++) fa[i] = i, sz[i] = 0;
  }
  int findx(int x) { return x == fa[x] ? x : fa[x] = findx(fa[x]); }
  void merge(int x, int y) {
    x = findx(x), y = findx(y);
    if (x != y) sz[y] += sz[x], fa[x] = y;
  }
} dsu;
struct SegmentTree {
  int root[MAXN], sz[MAXN << 4], tot, ls[MAXN << 4], rs[MAXN << 4];
  long long sig[MAXN << 4], sum[MAXN << 4];
  void pushup(int rt) {
    sz[rt] = sz[ls[rt]] + sz[rs[rt]];
    sig[rt] = sig[ls[rt]] + sig[rs[rt]];
    sum[rt] = sig[ls[rt]] * sz[rs[rt]] + sum[ls[rt]] + sum[rs[rt]];
  }
  void modify(int &rt, int pos, int L, int R) {
    rt = ++tot;
    if (L + 1 == R) {
      sz[rt]++;
      sig[rt] += pos;
      return;
    }
    int mid = (L + R) >> 1;
    if (pos < mid)
      modify(ls[rt], pos, L, mid);
    else
      modify(rs[rt], pos, mid, R);
    pushup(rt);
  }
  int merge(int u, int v, int L, int R) {
    if (!u or !v) return u ^ v;
    if (L + 1 == R) {
      sz[u] += sz[v];
      sig[u] += sig[v];
      return u;
    }
    int mid = (L + R) >> 1;
    ls[u] = merge(ls[u], ls[v], L, mid);
    rs[u] = merge(rs[u], rs[v], mid, R);
    pushup(u);
    return u;
  }
} seg;
void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d %d", &A[i].first, &A[i].second);
  dsu.clear();
  long long ret = 0;
  for (int i = 1; i <= n; i++) {
    int a = A[i].first, b = A[i].second;
    ret -= 1ll * a * b;
    int rt = dsu.findx(a);
    int pos = rt + dsu.sz[rt];
    dsu.sz[pos] = 1;
    seg.modify(seg.root[pos], b, 1, n + 1);
    if (pos == rt and pos != 1 and dsu.sz[pos - 1]) rt = dsu.findx(rt - 1);
    if (pos != rt) {
      ret -= seg.sum[seg.root[rt]];
      ret -= rt * seg.sig[seg.root[rt]];
      dsu.merge(pos, rt);
      seg.root[rt] = seg.merge(seg.root[rt], seg.root[pos], 1, n + 1);
    }
    if (dsu.sz[pos + 1]) {
      ret -= seg.sum[seg.root[pos + 1]];
      ret -= (pos + 1) * seg.sig[seg.root[pos + 1]];
      dsu.merge(pos + 1, rt);
      seg.root[rt] = seg.merge(seg.root[rt], seg.root[pos + 1], 1, n + 1);
    }
    ret += seg.sum[seg.root[rt]];
    ret += rt * seg.sig[seg.root[rt]];
    cout << ret << "\n";
  }
}
int main() {
  solve();
  return 0;
}
