#include <bits/stdc++.h>
using namespace std;
int n, w[1000003], h[1000003], mx1 = 0, mx2 = -1, cnt;
int main() {
  scanf("%d", &(n));
  int s = 0;
  for (int(i) = (0); (i) < (n); (i)++) {
    scanf("%d%d", &(w[i]), &(h[i]));
    s += w[i];
    mx1 = max(mx1, h[i]);
  }
  for (int(i) = (0); (i) < (n); (i)++) {
    if (h[i] != mx1)
      mx2 = max(mx2, h[i]);
    else
      ++cnt;
  }
  if (mx2 == -1) mx2 = mx1;
  for (int(i) = (0); (i) < (n); (i)++) {
    int ans = s - w[i];
    if (h[i] != mx1 || cnt > 1)
      ans *= mx1;
    else {
      ans *= mx2;
    }
    printf("%d ", ans);
  }
  printf("\n");
  return 0;
}
