#include <bits/stdc++.h>
using namespace std;
long long in[200005], sum = 0, i, k[200005], n;
int main() {
  long long mx1 = 0, mx2 = 0, z;
  scanf("%I64d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%I64d %I64d", &in[i], &k[i]);
    sum += in[i];
    if (k[i] > mx1) {
      mx2 = mx1;
      mx1 = k[i];
    } else if (k[i] > mx2)
      mx2 = k[i];
  }
  for (i = 1; i <= n; i++) {
    if (k[i] == mx1)
      z = mx2;
    else
      z = mx1;
    printf("%I64d ", (sum - in[i]) * z);
  }
  return 0;
}
