#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
int x[N], y[N], ord[N];
long long ans[N], prefX[N], prefY[N];
bool cmp(int i, int j) { return x[i] - y[i] < x[j] - y[j]; }
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    ord[i] = i;
    scanf("%d%d", x + i, y + i);
  }
  sort(ord, ord + n, cmp);
  prefX[0] = prefY[0] = 0;
  for (int i = 0; i < n; ++i) {
    prefX[i + 1] = prefX[i] + x[ord[i]];
    prefY[i + 1] = prefY[i] + y[ord[i]];
  }
  for (int i = 0; i < n; ++i)
    ans[ord[i]] = x[ord[i]] * 1LL * (n - i - 1) + prefY[n] - prefY[i + 1] +
                  y[ord[i]] * 1LL * i + prefX[i];
  while (m--) {
    static int u, v;
    scanf("%d%d", &u, &v);
    --u;
    --v;
    static int mark;
    mark = min(x[u] + y[v], x[v] + y[u]);
    ans[u] -= mark;
    ans[v] -= mark;
  }
  for (int i = 0; i < n; ++i) printf("%lld ", ans[i]);
}
