#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(NULL));
struct Treap {
  int x;
  int y;
  int siz;
  long long sum;
  Treap *lt;
  Treap *rt;
  Treap() {}
  Treap(int x, int y, int siz, int sum, Treap *lt, Treap *rt)
      : x(x), y(y), siz(siz), sum(sum), lt(lt), rt(rt) {}
  ~Treap() {
    if (lt) delete lt;
    if (rt) delete rt;
  }
};
int getSiz(Treap *T) { return T ? T->siz : 0; }
long long getSum(Treap *T) { return T ? T->sum : 0; }
Treap *update(Treap *T) {
  if (!T) return T;
  T->sum = getSum(T->lt) + T->x + getSum(T->rt);
  T->siz = getSiz(T->lt) + 1 + getSiz(T->rt);
  return T;
}
pair<Treap *, Treap *> split(Treap *T, int x) {
  T = update(T);
  if (!T) return {T, T};
  if (T->x < x) {
    auto res = split(T->rt, x);
    T->rt = res.first;
    return {update(T), res.second};
  } else {
    auto res = split(T->lt, x);
    T->lt = res.second;
    return {res.first, update(T)};
  }
}
Treap *merge(Treap *T1, Treap *T2) {
  T1 = update(T1);
  T2 = update(T2);
  if (!T1) return T2;
  if (!T2) return T1;
  if (T1->y > T2->y) {
    T1->rt = merge(T1->rt, T2);
    return update(T1);
  } else {
    T2->lt = merge(T1, T2->lt);
    return update(T2);
  }
}
struct Comp {
  Treap *T;
  int beg;
  long long treap_sum;
  long long cur_sum;
  void update() { cur_sum = treap_sum + beg * 1ll * getSum(T); }
  void insert(int x) {
    pair<Treap *, Treap *> res = split(T, x);
    treap_sum += getSum(res.first) + getSiz(res.second) * 1ll * x;
    T = merge(res.first,
              merge(new Treap(x, rnd(), 1, x, NULL, NULL), res.second));
    update();
  }
  void fill_treap(Treap *T) {
    if (!T) return;
    insert(T->x);
    fill_treap(T->lt);
    fill_treap(T->rt);
  }
};
Comp merge(Comp a, Comp b) {
  if (getSiz(a.T) < getSiz(b.T)) swap(a, b);
  a.beg = min(a.beg, b.beg);
  a.fill_treap(b.T);
  delete b.T;
  a.update();
  return a;
}
const int N = 400005;
int siz[N];
int prt[N];
Comp cc[N];
set<int> free_pos;
long long start_sum = 0;
long long end_sum = 0;
int getprt(int x) { return prt[x] == x ? x : (prt[x] = getprt(prt[x])); }
void merge(int x, int y) {
  x = getprt(x);
  y = getprt(y);
  if (x == y) return;
  if (siz[x] < siz[y]) swap(x, y);
  end_sum -= cc[x].cur_sum;
  end_sum -= cc[y].cur_sum;
  prt[y] = x;
  siz[x] += siz[y];
  cc[x] = merge(cc[x], cc[y]);
  end_sum += cc[x].cur_sum;
}
void solve(int a, int b) {
  start_sum += a * 1ll * b;
  int pos = *free_pos.lower_bound(a);
  free_pos.erase(pos);
  siz[pos] = 1;
  prt[pos] = pos;
  cc[pos].beg = pos;
  cc[pos].insert(b);
  end_sum += cc[pos].cur_sum;
  if (free_pos.count(pos - 1) == 0) merge(pos, pos - 1);
  if (free_pos.count(pos + 1) == 0) merge(pos, pos + 1);
  printf("%I64d\n", end_sum - start_sum);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < N; i += 1) free_pos.insert(i);
  for (int i = 0; i < n; i += 1) {
    int a, b;
    scanf("%d %d", &a, &b);
    solve(a, b);
  }
}
