#include <bits/stdc++.h>
using namespace std;
struct c {
  long long f, s, i;
};
bool com(c a, c b) { return (a.f + b.s < a.s + b.f); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, m, u, v;
  cin >> n >> m;
  vector<c> cp(n);
  for (i = 0; i < n; i++) {
    cin >> cp[i].f >> cp[i].s;
    cp[i].i = i;
  }
  vector<c> wp(cp);
  sort(cp.begin(), cp.end(), com);
  vector<pair<long long, long long> > pre(n + 1, make_pair(0ll, 0ll));
  for (i = 0; i < n; i++) {
    pre[i + 1].first = pre[i].first + cp[i].f;
    pre[i + 1].second = pre[i].second + cp[i].s;
  }
  long long ans[n];
  for (i = 0; i < n; i++) {
    ans[cp[i].i] = i * cp[i].s + pre[i].first + (n - i - 1) * cp[i].f +
                   pre[n].second - pre[i + 1].second;
  }
  while (m--) {
    cin >> u >> v;
    long long val = com(wp[u - 1], wp[v - 1]) ? wp[u - 1].f + wp[v - 1].s
                                              : wp[u - 1].s + wp[v - 1].f;
    ans[u - 1] -= val;
    ans[v - 1] -= val;
  }
  for (i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
