#include <bits/stdc++.h>
using namespace std;
const int N = 300002;
struct item {
  long long a, b, dif, ind;
};
bool operator<(const item &l, const item &r) { return l.dif < r.dif; }
int n, m, x, y;
long long a[N], b[N], pref[N], suff[N], ans[N];
vector<item> c;
long long calc(int l, int r) { return min(a[l] + b[r], a[r] + b[l]); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  c.push_back({0, 0, (int)-2e9 - 1, 0});
  cin >> n >> m;
  for (int i = 1; i <= n && cin >> x >> y; i++) {
    a[i] = x;
    b[i] = y;
    c.push_back({x, y, x - y, i});
  }
  sort(c.begin(), c.end());
  for (int i = 1; i <= n; i++) pref[i] = pref[i - 1] + c[i].a;
  for (int i = n; i >= 1; i--) suff[i] = suff[i + 1] + c[i].b;
  for (int i = 1; i <= n; i++)
    ans[c[i].ind] =
        pref[i - 1] + suff[i + 1] + (i - 1) * c[i].b + (n - i) * c[i].a;
  while (m-- && cin >> x >> y) {
    ans[x] -= calc(x, y);
    ans[y] -= calc(x, y);
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
