#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
const int maxn = 1e6 + 7;
int n;
int m;
vector<pair<long long, long long>> v;
vector<pair<long long, int>> vals;
vector<pair<long long, long long>> no;
vector<long long> prefx;
vector<long long> prefy;
vector<long long> ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
    vals.push_back({(v[i].first - v[i].second), i});
  }
  sort(vals.begin(), vals.end());
  no.resize(m);
  for (int i = 0; i < m; i++) {
    cin >> no[i].first >> no[i].second;
    --no[i].first;
    --no[i].second;
  }
  prefx.assign(n + 1, 0LL);
  prefy.assign(n + 1, 0LL);
  for (int i = 1; i <= n; i++) {
    int idx = vals[i - 1].second;
    prefx[i] = prefx[i - 1] + v[idx].first;
    prefy[i] = prefy[i - 1] + v[idx].second;
  }
  ans.assign(n, 0LL);
  for (int i = 0; i < n; i++) {
    long long diff = v[i].first - v[i].second;
    auto it = upper_bound(vals.begin(), vals.end(), make_pair(diff, n + 1));
    int other = (it - vals.begin());
    int larger = n - other;
    ans[i] += v[i].first * larger;
    ans[i] += prefy[n] - prefy[n - larger];
    ans[i] += prefx[other];
    ans[i] += v[i].second * other;
    ans[i] -= (v[i].first + v[i].second);
  }
  for (int i = 0; i < m; i++) {
    int pp1 = no[i].first;
    int pp2 = no[i].second;
    long long diff1 = v[pp1].first - v[pp1].second;
    long long diff2 = v[pp2].first - v[pp2].second;
    long long takeaway = 0LL;
    if (diff1 < diff2) {
      takeaway = v[pp1].first + v[pp2].second;
    } else {
      takeaway = v[pp2].first + v[pp1].second;
    }
    ans[pp1] -= takeaway;
    ans[pp2] -= takeaway;
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << "\n";
  return 0;
}
