#include <bits/stdc++.h>
using namespace std;
const long long S = (1 << 19);
long long x, y, a, q, pref_x[S], pref_y[S], ans[S];
pair<long long, long long> tab[S];
vector<pair<pair<long long, long long>, pair<long long, long long> > > X;
int main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  cin >> a >> q;
  for (int i = 1; i <= a; i++) {
    cin >> x >> y;
    tab[i] = {x, y};
    X.push_back({{x - y, i}, {x, y}});
  }
  sort(X.begin(), X.end());
  for (int i = 1; i <= X.size(); i++)
    pref_x[i] = pref_x[i - 1] + X[i - 1].second.first,
    pref_y[i] = pref_y[i - 1] + X[i - 1].second.second;
  for (int i = 0; i < X.size(); i++) {
    ans[X[i].first.second] += pref_x[i] + i * X[i].second.second;
    ans[X[i].first.second] += pref_y[X.size()] - pref_y[i + 1] +
                              (X.size() - 1 - i) * X[i].second.first;
  }
  for (int i = 0; i < q; i++) {
    cin >> x >> y;
    long long res =
        min(tab[x].first + tab[y].second, tab[x].second + tab[y].first);
    ans[x] -= res;
    ans[y] -= res;
  }
  for (int i = 1; i <= X.size(); i++) cout << ans[i] << " ";
  return 0;
}
