#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(NULL));
struct node {
  int first;
  int second;
  long long sum;
  int siz;
  node* l;
  node* r;
  node(){};
  node(int first, int second, long long sum, int siz, node* l, node* r)
      : first(first), second(second), sum(sum), siz(siz), l(l), r(r){};
};
typedef node* treap;
int getSiz(treap t) { return (t ? t->siz : 0); }
long long getSum(treap t) { return (t ? t->sum : 0); }
treap fix(treap t) {
  if (!t) return t;
  t->sum = getSum(t->l) + t->first + getSum(t->r);
  t->siz = getSiz(t->l) + 1 + getSiz(t->r);
  return t;
}
pair<treap, treap> split(treap t, int l) {
  t = fix(t);
  if (!t) return make_pair(t, t);
  if (t->first < l) {
    auto z = split(t->r, l);
    t->r = z.first;
    return make_pair(fix(t), z.second);
  } else {
    auto z = split(t->l, l);
    t->l = z.second;
    return make_pair(z.first, fix(t));
  }
}
treap merge(treap a, treap b) {
  a = fix(a);
  b = fix(b);
  if (!a) return b;
  if (!b) return a;
  if (a->second > b->second) {
    a->r = merge(a->r, b);
    return fix(a);
  } else {
    b->l = merge(a, b->l);
    return fix(b);
  }
}
struct comp {
  long long cur_sum;
  int beg;
  long long treap_sum;
  treap t;
  void upd() { cur_sum = treap_sum + beg * 1ll * getSum(t); }
  void insert(int bi) {
    pair<treap, treap> p = split(t, bi);
    treap_sum += getSum(p.first) + getSiz(p.second) * 1ll * bi;
    t = merge(p.first, merge(new node(bi, rnd(), bi, 1, NULL, NULL), p.second));
    upd();
  }
  void fill_treap(treap t) {
    if (!t) return;
    insert(t->first);
    fill_treap(t->l);
    fill_treap(t->r);
  }
};
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.upd();
  return a;
}
set<int> free_pos;
const int N = 400043;
int p[N];
int siz[N];
comp cc[N];
long long start_sum = 0;
long long end_sum = 0;
int get(int first) {
  return (p[first] == first ? first : (p[first] = get(p[first])));
}
void merge(int first, int second) {
  first = get(first);
  second = get(second);
  if (first == second) return;
  if (siz[first] < siz[second]) swap(first, second);
  end_sum -= cc[first].cur_sum;
  end_sum -= cc[second].cur_sum;
  p[second] = first;
  siz[first] += siz[second];
  cc[first] = merge(cc[first], cc[second]);
  end_sum += cc[first].cur_sum;
}
void process(int ai, int bi) {
  start_sum += ai * 1ll * bi;
  int pos = *free_pos.lower_bound(ai);
  free_pos.erase(pos);
  siz[pos] = 1;
  p[pos] = pos;
  cc[pos].beg = pos;
  cc[pos].insert(bi);
  end_sum += cc[pos].cur_sum;
  if (!free_pos.count(pos - 1)) merge(pos, pos - 1);
  if (!free_pos.count(pos + 1)) merge(pos, pos + 1);
  printf("%lld\n", end_sum - start_sum);
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < N; i++) free_pos.insert(i);
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    process(a, b);
  }
  return 0;
}
