#include <bits/stdc++.h>
using namespace std;
long long ans[300020];
int a[300020];
int b[300020];
pair<int, int> P[300020];
long long suma;
long long sumb[300020];
int n, m, i, x, y;
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    P[i].first = a[i] - b[i];
    P[i].second = i;
  }
  for (i = 1; i <= m; i++) {
    cin >> x >> y;
    ans[x] -= min(a[x] + b[y], a[y] + b[x]);
    ans[y] -= min(a[x] + b[y], a[y] + b[x]);
  }
  sort(P + 1, P + n + 1);
  for (i = n; i >= 1; i--) sumb[i] = sumb[i + 1] + b[P[i].second];
  for (i = 1; i <= n; i++) {
    ans[P[i].second] += 1LL * (i - 1) * b[P[i].second];
    ans[P[i].second] += 1LL * (n - i) * a[P[i].second];
    ans[P[i].second] += suma + sumb[i + 1];
    suma += a[P[i].second];
  }
  for (i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
