#include <bits/stdc++.h>
using namespace std;
int n, m;
long long int first = 0;
long long int second = 0;
long long int score[300005][2] = {0};
int conflict[300005][2] = {0};
vector<int> sequence;
vector<long long int> result;
vector<long long int> minu;
bool compare(int a, int b) {
  return score[a][0] + score[b][1] < score[a][1] + score[b][0];
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) scanf("%I64d%I64d", &score[i][0], &score[i][1]);
  for (int i = 0; i < m; ++i) scanf("%d%d", &conflict[i][0], &conflict[i][1]);
  for (int i = 0; i < n; ++i) {
    result.push_back(0);
    minu.push_back(0);
    sequence.push_back(i);
  }
  for (int i = 0; i < m; ++i) {
    int index_one = conflict[i][0] - 1;
    int index_two = conflict[i][1] - 1;
    if (score[index_one][0] + score[index_two][1] <
        score[index_one][1] + score[index_two][0]) {
      minu[index_one] += score[index_one][0] + score[index_two][1];
      minu[index_two] += score[index_one][0] + score[index_two][1];
    } else {
      minu[index_one] += score[index_one][1] + score[index_two][0];
      minu[index_two] += score[index_one][1] + score[index_two][0];
    }
  }
  sort(sequence.begin(), sequence.end(), compare);
  for (int i = 1; i < n; ++i) second += score[sequence[i]][1];
  for (int i = 0; i < n; ++i) {
    int index = sequence[i];
    result[index] =
        first + score[index][1] * i + second + score[index][0] * (n - i - 1);
    first += score[index][0];
    if (i + 1 < n) second -= score[sequence[i + 1]][1];
  }
  for (int i = 0; i < n; ++i) cout << result[i] - minu[i] << ' ';
  return 0;
}
