#include <bits/stdc++.h>
using namespace std;
struct aux {
  long long d, ind;
} f[300005];
long long x[300005], y[300005];
bool cmp(aux a, aux b) { return a.d < b.d; }
long long ans[300005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  long long s1 = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld%lld", &x[i], &y[i]);
    f[i] = {x[i] - y[i], i};
    s1 += y[i];
  }
  sort(f + 1, f + n + 1, cmp);
  long long s = 0;
  for (int i = 1; i <= n; ++i) {
    ans[f[i].ind] = x[f[i].ind] * (n - i) + s1 + (i - 2) * y[f[i].ind] + s;
    s += x[f[i].ind];
    s1 -= y[f[i].ind];
  }
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    long long aux = min(x[u] + y[v], x[v] + y[u]);
    ans[u] -= aux;
    ans[v] -= aux;
  }
  for (int i = 1; i <= n; ++i) printf("%lld ", ans[i]);
  return 0;
}
