#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, m, a, b;
  cin >> n >> m;
  vector<pair<long long int, long long int>> v(n), v1(n);
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    v[i] = {a - b, i};
    v1[i] = {a, b};
  }
  sort(v.begin(), v.end());
  vector<long long int> ans(n, 0), dp1(n, 0), dp2(n, 0);
  for (int i = 1; i < n; ++i)
    dp1[i] = dp1[i - 1] - (i - 1) * v1[v[i - 1].second].second +
             i * v1[v[i].second].second + v1[v[i - 1].second].first;
  for (int i = n - 2; i >= 0; --i)
    dp2[i] = dp2[i + 1] - (n - i - 2) * v1[v[i + 1].second].first +
             (n - i - 1) * v1[v[i].second].first + v1[v[i + 1].second].second;
  for (int i = 0; i < n; ++i) ans[v[i].second] = dp1[i] + dp2[i];
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    --a;
    --b;
    ans[a] -= min(v1[a].first + v1[b].second, v1[a].second + v1[b].first);
    ans[b] -= min(v1[a].first + v1[b].second, v1[a].second + v1[b].first);
  }
  for (auto i : ans) cout << i << " ";
}
