#include <bits/stdc++.h>
using namespace std;
const long long CMOD = 998244353LL;
const double PI = 3.14159265359;
const double eps = 1e-7;
long long add(long long x, long long y, long long MOD = CMOD) {
  return (x + y + 2 * MOD) % MOD;
}
long long mult(long long x, long long y, long long MOD = CMOD) {
  return (add(x, 0) * add(y, 0)) % MOD;
}
long long fast_expo(long long x, long long y, long long MOD = CMOD) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  long long res = 1;
  long long mid = fast_expo(x, y / 2, MOD);
  if (y % 2 != 0) res = x;
  return mult(mult(mid, mid, MOD), res, MOD);
}
long long inver(long long x, long long MOD = CMOD) {
  return fast_expo(x, MOD - 2);
}
long long gcd(long long e1, long long e2) {
  if (e2 == 0) return e1;
  return gcd(e2, e1 % e2);
}
const int TAM = 300000 + 100;
struct Nodo {
  int id;
  int x;
  int y;
  long long dif;
  Nodo() {}
  Nodo(int _id, int _x, int _y) {
    id = _id;
    x = _x;
    y = _y;
    dif = y - x;
  }
};
bool operator<(const Nodo& x, const Nodo& y) {
  if (x.dif != y.dif) return x.dif < y.dif;
  return x.id < y.id;
}
int xx[TAM];
int yy[TAM];
long long X[TAM];
long long Y[TAM];
long long p[TAM];
int n, m;
vector<int> G[TAM];
Nodo nodo[TAM];
int main() {
  scanf("%d%d", &n, &m);
  int x, y;
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    nodo[i] = Nodo(i, x, y);
    xx[i] = x;
    yy[i] = y;
  }
  sort(nodo, nodo + n);
  X[0] = nodo[0].x;
  Y[0] = nodo[0].y;
  for (int i = 1; i < n; i++) {
    X[i] = nodo[i].x + X[i - 1];
    Y[i] = nodo[i].y + Y[i - 1];
  }
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      p[nodo[i].id] += 1LL * i * nodo[i].x + Y[i - 1];
    }
    if (i + 1 < n) {
      p[nodo[i].id] += 1LL * (n - 1 - i) * nodo[i].y + (X[n - 1] - X[i]);
    }
  }
  int u, v;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    u--;
    v--;
    int r = min(xx[u] + yy[v], xx[v] + yy[u]);
    p[u] -= r;
    p[v] -= r;
  }
  for (int i = 0; i < n; i++) printf("%I64d ", p[i]);
  puts("");
  return 0;
}
