#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
  return (y < x) ? (x = y, 1) : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return (y > x) ? (x = y, 1) : 0;
}
inline int read() {
  int x;
  char c;
  int f = 1;
  while ((c = getchar()) != '-' && (c > '9' || c < '0'))
    ;
  if (c == '-') f = -1, c = getchar();
  x = c ^ '0';
  while ((c = getchar()) >= '0' && c <= '9')
    x = (x << 1) + (x << 3) + (c ^ '0');
  return x * f;
}
inline long long readll() {
  long long x;
  char c;
  int f = 1;
  while ((c = getchar()) != '-' && (c > '9' || c < '0'))
    ;
  if (c == '-') f = -1, c = getchar();
  x = c ^ '0';
  while ((c = getchar()) >= '0' && c <= '9')
    x = (x << 1ll) + (x << 3ll) + (c ^ '0');
  return x * f;
}
const int maxn = 2e5 + 10;
long long ans;
int n, fa[maxn << 1], rt[maxn << 1], Le[maxn << 1];
bitset<maxn << 1> bit;
int find(int x) {
  if (fa[x] == x) return x;
  return fa[x] = find(fa[x]);
}
struct Segment_tree {
  int cnt;
  struct Tree {
    long long sum, Ans;
    int l, r, tot;
  } T[maxn * 40];
  inline void push_up(int x) {
    T[x].sum = T[T[x].l].sum + T[T[x].r].sum;
    T[x].tot = T[T[x].l].tot + T[T[x].r].tot;
    T[x].Ans = T[T[x].l].Ans + T[T[x].r].Ans + T[T[x].l].sum * T[T[x].r].tot;
  }
  void update(int &x, int L, int R, int q) {
    if (!x) x = ++cnt;
    if (L == R) {
      T[x].sum += L, T[x].tot++;
      return;
    }
    int Mid = (L + R) >> 1;
    if (q <= Mid)
      update(T[x].l, L, Mid, q);
    else
      update(T[x].r, Mid + 1, R, q);
    push_up(x);
  }
  int merge(int x, int y, int L, int R) {
    if (!x || !y) return x ^ y;
    if (L == R) {
      T[x].Ans += T[x].sum * T[y].tot + T[y].Ans;
      T[x].sum += T[y].sum;
      T[x].tot += T[y].tot;
    } else {
      int Mid = (L + R) >> 1;
      T[x].l = merge(T[x].l, T[y].l, L, Mid);
      T[x].r = merge(T[x].r, T[y].r, Mid + 1, R);
      push_up(x);
    }
    return x;
  }
} Seg;
inline void Merge(int x, int y) {
  x = find(x), y = find(y);
  ans -= Seg.T[rt[x]].Ans + (long long)Le[x] * Seg.T[rt[x]].sum;
  ans -= Seg.T[rt[y]].Ans + (long long)Le[y] * Seg.T[rt[y]].sum;
  fa[x] = y;
  Le[y] = Le[x];
  rt[y] = Seg.merge(rt[x], rt[y], 1, n);
  ans += Seg.T[rt[y]].Ans + (long long)Le[y] * Seg.T[rt[y]].sum;
}
int main() {
  n = read();
  for (register int i = 1, iend = maxn * 2 - 10; i <= iend; ++i)
    fa[i] = i, Le[i] = i;
  for (register int i = 1, iend = n; i <= iend; ++i) {
    int x = read(), y = read();
    ans -= (long long)x * y;
    if (bit[x]) x = find(x) + 1;
    bit[x] = 1;
    Seg.update(rt[x], 1, n, y);
    ans += Seg.T[rt[x]].Ans + (long long)x * y;
    if (bit[x - 1]) Merge(x - 1, x);
    if (bit[x + 1]) Merge(x, x + 1);
    printf("%lld\n", ans);
  }
  return 0;
}
