#include <bits/stdc++.h>
using namespace std;
string a;
int main() {
  int n;
  cin >> n;
  long long Sum = 0;
  int x, y;
  int a[n], b[n], c[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    c[i] = b[i];
    Sum += a[i];
  }
  sort(c, c + n);
  long long Max1 = c[n - 1];
  long long Max2 = c[n - 2];
  for (int i = 0; i < n; i++) {
    if (b[i] == Max1)
      cout << Max2 * (Sum - a[i]) << " ";
    else
      cout << Max1 * (Sum - a[i]) << " ";
  }
  return 0;
}
