#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007ll;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= MOD;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
  }
  return res;
}
template <typename t1, typename t2>
inline bool upmax(t1 &a, t2 b) {
  if (a < (t1)b) {
    a = (t1)b;
    return true;
  } else
    return false;
}
template <typename t1, typename t2>
inline bool upmin(t1 &a, t2 b) {
  if (a > (t1)b) {
    a = (t1)b;
    return true;
  } else
    return false;
}
template <typename T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
inline T lcm(T a, T b) {
  return a * (b / gcd(a, b));
}
template <typename T>
inline T sqr(T a) {
  return a * a;
}
int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int INF = 1000000404;
const long long LINF = 4000000000000000404ll;
const long double PI = acos(-1.0);
const long double EPS = 1e-9;
int SQ = 318;
int timer = 0;
const int N = 300100;
long long x[N];
long long y[N];
int a[N];
long long X[N];
long long Y[N];
vector<int> g[N];
long long res[N];
void solve() {
  int n;
  cin >> n;
  int m;
  cin >> m;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    a[i] = i;
  }
  sort(a + 1, a + n + 1,
       [](int i, int j) { return (x[i] - y[i] < x[j] - y[j]); });
  for (int j = 1; j <= m; j++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    X[i] = X[i - 1] + x[a[i]];
    Y[i] = Y[i - 1] + y[a[i]];
  }
  long long s = 0;
  for (int i = n; i >= 1; i--) {
    int ind = a[i];
    res[ind] = Y[n] - Y[i] + 1ll * (n - i) * x[ind] + 1ll * y[ind] * (i - 1) +
               X[i - 1];
    for (auto j : g[ind]) {
      res[ind] -= min(x[ind] + y[j], x[j] + y[ind]);
    }
  }
  for (int i = 1; i <= n; i++) cout << res[i] << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
