#include <bits/stdc++.h>
using namespace std;
pair<int, int> friends[200000];
pair<int, int> temp[200000];
int main() {
  int n;
  scanf("%d", &n);
  int total = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &friends[i].second, &friends[i].first);
    total += friends[i].second;
  }
  memcpy(temp, friends, n * sizeof(friends[0]));
  sort(temp, temp + n);
  for (int i = 0; i < n; i++) {
    cout << (friends[i].first == temp[n - 1].first ? temp[n - 2].first
                                                   : temp[n - 1].first) *
                (total - friends[i].second)
         << " ";
  }
  cout << endl;
}
