#include <bits/stdc++.h>
using namespace std;
int n, m;
long long x[300001], y[300001];
pair<long long, int> a[300001];
long long sumx, sumy, prex, prey;
long long ans[300001];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    sumx += x[i];
    sumy += y[i];
    a[i] = {x[i] - y[i], i};
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    int cur = a[i].second;
    ans[cur] =
        y[cur] * (i - 1) + x[cur] * (n - i) + prex + sumy - y[cur] - prey;
    prex += x[cur];
    prey += y[cur];
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    ans[u] -= min(x[u] + y[v], x[v] + y[u]);
    ans[v] -= min(x[u] + y[v], x[v] + y[u]);
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << endl;
}
