#include <bits/stdc++.h>
using namespace std;
const int RLEN = 1 << 18 | 1;
inline char nc() {
  static char ibuf[RLEN], *ib, *ob;
  (ib == ob) && (ob = (ib = ibuf) + fread(ibuf, 1, RLEN, stdin));
  return (ib == ob) ? -1 : *ib++;
}
inline int rd() {
  char ch = nc();
  int i = 0, f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = nc();
  }
  while (isdigit(ch)) {
    i = (i << 1) + (i << 3) + ch - '0';
    ch = nc();
  }
  return i * f;
}
inline void W(long long x) {
  static int buf[50];
  if (!x) {
    putchar('0');
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  while (x) {
    buf[++buf[0]] = x % 10;
    x /= 10;
  }
  while (buf[0]) putchar(buf[buf[0]--] + '0');
}
const int N = 4e5 + 50, M = 1e7 + 50;
int n, a[N], b[N], li[N], ri[N];
int rt[N], lc[M], rc[M], c1[M], tot;
long long s1[M], s2[M], ans;
inline int ga(int *anc, int x) {
  return (anc[x] == x) ? x : (anc[x] = ga(anc, anc[x]));
}
inline void upt(int k) {
  c1[k] = c1[lc[k]] + c1[rc[k]];
  s1[k] = s1[rc[k]] + s1[lc[k]] + c1[rc[k]] * s2[lc[k]];
  s2[k] = s2[lc[k]] + s2[rc[k]];
}
inline void inc(int &k, int l, int r, int p) {
  if (!k) k = ++tot;
  if (l == r) {
    c1[k] = 1;
    s1[k] = s2[k] = p;
    return;
  }
  int mid = (l + r) >> 1;
  if (p <= mid)
    inc(lc[k], l, mid, p);
  else
    inc(rc[k], mid + 1, r, p);
  upt(k);
}
inline int merge(int x, int y) {
  if (!x || !y) return (x + y);
  lc[x] = merge(lc[x], lc[y]);
  rc[x] = merge(rc[x], rc[y]);
  upt(x);
  return x;
}
inline void inc(int x, int y) {
  int r = ga(ri, x);
  li[r + 1] = r;
  ri[r] = ri[r + 1] = r + 1;
  ans -= s1[rt[x]] + (long long)(x - 1) * s2[rt[x]];
  inc(rt[x], 1, n, y);
  ans += s1[rt[x]] + (long long)(x - 1) * s2[rt[x]];
}
inline void _merge(int x, int y) {
  ans -= s1[rt[x]] + (long long)(x - 1) * s2[rt[x]];
  ans -= s1[rt[y]] + (long long)(y - 1) * s2[rt[y]];
  rt[x] = merge(rt[x], rt[y]);
  ans += s1[rt[x]] + (long long)(x - 1) * s2[rt[x]];
  ri[y - 1] = y;
  li[y] = y - 1;
}
int main() {
  n = rd();
  for (int i = 1; i <= n; i++) {
    a[i] = rd(), b[i] = rd();
    ans -= (long long)a[i] * b[i];
    if (li[a[i] - 1]) {
      inc(ga(li, a[i] - 1), b[i]);
    } else {
      if (!li[a[i]]) {
        li[a[i]] = ri[a[i]] = a[i];
        inc(rt[a[i]], 1, n, b[i]);
        ans += s1[rt[a[i]]] + (a[i] - 1) * s2[rt[a[i]]];
      } else
        inc(a[i], b[i]);
    }
    while (li[ga(ri, a[i]) + 1]) _merge(ga(li, a[i]), ga(ri, a[i]) + 1);
    W(ans);
    putchar('\n');
  }
}
