#include <bits/stdc++.h>
using namespace std;
const int Nmax = 3e5 + 100;
struct event {
  int x, y, id;
} a[Nmax];
int n, m, pos[Nmax];
int64_t psx[Nmax], psy[Nmax], res[Nmax];
bool cmp(event a, event b) { return a.x - a.y < b.x - b.y; }
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d", &a[i].x, &a[i].y);
    a[i].id = i;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; ++i) {
    psx[i] = psx[i - 1] + a[i].x;
    psy[i] = psy[i - 1] + a[i].y;
    pos[a[i].id] = i;
  }
  for (int i = 1; i <= n; ++i) {
    res[a[i].id] = psx[i - 1] + 1LL * (i - 1) * a[i].y;
    res[a[i].id] += psy[n] - psy[i] + 1LL * (n - i) * a[i].x;
  }
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    u = pos[u];
    v = pos[v];
    if (v < u) swap(u, v);
    res[a[u].id] -= a[v].y + a[u].x;
    res[a[v].id] -= a[u].x + a[v].y;
  }
  for (int i = 1; i <= n; ++i) {
    cout << res[i] << ' ';
  }
}
