#include <bits/stdc++.h>
using namespace std;
void solve(vector<pair<int, int>> arr) {
  int n = arr.size(), sum = 0;
  for (int i = 0; i < n; i++) sum += arr[i].first;
  int mh = max(arr[0].second, arr[1].second),
      sh = min(arr[0].second, arr[1].second),
      mi = arr[0].second > arr[1].second ? 0 : 1;
  for (int i = 2; i < n; i++) {
    if (arr[i].second < sh) continue;
    if (arr[i].second >= mh) {
      sh = mh;
      mh = arr[i].second;
      mi = i;
    } else
      sh = arr[i].second;
  }
  for (int i = 0; i < n; i++) {
    if (i == mi)
      cout << (sum - arr[i].first) * sh << endl;
    else
      cout << (sum - arr[i].first) * mh << endl;
  }
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> arr;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    arr.push_back({a, b});
  }
  solve(arr);
}
