#include <bits/stdc++.h>
using namespace std;
struct triple {
  int id;
  long long a, b;
  triple() {}
  triple(int id, long long a, long long b) {
    this->id = id;
    this->a = a;
    this->b = b;
  }
  bool inline operator<(const triple c) const { return a - b < c.a - c.b; }
};
int n, m, a[300005], b[300005];
long long pre[300005], suf[300005], ans[300005];
triple dat[300005];
int inline read() {
  int res = 0, s = 1;
  char c = getchar();
  for (; !isdigit(c); s = c == '-' ? -1 : 1, c = getchar())
    ;
  for (; isdigit(c); res *= 10, res += c ^ 48, c = getchar())
    ;
  return res * s;
}
int main() {
  ios_base::sync_with_stdio(0);
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) {
    a[i] = read();
    b[i] = read();
    dat[i] = triple(i, a[i], b[i]);
  }
  sort(dat + 1, dat + n + 1);
  for (int i = 1; i <= n; ++i) {
    pre[i] = pre[i - 1] + dat[i].a;
    suf[n - i + 1] = suf[n - i + 2] + dat[n - i + 1].b;
  }
  for (int i = 1; i <= n; ++i) {
    ans[dat[i].id] =
        pre[i - 1] + dat[i].b * (i - 1) + suf[i + 1] + dat[i].a * (n - i);
  }
  for (int i = 1; i <= m; ++i) {
    int u = read(), v = read(), res = min(a[u] + b[v], a[v] + b[u]);
    ans[u] -= res;
    ans[v] -= res;
  }
  for (int i = 1; i <= n; ++i) {
    cout << ans[i] << ' ';
  }
}
