#include <bits/stdc++.h>
using namespace std;
const int N = 300100;
pair<pair<int, int>, int> a[N];
pair<int, int> e[N];
long long ans[N];
bool comp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return (a.first.first - a.first.second < b.first.first - b.first.second);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first.first >> a[i].first.second;
    a[i].second = i;
  }
  for (int i = 0; i < m; i++) {
    cin >> e[i].first >> e[i].second;
    e[i].first--, e[i].second--;
  }
  for (int i = 0; i < m; i++) {
    int u = e[i].first, v = e[i].second;
    long long t = min(a[u].first.first + a[v].first.second,
                      a[u].first.second + a[v].first.first);
    ans[u] -= t, ans[v] -= t;
  }
  sort(a, a + n, comp);
  long long sum(0);
  for (int i = 0; i < n; i++) {
    ans[a[i].second] += sum + (1LL * i * a[i].first.second);
    sum += 1LL * a[i].first.first;
  }
  sum = 0;
  for (int i = n - 1; i >= 0; i--) {
    ans[a[i].second] += sum + (1LL * (n - 1 - i) * a[i].first.first);
    sum += 1LL * a[i].first.second;
  }
  for (int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}
