#include <bits/stdc++.h>
using namespace std;
const int N = 300300;
int x[N], y[N];
pair<long long, int> a[N];
long long res[N];
int main() {
  int n, m;
  long long suma = 0, totalx = 0;
  scanf("%d%d", &n, &m);
  for (int i = (0); i <= (int(n) - 1); ++i) {
    scanf("%d%d", &x[i], &y[i]);
    a[i] = make_pair(y[i] - x[i], i);
    totalx += x[i];
  }
  sort(a, a + n);
  for (int ii = (0); ii <= (int(n) - 1); ++ii) {
    int i = a[ii].second;
    res[i] +=
        totalx + 1LL * (n - 2) * x[i] + suma + 1LL * a[ii].first * (n - ii - 1);
    suma += a[ii].first;
  }
  for (int i = (0); i <= (int(m) - 1); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    res[a] -= min(x[a] + y[b], x[b] + y[a]);
    res[b] -= min(x[a] + y[b], x[b] + y[a]);
  }
  for (int i = (0); i <= (int(n) - 1); ++i) printf("%lld ", res[i]);
  printf("\n");
  return 0;
}
