#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
int f[400135], R[400135], root[400135], cnt;
int sz[400135 * 20], ls[400135 * 20], rs[400135 * 20];
long long T[400135 * 20];
long long ans;
int ff(int x) { return x == f[x] ? x : f[x] = ff(f[x]); }
void Up(int x) {
  sz[x] = sz[ls[x]] + sz[rs[x]];
  T[x] = T[ls[x]] + T[rs[x]];
}
void upt(int& rt, int l, int r, int p) {
  if (rt == 0) rt = ++cnt;
  if (l == r) {
    sz[rt] = 1;
    T[rt] = p;
    return;
  }
  int mid = (l + r) / 2;
  if (p <= mid)
    upt(ls[rt], l, mid, p);
  else
    upt(rs[rt], mid + 1, r, p);
  Up(rt);
}
int mg(int x, int y) {
  if (x == 0) return y;
  if (y == 0) return x;
  ans -= T[ls[x]] * sz[rs[x]] + T[ls[y]] * sz[rs[y]];
  ls[x] = mg(ls[x], ls[y]);
  rs[x] = mg(rs[x], rs[y]);
  ans += T[ls[x]] * sz[rs[x]];
  sz[x] += sz[y];
  T[x] += T[y];
  return x;
}
void merge(int x, int y) {
  x = ff(x);
  y = ff(y);
  f[y] = x;
  ans -= T[root[x]] * x + T[root[y]] * y;
  root[x] = mg(root[x], root[y]);
  ans += T[root[x]] * x;
  R[x] = R[y];
}
void fmain(int tid) {
  scanf("%d", &n);
  for (int(i) = 1; (i) <= (int)(400135 - 1); (i)++) {
    f[i] = i;
    R[i] = i;
  }
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    int a, b;
    scanf("%d%d", &a, &b);
    int pos = root[a] ? R[ff(a)] + 1 : a;
    ans -= (long long)a * b;
    upt(root[pos], 1, n, b);
    ans += (long long)pos * b;
    if (root[pos - 1]) merge(pos - 1, pos);
    if (root[pos + 1]) merge(pos, pos + 1);
    printf("%lld\n", ans);
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
