#include <bits/stdc++.h>
using namespace std;
template <long long n>
struct DSU {
  array<long long, n> rank, parent;
  DSU() {
    fill(rank.begin(), rank.end(), 1);
    for (long long i = 0; i < n; ++i) parent[i] = i;
  }
  long long find(const long long u) {
    return parent[u] == u ? u : (parent[u] = find(parent[u]));
  }
  bool merge(long long u, long long v) {
    if ((u = find(u)) == (v = find(v))) return false;
    if (rank[u] < rank[v]) swap(u, v);
    rank[u] += rank[v];
    parent[v] = u;
    return true;
  }
  long long size(long long u) { return rank[find(u)]; }
};
long long ans = 0;
struct Trie {
  struct Node {
    long long cnt = 0;
    long long sum = 0;
    Node *adj[2] = {0, 0};
    ~Node() {
      for (auto &&x : adj)
        if (x) delete x;
    }
    pair<long long, long long> insert(const long long idx, const long long lo,
                                      const long long hi) {
      assert(lo <= idx && idx <= hi);
      cnt++;
      sum += idx;
      if (lo == hi) {
        assert(cnt == 1 && sum == idx);
        return {0, 0};
      } else {
        const long long mid = (lo + hi) >> 1;
        const bool bit = idx > mid;
        if (!adj[bit]) adj[bit] = new Node();
        if (!bit) return adj[0]->insert(idx, lo, mid);
        pair<long long, long long> res = adj[1]->insert(idx, mid + 1, hi);
        if (adj[0]) {
          res.first += adj[0]->cnt;
          res.second += adj[0]->sum;
        }
        return res;
      }
    }
    void retrieve(vector<long long> &res, const long long lo,
                  const long long hi) {
      if (lo == hi) {
        assert(cnt == 1 && sum == lo);
        res.push_back(lo);
      } else {
        const long long mid = (lo + hi) >> 1;
        if (adj[1]) adj[1]->retrieve(res, mid + 1, hi);
        if (adj[0]) adj[0]->retrieve(res, lo, mid);
      }
    }
  };
  long long n;
  Trie(const long long _n) : n(_n) { root = new Node(); }
  Node *root;
  pair<long long, long long> insert(const long long idx) {
    assert(1 <= idx && idx <= n);
    return root->insert(idx, 1, n);
  }
  vector<long long> retrieve() {
    vector<long long> res;
    root->retrieve(res, 1, n);
    return res;
  }
  Trie() { delete root; }
};
struct Comp {
  long long l, r;
  Trie trie;
  Comp(long long a, long long b) : trie((long long)4e5 + 5) {
    l = r = a;
    trie.insert(b);
  }
  Comp &merge(Comp &other) {
    assert(l == other.r + 1 || other.l == r + 1);
    if (cnt() < other.cnt()) {
      ans += sum() * other.cnt();
      ans -= other.sum() * cnt();
      return other.merge(*this);
    }
    l = min(l, other.l);
    r = max(r, other.r);
    for (auto &&x : other.trie.retrieve()) {
      pair<long long, long long> res = trie.insert(x);
      ans += res.second - res.first * x;
    }
    return *this;
  }
  long long sum() const { return trie.root->sum; }
  long long cnt() const {
    const long long res = r - l + 1;
    assert(res == trie.root->cnt);
    return res;
  }
};
DSU<(long long)4e5 + 4> dsu;
Comp *comps[(long long)4e5 + 4];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (comps[dsu.find(a)]) {
      ans += ((comps[dsu.find(a)]->r + 1 - a) * b);
      a = comps[dsu.find(a)]->r + 1;
    }
    assert(a == dsu.find(a));
    assert(!comps[a]);
    Comp *curr = comps[a] = new Comp(a, b);
    if (comps[dsu.find(a - 1)]) {
      curr = &comps[dsu.find(a - 1)]->merge(*curr);
      dsu.merge(a, a - 1);
      comps[dsu.find(a)] = curr;
    }
    if (comps[dsu.find(a + 1)]) {
      curr = &curr->merge(*comps[dsu.find(a + 1)]);
      dsu.merge(a, a + 1);
      comps[dsu.find(a)] = curr;
    }
    cout << ans << '\n';
  }
  return 0;
}
