#include <bits/stdc++.h>
using namespace std;
int n, m;
const int N = 4e5;
int x[N], y[N];
long long ans[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
  }
  vector<pair<int, int> > a;
  for (int i = 1; i <= n; i++) a.push_back(make_pair(x[i] - y[i], i));
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int cnt = 0;
  long long sumy = 0;
  for (auto it : a) {
    ans[it.second] += sumy + 1ll * cnt * x[it.second];
    sumy += y[it.second];
    cnt++;
  }
  long long sumx = 0;
  cnt = 0;
  for (auto it = a.rbegin(); it != a.rend(); it++) {
    auto p = *it;
    ans[p.second] += sumx + 1ll * cnt * y[p.second];
    sumx += x[p.second];
    cnt++;
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    int cst = min(x[u] + y[v], x[v] + y[u]);
    ans[u] -= cst;
    ans[v] -= cst;
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << "\n";
  return 0;
}
