#include <bits/stdc++.h>
using namespace std;
long long ans[300005];
long long a[300005][2], q1[300005], q2[300005], vis[300005];
vector<long long> v[300005];
struct node {
  long long x, y, z, id;
} s[300005];
bool cmp(node x1, node x2) { return x1.z < x2.z; }
int main() {
  long long n, m, i, j, k, x, y, z;
  scanf("%lld%lld", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%lld%lld", &a[i][0], &a[i][1]);
    s[i].x = a[i][0];
    s[i].y = a[i][1];
    s[i].z = a[i][1] - a[i][0];
    s[i].id = i;
  }
  for (i = 0; i < m; i++) {
    scanf("%lld%lld", &x, &y);
    z = min(a[x - 1][0] + a[y - 1][1], a[x - 1][1] + a[y - 1][0]);
    v[x - 1].push_back(z);
    v[y - 1].push_back(z);
  }
  sort(s, s + n, cmp);
  q1[0] = s[0].x;
  q2[0] = s[0].y;
  for (i = 1; i < n; i++) {
    q1[i] = q1[i - 1] + s[i].x;
    q2[i] = q2[i - 1] + s[i].y;
  }
  for (i = 0; i < n; i++) vis[s[i].id] = i;
  for (i = 0; i < n; i++) {
    j = vis[i];
    if (j == 0)
      ans[i] = 0;
    else
      ans[i] = q2[j - 1] + j * s[j].x;
    ans[i] += s[j].y * (n - 1 - j);
    ans[i] += q1[n - 1] - q1[j];
    for (k = 0; k < v[i].size(); k++) {
      ans[i] -= v[i][k];
    }
  }
  for (i = 0; i < n; i++) printf("%lld ", ans[i]);
}
