#include <bits/stdc++.h>
using namespace std;
const int N = 100100, oo = 0x3f3f3f3f, M = 1e9 + 7;
int n, m;
long long ans[3 * N];
vector<vector<int> > g;
pair<long long, long long> cum[3 * N];
pair<int, pair<int, int> > c[3 * N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    cin >> c[i].second.first >> c[i].second.second, c[i].first = i;
  g.resize(n);
  for (int i = 0, u, v; i < m; ++i) {
    cin >> u >> v;
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; ++i)
    for (auto ch : g[i])
      ans[i] -= min(c[i].second.first + c[ch].second.second,
                    c[i].second.second + c[ch].second.first);
  sort(c, c + n,
       [](const pair<int, pair<int, int> > &a,
          const pair<int, pair<int, int> > &b) {
         return a.second.first + b.second.second <
                a.second.second + b.second.first;
       });
  for (int i = 0; i < n; ++i) {
    cum[i + 1].first = cum[i].first + c[i].second.first;
    cum[i + 1].second = cum[i].second + c[i].second.second;
  }
  for (int i = 0; i < n; ++i) {
    ans[c[i].first] += cum[i].first + (cum[n].second - cum[i + 1].second) +
                       1LL * (n - i - 1) * c[i].second.first +
                       1LL * i * c[i].second.second;
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
