#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void cmin(T &a, T b) {
  ((a > b) && (a = b));
}
template <class T>
inline void cmax(T &a, T b) {
  ((a < b) && (a = b));
}
char IO;
template <class T = int>
T rd() {
  T s = 0;
  int f = 0;
  while (!isdigit(IO = getchar())) f |= IO == '-';
  do s = (s << 1) + (s << 3) + (IO ^ '0');
  while (isdigit(IO = getchar()));
  return f ? -s : s;
}
const int N = 4e5 + 10, M = N * 19, INF = 1e9 + 10;
int n;
int ls[M], rs[M], c[M], cnt;
long long s[M], ans[M];
long long Ans;
int F[N], rt[N];
int Find(int x) { return F[x] == x ? x : F[x] = Find(F[x]); }
void Up(int x) {
  c[x] = c[ls[x]] + c[rs[x]], s[x] = s[ls[x]] + s[rs[x]];
  ans[x] = ans[ls[x]] + ans[rs[x]] + c[rs[x]] * s[ls[x]];
}
void Upd(int &p, int l, int r, int x) {
  if (!p) p = ++cnt;
  if (l == r) {
    c[p] = 1, s[p] = x;
    return;
  }
  int mid = (l + r) >> 1;
  x <= mid ? Upd(ls[p], l, mid, x) : Upd(rs[p], mid + 1, r, x);
  Up(p);
}
int Union(int x, int y, int l = 1, int r = n) {
  if (!x || !y) return x | y;
  int mid = (l + r) >> 1;
  ls[x] = Union(ls[x], ls[y], l, mid), rs[x] = Union(rs[x], rs[y], mid + 1, r);
  return Up(x), x;
}
void Add(int x, int k) {
  x = Find(x);
  Ans += k * (x * s[rt[x]] + ans[rt[x]]);
}
int main() {
  n = rd();
  for (int i = 1, iend = n; i <= iend; ++i) {
    int x = rd(), y = rd();
    Ans -= 1ll * x * y;
    int f = Find(x);
    if (!f)
      f = F[x] = x;
    else
      Add(f, -1), F[f + c[rt[f]]] = f;
    Upd(rt[f], 1, n, y);
    while (x = Find(x), y = Find(x - 1)) {
      Add(y, -1);
      F[x] = x - 1;
      rt[y] = Union(rt[y], rt[x]);
    }
    while (x = Find(x), y = Find(x + c[rt[x]])) {
      Add(y, -1);
      F[x + c[rt[x]]] = x;
      rt[x] = Union(rt[x], rt[y]);
    }
    Add(x, 1), printf("%lld\n", Ans);
  }
}
