#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long mod = 1e9 + 7;
struct person {
  long long x, y, idx;
};
bool cmp(person a, person b) { return a.y - a.x < b.y - b.x; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  vector<person> store(n);
  for (long long i = 0; i < n; i++) {
    cin >> store[i].x >> store[i].y;
    store[i].idx = i;
  }
  sort(store.begin(), store.end(), cmp);
  long long rev[n];
  for (long long i = 0; i < n; i++) rev[store[i].idx] = i;
  long long sfx[n];
  sfx[n - 1] = store[n - 1].x;
  for (long long i = n - 2; i >= 0; i--) sfx[i] = sfx[i + 1] + store[i].x;
  long long ans[n];
  long long y_sum = 0;
  for (long long i = 0; i < n; i++) {
    long long b = y_sum + store[i].x * i;
    long long f = (i == n - 1 ? 0 : sfx[i + 1]) + (n - 1 - i) * store[i].y;
    ans[store[i].idx] = b + f;
    y_sum = y_sum + store[i].y;
  }
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    u -= 1;
    v -= 1;
    long long idx1 = rev[u];
    long long idx2 = rev[v];
    long long val =
        min(store[idx1].x + store[idx2].y, store[idx1].y + store[idx2].x);
    ans[u] -= val;
    ans[v] -= val;
  }
  for (long long i = 0; i < n; i++) cout << ans[i] << " ";
}
