#include <bits/stdc++.h>
using namespace std;
int num1[300010], num2[300010], id[300010], n, m;
long long tmp, ans[300010];
bool cmp(const int &a, const int &b) {
  return num2[a] - num1[a] < num2[b] - num1[b];
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d%d", &num1[i], &num2[i]);
  for (int i = 1; i <= n; i++) id[i] = i;
  sort(id + 1, id + n + 1, cmp);
  for (int i = 1; i <= n; i++)
    ans[id[i]] += tmp + 1ll * num1[id[i]] * (i - 1), tmp += num2[id[i]];
  tmp = 0;
  for (int i = n; i; i--)
    ans[id[i]] += tmp + 1ll * num2[id[i]] * (n - i), tmp += num1[id[i]];
  for (int i = 1, x, y; i <= m; i++) {
    scanf("%d%d", &x, &y);
    ans[x] -= min(num1[x] + num2[y], num2[x] + num1[y]);
    ans[y] -= min(num1[x] + num2[y], num2[x] + num1[y]);
  }
  for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
}
