#include <bits/stdc++.h>
using namespace std;
ifstream in;
ofstream out;
const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = ml * kk + 7;
const long long inf = ml * ml * ml + 7;
long long n, i, j, k;
vector<long long> m, ans;
vector<pair<long long, long long> > add, p;
bool viv = false;
void work(long long a, long long b) {
  long long sum = min(p[a].first + p[b].second, p[b].first + p[a].second);
  ans[a] -= sum;
  ans[b] -= sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  long long sum = 0;
  for (i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    m.push_back(a);
    ans.push_back((n - 2) * m.back());
    p.push_back({a, b});
    sum += m.back();
    add.push_back({b - m[i], i});
  }
  sort(add.begin(), add.end());
  for (auto &i : ans) i += sum;
  sum = 0;
  for (i = 0; i < n; i++) {
    long long v = add[i].second;
    long long z = add[i].first;
    ans[v] += sum + z * (n - i - 1);
    sum += z;
  }
  for (i = 0; i < k; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    work(a, b);
  }
  for (auto i : ans) cout << i << ' ';
  cout << endl;
  return 0;
}
