#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int i, j, k, n, m;
  cin >> n >> m;
  vector<long long> x(n), y(n);
  vector<pair<pair<long long, long long>, long long>> a(n);
  for (i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
    a[i] = {{x[i], y[i]}, i};
  }
  sort(a.begin(), a.end(),
       [&](const pair<pair<long long, long long>, long long> p,
           const pair<pair<long long, long long>, long long> q) {
         return (p.first.first - p.first.second) >
                (q.first.first - q.first.second);
       });
  vector<long long> prey(n), sufx(n);
  prey[0] = a[0].first.second;
  for (i = 1; i < n; ++i) prey[i] = prey[i - 1] + a[i].first.second;
  sufx[n - 1] = a[n - 1].first.first;
  for (i = n - 2; i >= 0; --i) sufx[i] = sufx[i + 1] + a[i].first.first;
  vector<long long> ans(n);
  for (i = 0; i < n; ++i) {
    ans[a[i].second] = i * a[i].first.first + (i - 1 >= 0 ? prey[i - 1] : 0);
    ans[a[i].second] +=
        (n - 1 - i) * a[i].first.second + (i + 1 < n ? sufx[i + 1] : 0);
  }
  69;
  69;
  for (i = 0; i < m; ++i) {
    cin >> j >> k;
    j--, k--;
    long long cost = min(x[j] + y[k], x[k] + y[j]);
    ans[j] -= cost;
    ans[k] -= cost;
  }
  for (auto x : ans) cout << x << " ";
  cout << "\n";
  return 0;
}
