#include <bits/stdc++.h>
using namespace std;
int const N = 1e6 + 5;
int const md = 1e9 + 7;
int n, m, i, j;
int ans, x, y, z, k, h[N], a[N], t, tp;
multiset<int> s;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> h[i];
    z += a[i];
    s.insert(h[i]);
  }
  for (i = 0; i < n; i++) {
    s.erase(s.find(h[i]));
    int k = *s.rbegin();
    cout << (z - a[i]) * k << " ";
    s.insert(h[i]);
  }
}
