#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 5;
const long long inf = 0x3f3f3f3f3f3f3f3fll;
struct TreeNode {
  long long ls, rs, sz, val, sumv, suma, key;
};
TreeNode t[maxn];
long long pol;
long long newnode(long long vv) {
  t[++pol].val = vv;
  t[pol].sumv = t[pol].suma = vv;
  t[pol].sz = 1;
  t[pol].key = rand();
  return pol;
}
void pushup(long long p) {
  t[p].sz = t[t[p].ls].sz + t[t[p].rs].sz + 1;
  t[p].sumv = t[t[p].ls].sumv + t[t[p].rs].sumv + t[p].val;
  t[p].suma = t[t[p].ls].suma + (t[t[p].ls].sz + 1ll) * t[t[p].rs].sumv +
              t[t[p].rs].suma + (t[t[p].ls].sz + 1ll) * t[p].val;
  return;
}
void split(long long now, long long &rx, long long &ry, long long k) {
  if (now == 0) {
    rx = ry = 0;
    return;
  }
  if (t[now].val >= k) {
    rx = now;
    split(t[now].rs, t[rx].rs, ry, k);
  } else if (t[now].val < k) {
    ry = now;
    split(t[now].ls, rx, t[ry].ls, k);
  }
  pushup(now);
  return;
}
long long merge(long long x, long long y) {
  if (!x || !y) return x + y;
  if (t[x].key < t[y].key) {
    t[x].rs = merge(t[x].rs, y);
    pushup(x);
    return x;
  } else {
    t[y].ls = merge(x, t[y].ls);
    pushup(y);
    return y;
  }
  return 0;
}
long long rx, ry, rz, rw;
long long ins(long long rt, long long vid) {
  long long vv = t[vid].val;
  split(rt, rx, ry, vv);
  rt = merge(merge(rx, vid), ry);
  return rt;
}
struct Node {
  long long l, r, num, id;
  bool friend operator<(Node n1, Node n2) {
    if (n1.l == n2.l) return n1.num < n2.num;
    return n1.l < n2.l;
  }
};
set<Node> se;
long long rt[maxn];
long long n;
long long a[maxn], b[maxn];
vector<long long> vtmp;
void dfs(long long now) {
  if (!now) return;
  dfs(t[now].ls);
  vtmp.push_back(now);
  dfs(t[now].rs);
  t[now].ls = t[now].rs = 0;
  t[now].suma = t[now].sumv = t[now].val;
  t[now].sz = 1;
  return;
}
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld %lld", &a[i], &b[i]);
    newnode(b[i]);
  }
  long long ans = 0, sum = 0;
  for (int i = 1; i <= n; i++) {
    sum += a[i] * b[i];
    set<Node>::iterator it = se.upper_bound((Node){a[i], a[i], inf, i});
    if (it == se.begin()) {
      se.insert((Node){a[i], a[i], 1, i});
      ans += a[i] * b[i];
    } else {
      it--;
      if ((it->r) >= a[i] - 1) {
        Node tmp = (*it);
        se.erase(it);
        ans -= (tmp.l - 1) * t[tmp.id].sumv + t[tmp.id].suma;
        tmp.r++;
        tmp.num++;
        tmp.id = ins(tmp.id, i);
        ans += (tmp.l - 1) * t[tmp.id].sumv + t[tmp.id].suma;
        se.insert(tmp);
      } else {
        se.insert((Node){a[i], a[i], 1, i});
        ans += a[i] * b[i];
      }
    }
    it = se.upper_bound((Node){a[i], a[i], inf, i});
    if (it == se.end()) {
      printf("%lld\n", ans - sum);
      continue;
    }
    set<Node>::iterator it2 = it;
    it2--;
    if ((it2->r) + 1 != (it->l)) {
      printf("%lld\n", ans - sum);
      continue;
    }
    Node tmp1 = (*it), tmp2 = (*it2);
    se.erase(it);
    se.erase(it2);
    vtmp.clear();
    ans -= (tmp1.l - 1) * t[tmp1.id].sumv + t[tmp1.id].suma;
    ans -= (tmp2.l - 1) * t[tmp2.id].sumv + t[tmp2.id].suma;
    Node tmp;
    tmp.l = tmp2.l, tmp.r = tmp1.r;
    if (t[tmp1.id].sz < t[tmp2.id].sz) swap(tmp1.id, tmp2.id);
    dfs(tmp2.id);
    tmp.id = tmp1.id;
    for (auto j : vtmp) {
      tmp.id = ins(tmp.id, j);
    }
    tmp.num = tmp1.num + tmp2.num;
    se.insert(tmp);
    ans += (tmp.l - 1) * t[tmp.id].sumv + t[tmp.id].suma;
    printf("%lld\n", ans - sum);
  }
  return 0;
}
