#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  long long x[n], y[n];
  vector<pair<long long, int> > v;
  vector<vector<int> > adj(n + 1);
  for (int i = 0; i < n; ++i) {
    scanf("%I64d %I64d", &x[i], &y[i]);
    v.push_back({y[i] - x[i], i});
  }
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a;
    --b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  sort(v.begin(), v.end());
  long long ans[n];
  ans[v[0].second] = 0;
  long long sum = y[v[0].second];
  for (int i = 1; i < n; ++i) {
    ans[v[i].second] = sum + x[v[i].second] * i * 1ll;
    sum += y[v[i].second];
  }
  sum = x[v[n - 1].second];
  for (int i = n - 2; i >= 0; --i) {
    ans[v[i].second] += sum + y[v[i].second] * ((n - 1) - (i)) * 1ll;
    sum += x[v[i].second];
  }
  for (int i = 0; i < n; ++i) {
    for (auto &j : adj[i]) ans[i] -= min(x[i] + y[j], x[j] + y[i]);
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  return 0;
}
