#include <bits/stdc++.h>
using namespace std;
const long long N = 300005, OO = 1110111110111, mod = 998244353;
long long n, m, sol[N], l, r, acc1[N], acc2[N], X[N], Y[N];
vector<pair<long long, long long> > v, V;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  scanf("%I64d%I64d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%I64d%I64d", &l, &r);
    X[i] = l;
    Y[i] = r;
    v.push_back({l, r});
    V.push_back({l - r, i});
  }
  for (int i = 0; i < m; i++) {
    long long T = 0;
    scanf("%I64d%I64d", &l, &r);
    l--;
    r--;
    if (X[l] + Y[r] < Y[l] + X[r])
      T = X[l] + Y[r];
    else
      T = Y[l] + X[r];
    sol[l] -= T;
    sol[r] -= T;
  }
  sort(V.begin(), V.end());
  acc1[0] = v[V[0].second].first;
  acc2[0] = v[V[0].second].second;
  for (int i = 1; i < n; i++) {
    acc1[i] = acc1[i - 1] + v[V[i].second].first;
    acc2[i] = acc2[i - 1] + v[V[i].second].second;
  }
  for (int i = 0; i < n; i++)
    sol[V[i].second] += i * v[V[i].second].second +
                        (n - i - 1) * v[V[i].second].first +
                        (i > 0 ? acc1[i - 1] : 0) + acc2[n - 1] - acc2[i];
  for (int i = 0; i < n; i++) printf("%I64d ", sol[i]);
  return 0;
}
