#include <bits/stdc++.h>
using namespace std;
const int nax = 550;
int v[nax][nax], n, m, q;
int main() {
  m = 0;
  vector<int> v;
  cin >> n;
  int a[n][2];
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    v.push_back(a[i][1]);
    m += a[i][0];
  }
  sort(v.rbegin(), v.rend());
  int x = v[0], y = v[1];
  for (int i = 0; i < n; i++) {
    if (a[i][1] == v[0])
      cout << y * (m - a[i][0]) << ' ';
    else
      cout << x * (m - a[i][0]) << ' ';
  }
  return 0;
}
