#include <bits/stdc++.h>
using namespace std;
long long h[1000000], w[1000000];
int main() {
  long long n, sum = 0, m1 = 0, m2 = 0;
  cin >> n;
  for (int i(0); i < n; i++) {
    int x, y;
    cin >> x >> y;
    sum += x;
    if (y > m1) {
      m2 = m1;
      m1 = y;
    } else if (y > m2)
      m2 = y;
    h[i] = y;
    w[i] = x;
  }
  for (int i(0); i < n; i++) {
    long long s = sum - w[i];
    if (m1 == h[i])
      s = s * m2;
    else
      s = s * m1;
    cout << s << " ";
  }
}
