#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
const long double PI = acos((long double)(-1));
using namespace std;
struct Skill {
  long long a, b;
  int id;
  Skill(long long _a, long long _b, int _id) : a(_a), b(_b), id(_id) {}
  bool operator<(const Skill& s) const { return b - a < s.b - s.a; }
};
int main() {
  long long n, m;
  scanf("%lld %lld", &n, &m);
  vector<Skill> vs;
  vs.reserve(n);
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) {
    scanf("%lld %lld", &a[i], &b[i]);
    vs.emplace_back(a[i], b[i], i);
  }
  vector<vector<int>> bad(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    bad[u].emplace_back(v);
    bad[v].emplace_back(u);
  }
  vector<long long> res(n);
  sort(vs.begin(), vs.end());
  long long sum_b = 0;
  long long sum_a = 0;
  for (int i = 0; i < vs.size(); i++) {
    sum_a += vs[i].a;
  }
  for (long long i = 0; i < vs.size(); i++) {
    sum_a -= vs[i].a;
    res[vs[i].id] = vs[i].a * i + sum_b + vs[i].b * (n - 1 - i) + sum_a;
    sum_b += vs[i].b;
  }
  for (int i = 0; i < n; i++) {
    for (auto e : bad[i]) {
      res[i] -= min(a[i] + b[e], a[e] + b[i]);
    }
  }
  for (int i = 0; i < res.size(); i++)
    printf("%lld%c", res[i], " \n"[i + 1 == res.size()]);
  return 0;
}
