#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> a(300005, 0), b(300005, 0), ans(300005, 0);
vector<long long> sa(300005, 0), sb(300005, 0);
vector<pair<long long, long long> > v;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TESTS = 1;
  while (TESTS--) {
    long long n, m;
    cin >> n >> m;
    for (long long i = 0; i < n; i++) {
      long long x, y;
      cin >> a[i] >> b[i];
      v.push_back({a[i] - b[i], i});
    }
    sort((v).begin(), (v).end());
    for (long long i = 0; i < n; i++) {
      sa[i] = a[v[i].second];
      sb[i] = b[v[i].second];
      if (i) sa[i] += sa[i - 1], sb[i] += sb[i - 1];
    }
    for (long long i = 0; i < n; i++) {
      ans[v[i].second] = i * b[v[i].second] + (n - 1 - i) * a[v[i].second];
      if (i) ans[v[i].second] += sa[i - 1];
      ans[v[i].second] += sb[n - 1] - sb[i];
    }
    for (long long i = 0; i < m; i++) {
      long long x, y;
      cin >> x >> y;
      x--, y--;
      long long mn = min(a[x] + b[y], a[y] + b[x]);
      ans[x] -= mn;
      ans[y] -= mn;
    }
    for (long long i = 0; i < n; i++) cout << ans[i] << " ";
  }
  return 0;
}
