Problem: Steve Rogers is fascinated with new vibranium shields S.H.I.E.L.D gave him. They're all uncolored. There are n shields in total, the i-th shield is located at point (xi, yi) of the coordinate plane. It's possible that two or more shields share the same location.

Steve wants to paint all these shields. He paints each shield in either red or blue. Painting a shield in red costs r dollars while painting it in blue costs b dollars.

Additionally, there are m constraints Steve wants to be satisfied. The i-th constraint is provided by three integers ti, li and di:

  * If ti = 1, then the absolute difference between the number of red and blue shields on line x = li should not exceed di. 
  * If ti = 2, then the absolute difference between the number of red and blue shields on line y = li should not exceed di. 



Steve gave you the task of finding the painting that satisfies all the condition and the total cost is minimum.

Input

The first line of the input contains two integers n and m (1 ≤ n, m ≤ 100 000) — the number of shields and the number of constraints respectively.

The second line contains two integers r and b (1 ≤ r, b ≤ 109).

The next n lines contain the shields coordinates. The i-th of these lines contains two integers xi and yi (1 ≤ xi, yi ≤ 109).

The next m lines contain the constrains. The j-th of these lines contains three integers tj, lj and dj (1 ≤ tj ≤ 2, 1 ≤ lj ≤ 109, 0 ≤ dj ≤ n).

Output

If satisfying all the constraints is impossible print -1 in first and only line of the output.

Otherwise, print the minimum total cost in the first line of output. In the second line print a string of length n consisting of letters 'r' and 'b' only. The i-th character should be 'r' if the i-th shield should be painted red in the optimal answer and 'b' if it should be painted blue. The cost of painting shields in these colors should be equal the minimum cost you printed on the first line.

If there exist more than one optimal solution, print any of them.

Examples

Input

5 6
8 3
2 10
1 5
9 10
9 10
2 8
1 9 1
1 2 1
2 10 3
2 10 2
1 1 1
2 5 2


Output

25
rbrbb


Input

4 4
7 3
10 3
9 8
10 3
2 8
2 8 0
2 8 0
1 2 0
1 9 0


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using std::max;
using std::min;
long long n, m, R, B, x[1000001], y[1000001], origx[1000001], origy[1000001],
    cons[1000001][2], lim1, lim2, d[1000001][2];
long long head[2000100], nxt[3000100], b[3000100],
    k = 1, S, T, SS, TT, dis[2000100], v[3000100], q[2000100], h, t, p[2000100];
long long flow[2000100], pos[2001000];
bool vis[2000100];
void push(long long s, long long t, long long val) {
  nxt[++k] = head[s];
  head[s] = k;
  b[k] = t;
  v[k] = val;
}
void link(long long s, long long t, long long val) {
  push(s, t, max(val, 0ll));
  push(t, s, 0);
}
bool bfs(long long SS, long long TT) {
  memset(dis, -1, sizeof dis);
  dis[SS] = 0;
  h = t = 0;
  q[++t] = SS;
  while (h < t) {
    ++h;
    for (long long i = head[q[h]]; i; i = nxt[i])
      if (v[i] && dis[b[i]] == -1) {
        dis[b[i]] = dis[q[h]] + 1;
        q[++t] = b[i];
      }
  }
  return ~dis[TT];
}
long long dfs(long long x, long long TT, long long flow) {
  if (x == TT || !flow) return flow;
  long long used = 0;
  for (long long i = p[x]; i; i = nxt[i])
    if (v[i] && dis[b[i]] == dis[x] + 1) {
      long long w = dfs(b[i], TT, min(v[i], flow - used));
      used += w;
      v[i] -= w;
      v[i ^ 1] += w;
      if (w) p[x] = i;
      if (flow == used) return flow;
    }
  if (!used) dis[x] = 0;
  return used;
}
signed main() {
  scanf("%I64d%I64d%I64d%I64d", &n, &m, &R, &B);
  for (long long i = 1; i <= n; i++)
    scanf("%I64d%I64d", x + i, y + i), origx[i] = x[i], origy[i] = y[i];
  std::sort(origx + 1, origx + n + 1);
  std::sort(origy + 1, origy + n + 1);
  lim1 = std::unique(origx + 1, origx + n + 1) - origx - 1;
  lim2 = std::unique(origy + 1, origy + n + 1) - origy - 1;
  for (long long i = 1; i <= n; i++)
    x[i] = std::lower_bound(origx + 1, origx + lim1 + 1, x[i]) - origx,
    y[i] = std::lower_bound(origy + 1, origy + lim2 + 1, y[i]) - origy;
  for (long long i = 1; i <= lim1; i++) cons[i][0] = n;
  for (long long i = 1; i <= lim2; i++) cons[i][1] = n;
  for (long long i = 1, t, l, d; i <= m; i++) {
    scanf("%I64d%I64d%I64d", &t, &l, &d);
    if (t == 1) {
      long long tem = std::lower_bound(origx + 1, origx + lim1 + 1, l) - origx;
      if (origx[tem] == l) cons[tem][0] = min(cons[tem][0], d);
    } else {
      long long tem = std::lower_bound(origy + 1, origy + lim2 + 1, l) - origy;
      if (origy[tem] == l) cons[tem][1] = min(cons[tem][1], d);
    }
  }
  S = lim1 + lim2 + 1;
  T = S + 1;
  SS = T + 1;
  TT = SS + 1;
  for (long long i = 1; i <= n; i++) {
    link(x[i], y[i] + lim1, 1);
    ++d[x[i]][0];
    ++d[y[i]][1];
    pos[i] = k - 1;
  }
  for (long long i = 1; i <= lim1; i++) {
    long long l = max((d[i][0] - cons[i][0] + 1) >> 1, 0ll),
              r = min((d[i][0] + cons[i][0]) >> 1, d[i][0]);
    if (l > r) {
      puts("-1");
      return 0;
    }
    flow[S] -= l;
    flow[i] += l;
    link(S, i, r - l);
  }
  for (long long i = 1; i <= lim2; i++) {
    long long l = max((d[i][1] - cons[i][1] + 1) >> 1, 0ll),
              r = min((d[i][1] + cons[i][1]) >> 1, d[i][1]);
    if (l > r) {
      puts("-1");
      return 0;
    }
    flow[i + lim1] -= l;
    flow[T] += l;
    link(i + lim1, T, r - l);
  }
  long long ans = 0, x = 0;
  for (long long i = 1; i <= T; i++)
    if (flow[i] < 0)
      link(i, TT, -flow[i]);
    else if (flow[i] > 0)
      link(SS, i, flow[i]), x += flow[i];
  link(T, S, 1000000000000000000ll);
  while (bfs(SS, TT)) {
    memcpy(p, head, sizeof p);
    ans += dfs(SS, TT, 1000000000000000000ll);
  }
  if (ans != x) {
    puts("-1");
    return 0;
  }
  ans = 0;
  while (bfs(S, T)) {
    memcpy(p, head, sizeof p);
    ans += dfs(S, T, 1000000000000000000ll);
  }
  printf("%lld\n", min(R, B) * ans + max(R, B) * (n - ans));
  for (long long i = 1; i <= n; i++)
    if (v[pos[i]])
      vis[i] = R > B;
    else
      vis[i] = R <= B;
  for (long long i = 1; i <= n; i++)
    if (vis[i])
      putchar('r');
    else
      putchar('b');
}