#include <bits/stdc++.h>
using namespace std;
struct pppp {
  long long x, y, pos;
} a[300005];
long long sumx[300005], sumy[300005], p[300005], ans[300005];
bool cmp(pppp t, pppp l) { return t.x + l.y < t.y + l.x; }
int main() {
  long long n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
    a[i].pos = i;
  }
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    p[u] += min(a[u].x + a[v].y, a[u].y + a[v].x);
    p[v] += min(a[u].x + a[v].y, a[u].y + a[v].x);
  }
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    sumx[i] = sumx[i - 1] + a[i].x;
  }
  for (int i = n; i >= 1; i--) {
    sumy[i] = sumy[i + 1] + a[i].y;
  }
  for (int i = 1; i <= n; i++) {
    long long sum = sumx[i - 1] + sumy[i + 1];
    long long pre = i - 1, nx = n - i;
    sum += pre * a[i].y + nx * a[i].x;
    ans[a[i].pos] = sum - p[a[i].pos];
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
}
