#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void cmax(int &x, const int &y) { x = x > y ? x : y; }
void cmin(int &x, const int &y) { x = x < y ? x : y; }
template <class T>
istream &operator>>(istream &in, vector<T> &V) {
  for (auto &x : V) in >> x;
  return in;
}
template <class T>
ostream &operator<<(ostream &out, const vector<T> &V) {
  for (auto x : V) out << x << ' ';
  return out;
}
template <class T>
void sort(vector<T> &V) {
  sort(V.begin(), V.end());
}
template <class T>
void reverse(vector<T> &V) {
  reverse(V.begin(), V.end());
}
template <class T>
int SZ(const vector<T> &V) {
  return (int)V.size();
}
void debug() { cerr << "whxorz" << '\n'; }
const int N = 4e5 + 5;
const int T = N * 30;
int rt[N];
int ls[T], rs[T], sz[T];
ll sum[T];
void pushup(int p) {
  sum[p] = sum[ls[p]] + sum[rs[p]];
  sz[p] = sz[ls[p]] + sz[rs[p]];
}
int newnode() {
  static int _ = 1;
  ls[_] = rs[_] = 0;
  sz[_] = 0;
  sum[_] = 0;
  return _++;
}
void update(int &p, int l, int r, int x) {
  if (!p) p = newnode();
  if (l == r) {
    sum[p] = x;
    sz[p] = 1;
    return;
  }
  int mid = l + r >> 1;
  if (x <= mid)
    update(ls[p], l, mid, x);
  else
    update(rs[p], mid + 1, r, x);
  pushup(p);
}
ll ans = 0;
int merge(int x, int y) {
  if (!x) return y;
  if (!y) return x;
  ans -= sum[ls[x]] * sz[rs[x]];
  ans -= sum[ls[y]] * sz[rs[y]];
  ls[x] = merge(ls[x], ls[y]);
  rs[x] = merge(rs[x], rs[y]);
  ans += sum[ls[x]] * sz[rs[x]];
  sz[x] += sz[y];
  sum[x] += sum[y];
  return x;
}
int n, a[N], b[N];
int fa[N], R[N];
int find(const int &x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
void Merge(int x, int y) {
  x = find(x), y = find(y);
  fa[y] = x;
  ans -= sum[rt[x]] * x;
  ans -= sum[rt[y]] * y;
  rt[x] = merge(rt[x], rt[y]);
  ans += sum[rt[x]] * x;
  R[x] = R[y];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
  for (int i = 1; i < N; i++) {
    fa[i] = i;
    R[i] = i;
  }
  for (int i = 1; i <= n; i++) {
    int A = a[i];
    int B = b[i];
    int p = rt[A] ? R[find(A)] + 1 : A;
    ans -= 1ll * A * B;
    update(rt[p], 1, n, B);
    ans += 1ll * p * B;
    if (rt[p - 1]) Merge(p - 1, p);
    if (rt[p + 1]) Merge(p, p + 1);
    cout << ans << '\n';
  }
  return 0;
}
