#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<long long int> x;
  vector<pair<long long int, long long int> > ds;
  vector<long long int> y;
  vector<long long int> sums = vector<long long int>(n, 0);
  for (int i = 0; i < n; i++) {
    long long int x_i, y_i;
    cin >> x_i >> y_i;
    x.push_back(x_i);
    y.push_back(y_i);
    ds.push_back(pair<long long int, long long int>(x_i - y_i, i));
  }
  sort(ds.begin(), ds.end());
  vector<long long int> psx;
  vector<long long int> psy;
  vector<long long int> rds = vector<long long int>(n, 0);
  psx.push_back(0);
  psy.push_back(0);
  long long int cxs = 0;
  long long int cys = 0;
  for (int i = 0; i < n; i++) {
    long long int j = ds[i].second;
    cxs += x[j];
    cys += y[j];
    psx.push_back(cxs);
    psy.push_back(cys);
    rds[j] = i;
  }
  for (int i = 0; i < n; i++) {
    long long int j = rds[i];
    sums[i] += psx[j] + y[i] * j;
    sums[i] += psy[n] - psy[j + 1] + x[i] * (n - 1 - j);
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    sums[a] -= min(x[a] + y[b], x[b] + y[a]);
    sums[b] -= min(x[a] + y[b], x[b] + y[a]);
  }
  for (int i = 0; i < n; i++) {
    cout << sums[i] << " ";
  }
  cout << endl;
}
