#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
long long sx[N], sy[N];
struct person {
  long long x, y, i;
} p[N];
vector<int> adj[N];
bool operator<(const person &a, const person &b) {
  return a.x - a.y < b.x - b.y;
}
long long ans[N], psx[N], psy[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld", &p[i].x, &p[i].y), p[i].i = i;
    sx[i] = p[i].x;
    sy[i] = p[i].y;
  }
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[--u].push_back(--v);
    adj[v].push_back(u);
  }
  sort(p, p + n);
  for (int i = 0; i < n; ++i) {
    psx[i] = p[i].x + (i == 0 ? 0 : psx[i - 1]);
    psy[i] = p[i].y + (i == 0 ? 0 : psy[i - 1]);
  }
  for (int i = 0; i < n; ++i) {
    ans[p[i].i] = (psy[n - 1] - psy[i] + p[i].x * (n - 1 - i)) +
                  (i == 0 ? 0 : psx[i - 1] + p[i].y * i);
    for (int j : adj[p[i].i])
      ans[p[i].i] -= min(p[i].x + sy[j], p[i].y + sx[j]);
  }
  for (int i = 0; i < n; ++i) printf("%lld ", ans[i]);
  return 0;
}
