#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 50;
const int M = 1e6;
const int oo = 1e9;
const int mod = 1e9 + 7;
long long x[N], y[N], px[N], py[N], ans[N];
pair<long long, long long> p[N];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &x[i], &y[i]);
    p[i] = {x[i] - y[i], i};
  }
  sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; i++) {
    px[i] = px[i - 1] + x[p[i].second];
    py[i] = py[i - 1] + y[p[i].second];
  }
  for (int i = 1; i <= n; i++) {
    int id = p[i].second;
    ans[id] = (i - 1) * y[id] + px[i - 1] + (n - i) * x[id] + py[n] - py[i];
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    long long def = min(x[u] + y[v], x[v] + y[u]);
    ans[u] -= def;
    ans[v] -= def;
  }
  for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
  printf("\n");
}
