#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = (int)3e5 + 7;
const int infint = (int)1e9;
const long long inf = (long long)1e18;
long long n, m, x[MAXN], y[MAXN], ans[MAXN], suf[MAXN], pre[MAXN];
pair<long long, long long> c[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    c[i] = {x[i] - y[i], i};
  }
  sort(c, c + n);
  for (int i = n - 1; i >= 0; i--) {
    suf[i] = y[c[i].second];
    suf[i] += suf[i + 1];
  }
  for (int i = 0; i < n; i++) {
    pre[i] = x[c[i].second];
    if (i) pre[i] += pre[i - 1];
  }
  for (int i = 0; i < n; i++) {
    ans[c[i].second] += (n - i - 1) * x[c[i].second] + suf[i + 1];
    ans[c[i].second] += i * y[c[i].second];
    if (i) ans[c[i].second] += pre[i - 1];
  }
  for (int i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    ans[a - 1] -= min(x[a - 1] + y[b - 1], x[b - 1] + y[a - 1]);
    ans[b - 1] -= min(x[a - 1] + y[b - 1], x[b - 1] + y[a - 1]);
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
}
