#include <bits/stdc++.h>
using namespace std;
long long prx[300100];
long long pry[300100];
long long sum[300100];
vector<pair<long long, long long> > v;
pair<long long, long long> arr[300100];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, m;
  cin >> n >> m;
  long long a, b;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    arr[i] = make_pair(a, b);
    long long d = a - b;
    v.push_back(make_pair(d, i));
  }
  sort(v.begin(), v.end());
  long long suma;
  for (int i = 1; i <= n; i++) {
    prx[i] = prx[i - 1] + arr[v[i - 1].second].first;
    pry[i] = pry[i - 1] + arr[v[i - 1].second].second;
  }
  for (int i = 1; i <= n; i++) {
    long long j = v[i - 1].second;
    sum[j] = ((arr[j].first) * (n - i) + pry[n] - pry[i]) +
             ((arr[j].second) * (i - 1) + prx[i - 1]);
  }
  for (int i = 1; i <= m; i++) {
    long long j, k;
    cin >> j >> k;
    long long ja, jb;
    ja = arr[j].first + arr[k].second;
    jb = arr[j].second + arr[k].first;
    sum[j] -= min(ja, jb);
    sum[k] -= min(ja, jb);
  }
  for (int i = 1; i <= n; i++) {
    cout << sum[i] << " ";
  }
  return 0;
}
