#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, m;
  cin >> n >> m;
  vector<pair<long long, long long>> vec(n);
  vector<long long> ans(n);
  vector<pair<long long, long long>> dif;
  long long preffix = 0, suffix = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> vec[i].first >> vec[i].second;
    dif.push_back({vec[i].second - vec[i].first, i});
    suffix += vec[i].first;
  }
  sort(dif.begin(), dif.end());
  for (long long i = 0; i < m; ++i) {
    long long a, b;
    cin >> a >> b;
    --a;
    --b;
    long long x =
        min(vec[a].first + vec[b].second, vec[a].second + vec[b].first);
    ans[a] -= x;
    ans[b] -= x;
  }
  for (long long i = 0; i < n; ++i) {
    long long u = dif[i].second;
    suffix -= vec[u].first;
    ans[u] += preffix + suffix + i * vec[u].first + (n - i - 1) * vec[u].second;
    preffix += vec[u].second;
  }
  for (auto i : ans) {
    cout << i << " ";
  }
}
