#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s = 0, m1 = 0, m2 = 0, w, m;
  cin >> n;
  vector<pair<int, int> > d(n);
  for (int i = 0; i < n; i++) {
    cin >> d[i].first >> d[i].second;
    s += d[i].first;
    if (d[i].second >= m2) {
      m1 = m2;
      m2 = d[i].second;
    }
    if (d[i].second < m2 && d[i].second >= m1) m1 = d[i].second;
  }
  for (int i = 0; i < n; i++) {
    w = s - d[i].first;
    if (d[i].second == m2)
      m = m1;
    else
      m = m2;
    cout << w * m << " ";
  }
}
