#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
mt19937 rd(chrono::system_clock::now().time_since_epoch().count());
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
vector<int> g[300000];
long long x[300000], y[300000];
bool cmp(const int &i, const int &j) { return (y[i] - x[i] < y[j] - x[j]); }
long long get_ans(int i, int j) { return min(x[i] + y[j], y[i] + x[j]); }
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, m, i;
  cin >> n >> m;
  vector<int> ind(n);
  for (i = 0; i < n; i++) {
    ind[i] = i;
    cin >> x[i] >> y[i];
  }
  sort(ind.begin(), ind.end(), cmp);
  vector<long long> pref(n, 0), suf(n, 0);
  for (i = 1; i < n; i++) pref[i] = pref[i - 1] + y[ind[i - 1]];
  for (i = n - 2; i >= 0; i--) suf[i] = suf[i + 1] + x[ind[i + 1]];
  vector<long long> ans(n);
  for (i = 0; i < n; i++)
    ans[i] = x[ind[i]] * (long long)i + pref[i] +
             y[ind[i]] * (long long)(n - 1 - i) + suf[i];
  vector<int> ind1(n);
  for (i = 0; i < n; i++) ind1[ind[i]] = i;
  int v, u;
  for (i = 0; i < m; i++) {
    cin >> v >> u;
    v--, u--;
    ans[ind1[v]] -= get_ans(v, u);
    ans[ind1[u]] -= get_ans(v, u);
  }
  for (i = 0; i < n; i++) cout << ans[ind1[i]] << ' ';
}
