#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int n;
struct MAXX {
  int fmx;
  int smx;
  MAXX() { fmx = smx = 0; }
} ss;
int w[200500], h[200500];
int cMx[1050];
int sum = 0;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    w[i] = u;
    h[i] = v;
    sum += u;
    if (v > ss.fmx) {
      ss.smx = ss.fmx;
      ss.fmx = v;
    } else if (v > ss.smx) {
      ss.smx = v;
    }
    cMx[v]++;
  }
  for (int i = 0; i < n; ++i) {
    if (h[i] == ss.fmx) {
      if (cMx[ss.fmx] > 1) {
        cout << ss.fmx * (sum - w[i]) << " ";
      } else {
        cout << ss.smx * (sum - w[i]) << " ";
      }
    } else {
      cout << ss.fmx * (sum - w[i]) << " ";
    }
  }
  return 0;
}
