#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<long long, long long> a[200001];
  long long b[2] = {0};
  long long w = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    w = w + a[i].first;
    if (a[i].second > b[0]) {
      b[0] = a[i].second;
    }
    if (b[0] > b[1]) {
      swap(b[0], b[1]);
    }
  }
  for (int i = 0; i < n; i++) {
    long long ans = w - a[i].first;
    if (a[i].second != b[1]) {
      ans = ans * b[1];
    } else {
      ans = ans * b[0];
    }
    cout << ans << " ";
  }
}
