#include <bits/stdc++.h>
using namespace std;
const int N = 414514;
int n, tt;
int fa[N], r[N];
int rt[N], ls[N * 30], rs[N * 30], sz[N * 30];
long long su[N * 30], as;
void add(int &i, int l, int r, int p) {
  if (!i) i = ++tt;
  if (l == r) {
    sz[i] = 1, su[i] = p;
    return;
  }
  int mi = (l + r) >> 1;
  if (p <= mi)
    add(ls[i], l, mi, p);
  else
    add(rs[i], mi + 1, r, p);
  sz[i] = sz[ls[i]] + sz[rs[i]];
  su[i] = su[ls[i]] + su[rs[i]];
}
void merge(int &x, int y) {
  if (!x || !y) {
    x = x | y;
    return;
  }
  as -= 1ll * su[ls[x]] * sz[rs[x]] + 1ll * su[ls[y]] * sz[rs[y]];
  merge(ls[x], ls[y]);
  merge(rs[x], rs[y]);
  as += 1ll * su[ls[x]] * sz[rs[x]];
  sz[x] += sz[y];
  su[x] += su[y];
  return;
}
int get(int x) { return x == fa[x] ? x : fa[x] = get(fa[x]); }
void mrg(int x, int y) {
  x = get(x), y = get(y);
  fa[y] = x;
  as -= su[rt[x]] * x + su[rt[y]] * y;
  merge(rt[x], rt[y]);
  as += su[rt[x]] * x;
  r[x] = r[y];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= 400000; i++) fa[i] = i, r[i] = i;
  for (int i = 1, a, b; i <= n; i++) {
    scanf("%d%d", &a, &b);
    int p = rt[a] ? r[get(a)] + 1 : a;
    as -= 1ll * a * b;
    as += 1ll * p * b;
    add(rt[p], 1, n, b);
    if (rt[p - 1]) mrg(p - 1, p);
    if (rt[p + 1]) mrg(p, p + 1);
    printf("%lld\n", as);
  }
}
