#include <bits/stdc++.h>
using namespace std;
const long long INFll = 1ll * 1000000100 * 1000000100;
const long double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
int main() {
  int n, m;
  cin >> n >> m;
  vector<pair<long long, long long> > a(n);
  vector<pair<long long, long long> > b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    b[i].first = a[i].first - a[i].second;
    b[i].second = i;
  }
  sort(b.begin(), b.end());
  vector<long long> ans(n);
  long long postsum = 0, presum = 0;
  for (int i = 0; i < n; i++) postsum += a[i].second;
  for (int i = 0; i < n; i++) {
    postsum -= a[b[i].second].second;
    ans[b[i].second] = presum + postsum + 1ll * i * a[b[i].second].second +
                       1ll * (n - 1 - i) * a[b[i].second].first;
    presum += a[b[i].second].first;
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    long long temp = min(a[u].first + a[v].second, a[u].second + a[v].first);
    ans[u] -= temp;
    ans[v] -= temp;
  }
  for (auto it = ans.begin(); it != ans.end(); ++it) cout << *it << ' ';
  cout << endl;
  ;
}
