#include <bits/stdc++.h>
using namespace std;
vector<int> V;
pair<long long, long long> val[300005];
bool comp(int A, int B) {
  return (val[A].first - val[A].second) <= (val[B].first - val[B].second);
}
long long ans[300005];
long long cumy[300005];
long long cumx[300005];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d %I64d", &val[i].first, &val[i].second);
    V.push_back(i);
  }
  sort(V.begin(), V.end(), comp);
  for (int i = 0; i < V.size(); ++i) {
    cumx[i + 1] = val[V[i]].first + cumx[i];
  }
  for (int i = V.size() - 1; i >= 0; --i) {
    cumy[i + 1] = cumy[i + 2] + val[V[i]].second;
  }
  for (long long int i = 0; i < V.size(); ++i) {
    long long int u = i;
    long long r = i + 1;
    ans[V[i]] = val[V[i]].second * u + cumx[u];
    ans[V[i]] += (val[V[i]].first * ((long long)V.size() - r) + cumy[r + 1]);
  }
  for (int i = 1; i <= m; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    if (val[a].first + val[b].second < val[a].second + val[b].first) {
      ans[a] -= (val[a].first + val[b].second);
      ans[b] -= (val[a].first + val[b].second);
    } else {
      ans[a] -= (val[a].second + val[b].first);
      ans[b] -= (val[a].second + val[b].first);
    }
  }
  for (int i = 1; i <= n; ++i) {
    printf("%I64d ", ans[i]);
  }
  cout << endl;
  return 0;
}
