#include <bits/stdc++.h>
using namespace std;
const int SIZE = 3e5 + 1;
pair<int, int> P[SIZE];
vector<int> Adlist[SIZE];
long long TA1[SIZE], TA2[SIZE];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<pair<int, int> > V;
  for (int i = 1; i <= N; i++) {
    cin >> P[i].first >> P[i].second;
    V.push_back(make_pair(P[i].first - P[i].second, i));
  }
  stable_sort(V.begin(), V.end());
  while (M--) {
    int a, b;
    cin >> a >> b;
    Adlist[a].push_back(b);
    Adlist[b].push_back(a);
  }
  for (int i = 1; i <= N; i++) {
    int aux = V[i - 1].second;
    TA1[i] = TA1[i - 1] + P[aux].first;
    TA2[i] = TA2[i - 1] + P[aux].second;
  }
  vector<long long> SOL(N + 1);
  for (int i = 1; i <= N; i++) {
    int aux = V[i - 1].second;
    SOL[aux] = 1LL * P[aux].first * (N - i) + (TA2[N] - TA2[i]);
    SOL[aux] += TA1[i - 1] + 1LL * P[aux].second * (i - 1);
  }
  for (int i = 1; i <= N; i++)
    for (int j : Adlist[i])
      SOL[i] -= min(P[i].first + P[j].second, P[i].second + P[j].first);
  for (int i = 1; i <= N; i++) cout << SOL[i] << ' ';
  cout << '\n';
  return 0;
}
