#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 1023456789;
const unsigned long long BS1 = 10000019ULL;
const int INF = (1 << 29);
template <class T>
inline void fastScan(T &x) {
  register char c = getchar();
  int neg = 0;
  x = 0;
  for (; (c < 48 || c > 57) && (c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
long long ans[N * 3];
struct info {
  long long x, y;
  int idx;
} inp[N * 3], bad[N * 3], init[N * 3];
bool as(info a, info b) { return (a.x + b.y) < (a.y + b.x); }
int main() {
  int n, m;
  fastScan(n);
  fastScan(m);
  long long a = 0, b = 0;
  for (int i = 1; i <= n; i++) {
    fastScan(inp[i].x);
    fastScan(inp[i].y);
    inp[i].idx = i;
    init[i] = inp[i];
    b += inp[i].y;
  }
  sort(inp + 1, inp + n + 1, as);
  for (int i = 1; i <= m; i++) {
    fastScan(bad[i].x);
    fastScan(bad[i].y);
  }
  for (int i = 1; i <= n; i++) {
    ans[inp[i].idx] += inp[i].x * (n - i) + (b - inp[i].y);
    ans[inp[i].idx] += inp[i].y * (i - 1) + a;
    b -= inp[i].y;
    a += inp[i].x;
  }
  for (int i = 1; i <= m; i++) {
    long long mn = min(init[bad[i].x].x + init[bad[i].y].y,
                       init[bad[i].x].y + init[bad[i].y].x);
    ans[bad[i].x] -= mn;
    ans[bad[i].y] -= mn;
  }
  for (int i = 1; i <= n; i++) {
    printf("%lld%c", ans[i], (i == n ? '\n' : ' '));
  }
}
