#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1000001;
int dx[8] = {1, 0, 0, -1, 1, -1, 1, -1};
int dy[8] = {0, 1, -1, 0, 1, -1, -1, 1};
int main() {
  cin.tie(0);
  cout.tie(0);
  std::ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long w, h, W = 0;
  vector<pair<long long, long long> > v;
  vector<long long> vh;
  long long mxh = 0;
  for (int i = 0; i < n; i++) {
    cin >> w >> h;
    W += w;
    v.push_back(make_pair(w, h));
    vh.push_back(h);
    mxh = max(mxh, h);
  }
  sort(vh.begin(), vh.end());
  long long mxhh = vh[vh.size() - 2];
  long long ans;
  for (int i = 0; i < n; i++) {
    ans = 0;
    if (v[i].second != mxh) {
      ans = (W - v[i].first) * mxh;
    } else if (v[i].second == mxh) {
      ans = (W - v[i].first) * mxhh;
    }
    cout << ans << " ";
  }
  return 0;
}
