#include <bits/stdc++.h>
using namespace std;
pair<int, int> arr[333333], arr2[333333];
long long int dp1[333333], dp2[333333], ans[333333];
int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int e = 1; e <= n; e++) scanf("%d%d", &arr[e].first, &arr[e].second);
  for (int e = 1; e <= n; e++)
    arr2[e] = make_pair(arr[e].first - arr[e].second, e);
  sort(arr2 + 1, arr2 + n + 1);
  for (int e = 1; e <= n; e++) {
    dp1[e] = dp1[e - 1] + (long long int)arr[arr2[e].second].first;
    dp2[e] = dp2[e - 1] + (long long int)arr[arr2[e].second].second;
  }
  for (int e = 1; e <= n; e++) {
    ans[arr2[e].second] =
        (long long int)arr[arr2[e].second].first * (long long int)(n - e);
    ans[arr2[e].second] += (dp2[n] - dp2[e]);
    ans[arr2[e].second] +=
        (long long int)arr[arr2[e].second].second * (long long int)(e - 1);
    ans[arr2[e].second] += (dp1[e - 1]);
  }
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    int mm = arr[x].first + arr[y].second;
    mm = min(mm, arr[x].second + arr[y].first);
    ans[x] -= mm;
    ans[y] -= mm;
  }
  for (int e = 1; e <= n; e++) printf("%lld ", ans[e]);
  return 0;
}
