#include <bits/stdc++.h>
using namespace std;
long long x[300005], y[300005];
vector<long long> v[300005];
long long ans[300005];
int main() {
  long long i, j, k;
  long long n, m;
  scanf("%lld", &n);
  scanf("%lld", &m);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &x[i]);
    scanf("%lld", &y[i]);
  }
  while (m--) {
    scanf("%lld", &i);
    scanf("%lld", &j);
    v[i].push_back(j);
    v[j].push_back(i);
  }
  long long sum = 0;
  for (i = 1; i <= n; i++) sum += x[i];
  for (i = 1; i <= n; i++) ans[i] += (sum - x[i]) + x[i] * (n - 1);
  for (i = 1; i <= n; i++) {
    for (j = 0; j < v[i].size(); j++) {
      ans[i] -= x[i] + x[v[i][j]];
    }
  }
  vector<pair<long long, long long> > vec;
  for (i = 1; i <= n; i++) {
    y[i] = y[i] - x[i];
    vec.push_back(make_pair(y[i], i));
  }
  sort(vec.begin(), vec.end());
  sum = 0;
  for (i = 0; i < n; i++) {
    ans[vec[i].second] += (n - i - 1) * vec[i].first + sum;
    sum += vec[i].first;
  }
  for (i = 1; i <= n; i++) {
    for (j = 0; j < v[i].size(); j++) {
      ans[i] -= min(y[i], y[v[i][j]]);
    }
  }
  for (i = 1; i <= n; i++) printf("%lld ", ans[i]);
  printf("\n");
}
