#include <bits/stdc++.h>
using namespace std;
int n, m;
struct Node {
  long long x, y;
  int id;
  bool operator<(const Node& n1) const { return x - y < n1.x - n1.y; }
} a[300005];
long long sx[300005], sy[300005];
long long ans[300005];
int pos[300005];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
    a[i].id = i;
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) {
    sx[i] = sx[i - 1] + a[i].x;
    sy[i] = sy[i - 1] + a[i].y;
  }
  for (int i = 1; i <= n; i++) {
    ans[a[i].id] =
        sx[i - 1] + (i - 1) * a[i].y + (sy[n] - sy[i]) + (n - i) * a[i].x;
    pos[a[i].id] = i;
  }
  int u, v;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    if (pos[u] < pos[v]) {
      ans[u] -= a[pos[u]].x + a[pos[v]].y;
      ans[v] -= a[pos[u]].x + a[pos[v]].y;
    } else {
      ans[u] -= a[pos[v]].x + a[pos[u]].y;
      ans[v] -= a[pos[v]].x + a[pos[u]].y;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
