#include <bits/stdc++.h>
using namespace std;
int a[1001];
int main() {
  int n;
  cin >> n;
  int sum = 0, w[n], h[n];
  for (int i = 1; i <= n; i++) {
    cin >> w[i] >> h[i];
    sum += w[i];
    a[h[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    int help = 1000;
    a[h[i]]--;
    while (!a[help]) {
      help--;
    }
    a[h[i]]++;
    cout << (sum - w[i]) * help << " ";
  }
}
