#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n), y(n);
  vector<pair<int, int> > c(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    c[i].first = x[i] - y[i];
    c[i].second = i;
  }
  sort(c.begin(), c.end());
  vector<long long> prefx(n), prefy(n);
  prefx[0] = x[c[0].second];
  prefy[0] = y[c[0].second];
  for (int i = 1; i < n; i++) {
    prefx[i] = prefx[i - 1] + x[c[i].second];
    prefy[i] = prefy[i - 1] + y[c[i].second];
  }
  vector<long long> ans(n);
  for (int i = 0; i < n; i++) {
    ans[c[i].second] +=
        prefy[n - 1] - prefy[i] + x[c[i].second] * 1ll * (n - i - 1);
    if (i != 0) {
      ans[c[i].second] += prefx[i - 1] + y[c[i].second] * 1ll * i;
    }
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    int mn = min(x[u] + y[v], x[v] + y[u]);
    ans[u] -= mn;
    ans[v] -= mn;
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << ' ';
  }
  return 0;
}
