#include <bits/stdc++.h>
using namespace std;
const int maxn = 300005;
pair<long long, long long> dif[maxn];
long long x[maxn], y[maxn], pref[maxn], suff[maxn], ans[maxn];
vector<int> adj[maxn];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld %lld", &x[i], &y[i]);
    dif[i] = {y[i] - x[i], i};
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  sort(dif + 1, dif + n + 1);
  for (int i = 1; i <= n; i++) {
    pref[i] = pref[i - 1] + y[dif[i].second];
  }
  for (int i = n; i >= 1; i--) {
    suff[i] = suff[i + 1] + x[dif[i].second];
  }
  for (int i = 1; i <= n; i++) {
    int u = dif[i].second;
    long long res =
        pref[i - 1] + suff[i + 1] + 1ll * (i - 1) * x[u] + 1ll * (n - i) * y[u];
    for (auto v : adj[u]) {
      res -= min(x[u] + y[v], x[v] + y[u]);
    }
    ans[u] = res;
  }
  for (int i = 1; i <= n; i++) {
    printf("%lld ", ans[i]);
  }
  return 0;
}
