#include <bits/stdc++.h>
using namespace std;
void solve(int test) {
  int n, m;
  cin >> n >> m;
  vector<pair<long long int, long long int> > v1(n), v2(n);
  long long int psum = 0, sum = 0;
  vector<long long int> ans(n);
  for (int(i) = 0; (i) < n; (i)++) {
    cin >> v1[i].first >> v1[i].second;
    v2[i].first = v1[i].first - v1[i].second;
    v2[i].second = i;
    sum += v1[i].second;
  }
  sort((v2).begin(), (v2).end());
  for (int(i) = 0; (i) < n; (i)++) {
    sum -= v1[v2[i].second].second;
    ans[v2[i].second] = sum + (n - i - 1) * v1[v2[i].second].first + psum +
                        i * v1[v2[i].second].second;
    psum += v1[v2[i].second].first;
  }
  for (int(i) = 0; (i) < m; (i)++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    int temp = min(v1[x].first + v1[y].second, v1[x].second + v1[y].first);
    ans[x] -= temp;
    ans[y] -= temp;
  }
  for (int(i) = 0; (i) < n; (i)++) {
    cout << ans[i] << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int test = 1;
  for (int(i) = 0; (i) < test; (i)++) {
    solve(i + 1);
  }
  return 0;
}
