#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long sum = 0;
  cin >> n;
  vector<pair<int, int> > vp(n + 1);
  priority_queue<int> pq;
  for (int i = 0; i < n; i++) {
    cin >> vp[i].first >> vp[i].second;
    sum += vp[i].first;
    pq.push(vp[i].second);
  }
  for (int i = 0; i < n; i++) {
    if (vp[i].second == pq.top()) {
      int temp = pq.top();
      pq.pop();
      sum -= vp[i].first;
      cout << sum * pq.top() << " ";
      sum += vp[i].first;
      pq.push(temp);
    } else {
      sum -= vp[i].first;
      cout << sum * pq.top() << " ";
      ;
      sum += vp[i].first;
    }
  }
}
