#include <bits/stdc++.h>
using namespace std;
const int nmax = 400005;
int sef[nmax], sz[nmax * 10], l[nmax * 10], r[nmax * 10], t[nmax], nr[nmax], u;
long long sum[nmax * 10], ans;
void update(int nod) {
  sz[nod] = sz[l[nod]] + sz[r[nod]];
  sum[nod] = sum[l[nod]] + sum[r[nod]];
}
void ins(int &nod, int st, int dr, int val) {
  if (nod == 0) nod = ++u;
  if (st == dr) {
    sz[nod] = 1;
    sum[nod] = val;
    return;
  }
  int mij = (st + dr) / 2;
  if (val <= mij)
    ins(l[nod], st, mij, val);
  else
    ins(r[nod], mij + 1, dr, val);
  update(nod);
}
long long query(int nod) { return sz[r[nod]] * sum[l[nod]]; }
int findt(int nod) {
  if (t[nod] == nod) return nod;
  return t[nod] = findt(t[nod]);
}
int onion(int x, int y) {
  if (x == 0) return y;
  if (y == 0) return x;
  ans = ans - query(x) - query(y);
  l[x] = onion(l[x], l[y]);
  r[x] = onion(r[x], r[y]);
  update(x);
  ans = ans + query(x);
  return x;
}
void calc(int x, int y) {
  int tx = findt(x), ty = findt(y);
  ans = ans + sum[sef[y]] * (tx - ty);
  sef[tx] = onion(sef[tx], sef[ty]);
  t[ty] = tx;
  nr[tx] = nr[ty];
}
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 1; i <= 400000; i++) t[i] = i;
  int a, b;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &a, &b);
    int ta = findt(a);
    int aux;
    if (nr[ta])
      aux = nr[ta] + 1;
    else
      aux = a;
    nr[aux] = aux;
    ans = ans - 1LL * a * b;
    ins(sef[aux], 1, n, b);
    ans = ans + 1LL * aux * b;
    if (nr[aux - 1]) calc(aux - 1, aux);
    if (nr[aux + 1]) calc(aux, aux + 1);
    printf("%lld\n", ans);
  }
  return 0;
}
