#include <bits/stdc++.h>
using namespace std;
pair<pair<int, int>, int> datas[200005];
int hasil[200005];
int main() {
  int n;
  scanf("%d", &n);
  int total = 0;
  for (int a = 0; a < n; a++) {
    scanf("%d%d", &datas[a].first.second, &datas[a].first.first);
    datas[a].second = a;
    total += datas[a].first.second;
  }
  sort(datas, datas + n);
  for (int a = n - 1; a >= 0; a--) {
    if (a != n - 1)
      hasil[datas[a].second] =
          (total - datas[a].first.second) * datas[n - 1].first.first;
    else
      hasil[datas[a].second] =
          (total - datas[a].first.second) * datas[a - 1].first.first;
  }
  for (int a = 0; a < n; a++) {
    if (a > 0) printf(" ");
    printf("%d", hasil[a]);
  }
  return 0;
}
