#include <bits/stdc++.h>
using namespace std;
int arr[200010], h[2][200010];
int main(void) {
  int n;
  scanf("%d", &n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    sum += arr[i];
    scanf("%d", &h[0][i]);
    h[1][i] = h[0][i];
  }
  sort(h[0], h[0] + n);
  for (int i = 0; i < n; i++) {
    printf("%I64d ", (sum - arr[i]) *
                         (h[0][n - 1] == h[1][i] ? h[0][n - 2] : h[0][n - 1]));
  }
  return 0;
}
