#include <bits/stdc++.h>
using namespace std;
struct item {
  long long int a;
  long long int b;
  long long int c;
};
bool cmpr(struct item a, struct item b) { return a.a < b.a; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m;
  cin >> n >> m;
  vector<pair<long long int, long long int>> v(n);
  vector<struct item> vec;
  for (long long int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
    vec.push_back({v[i].second - v[i].first, v[i].first, v[i].second});
  }
  sort(vec.begin(), vec.end(), cmpr);
  vector<long long int> pre1(n), pre2(n);
  for (long long int i = 0; i < n; i++) {
    pre1[i] = vec[i].b;
    pre2[i] = vec[i].c;
  }
  for (long long int i = 1; i < n; i++) {
    pre1[i] += pre1[i - 1];
    pre2[i] += pre2[i - 1];
  }
  vector<long long int> ans(n);
  for (long long int i = 0; i < n; i++) {
    long long int t1 = v[i].second - v[i].first;
    long long int left = 0, right = n - 1;
    while (left < right) {
      long long int mid = left + right + 1;
      mid /= 2;
      if (vec[mid].a > t1) {
        right = mid - 1;
      } else {
        left = mid;
      }
    }
    ans[i] = pre2[left] + pre1[n - 1] - pre1[left];
    ans[i] += (left + 1) * v[i].first;
    ans[i] += (n - left - 1) * v[i].second;
    ans[i] -= v[i].second + v[i].first;
  }
  for (long long int i = 0; i < m; i++) {
    long long int x, y;
    cin >> x >> y;
    x--;
    y--;
    long long int t1 = min(v[x].first + v[y].second, v[y].first + v[x].second);
    ans[x] -= t1;
    ans[y] -= t1;
  }
  for (long long int i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
}
