#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e18 + 7;
const long long mod = 1e9 + 7;
const double eps = 1e-9;
const double PI = 2 * acos(0.0);
pair<long long, int> h[2000000];
long long w[2000000];
int main() {
  int n;
  cin >> n;
  long long t = 0;
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> h[i].first;
    h[i].second = i;
    t += w[i];
  }
  sort(h, h + n);
  for (int i = 0; i < n; i++) {
    long long x = t - w[i], y = 0;
    if (h[n - 1].second == i)
      y = h[n - 2].first;
    else
      y = h[n - 1].first;
    cout << y * x << endl;
  }
}
