#include <bits/stdc++.h>
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
const int N = 1000 * 1000 + 10;
long long c[N], d[N], ps[N], ps2[N];
pair<long long, long long> p[N];
vector<int> adj[N];
bool cmp(pair<long long, long long> p, pair<long long, long long> q) {
  return p.first - p.second < q.first - q.second;
}
long long f(int i, int j) { return d[i] + min(c[j], d[j] - d[i] + c[i]); }
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> d[i];
    p[i] = {c[i], d[i]};
    adj[i].push_back(i);
  }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  sort(p, p + n, cmp);
  for (int i = 0; i < n; i++) {
    ps[i + 1] = ps[i] + p[i].first;
    ps2[i + 1] = ps2[i] + p[i].second;
  }
  for (int i = 0; i < n; i++) {
    long long ans = (d[i]) * n;
    long long x = c[i] - d[i];
    int l = -1, r = n;
    while (r - l > 1) {
      int mid = (l + r) / 2;
      if (p[mid].first - p[mid].second <= x)
        l = mid;
      else
        r = mid;
    }
    ans += ps[l + 1];
    ans += ps2[n] - ps2[l + 1];
    ans += (n - l - 1) * x;
    for (auto j : adj[i]) ans -= f(i, j);
    cout << ans << ' ';
  }
  cout << endl;
}
