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>
const int N = 200007, M = N * 5, inf = 1e9;
char ibuf[(1 << 23) + 1], *iS = ibuf;
int x[N], y[N], tx[N], ty[N], cx[N], cy[N], lx[N], ly[N], id[N], d[N];
int s, t, S, T, tot = 1, head[N], ver[M], edge[M], next[M], cur[N], dep[N];
std::queue<int> q;
std::unordered_map<int, int> hx, hy;
int read() {
  int x = 0;
  while (isspace(*iS)) ++iS;
  while (isdigit(*iS)) (x *= 10) += *iS++ & 15;
  return x;
}
void add(int u, int v, int w) {
  ver[++tot] = v, next[tot] = head[u], edge[tot] = w, head[u] = tot,
  ver[++tot] = u, next[tot] = head[v], edge[tot] = 0, head[v] = tot;
}
void Add(int u, int v, int l, int r) { add(u, v, r - l), d[u] -= l, d[v] += l; }
int bfs(int s, int t) {
  memset(dep + 1, -1, T << 2), memcpy(cur + 1, head + 1, T << 2), dep[s] = 0,
                                                                  q.push(s);
  for (int i, u, v; !q.empty();)
    for (u = q.front(), q.pop(), i = head[u]; i; i = next[i])
      if (!~dep[v = ver[i]] && edge[i]) dep[v] = dep[u] + 1, q.push(v);
  return ~dep[t];
}
int dfs(int u, int t, int lim) {
  if (!lim || u == t) return lim;
  int v, flow = 0;
  for (int &i = cur[u], f; i; i = next[i])
    if (edge[i] && dep[v = ver[i]] == dep[u] + 1) {
      flow += (f = dfs(v, t, std::min(lim, edge[i]))), lim -= f, edge[i] -= f,
          edge[i ^ 1] += f;
      if (!lim) break;
    }
  return flow;
}
int dinic(int s, int t) {
  int r = 0;
  while (bfs(s, t)) r += dfs(s, t, inf);
  return r;
}
int main() {
  fread(ibuf, 1, 1 << 23, stdin);
  int n = read(), m = read(), r = read(), b = read(), mx, my, f = 0, sum = 0,
      ans = 0;
  if (r > b) std::swap(r, b), f = 1;
  for (int i = 1; i <= n; ++i) x[i] = read(), y[i] = read();
  memcpy(tx + 1, x + 1, n << 2), memcpy(ty + 1, y + 1, n << 2);
  std::sort(tx + 1, tx + n + 1), std::sort(ty + 1, ty + n + 1);
  mx = std::unique(tx + 1, tx + n + 1) - tx - 1,
  my = std::unique(ty + 1, ty + n + 1) - ty - 1;
  s = mx + my + 1, t = s + 1, S = t + 1, T = S + 1, add(t, s, inf);
  for (int i = 1; i <= mx; ++i) hx[tx[i]] = i;
  for (int i = 1; i <= my; ++i) hy[ty[i]] = i;
  for (int i = 1; i <= n; ++i) ++cx[x[i] = hx[x[i]]], ++cy[y[i] = hy[y[i]]];
  for (int i = 1; i <= n; ++i) add(x[i], y[i] + mx, 1), id[i] = tot ^ 1;
  memcpy(lx + 1, cx + 1, mx << 2), memcpy(ly + 1, cy + 1, my << 2);
  for (int i = 1, o, l, d; i <= m; ++i) {
    o = read(), l = read(), d = read();
    if (o & 1) {
      if (hx.count(l)) l = hx[l], lx[l] = std::min(lx[l], d);
    } else {
      if (hy.count(l)) l = hy[l], ly[l] = std::min(ly[l], d);
    }
  }
  for (int i = 1; i <= mx; ++i)
    if (cx[i] & 1 && !lx[i])
      return puts("-1"), 0;
    else
      Add(s, i, (cx[i] - lx[i] + 1) / 2, (cx[i] + lx[i]) / 2);
  for (int i = 1; i <= my; ++i)
    if (cy[i] & 1 && !ly[i])
      return puts("-1"), 0;
    else
      Add(i + mx, t, (cy[i] - ly[i] + 1) / 2, (cy[i] + ly[i]) / 2);
  for (int i = 1; i <= t; ++i)
    if (d[i] > 0)
      add(S, i, d[i]), sum += d[i];
    else if (d[i] < 0)
      add(i, T, -d[i]);
  if ((ans = dinic(S, T)) ^ sum) return puts("-1"), 0;
  ans = dinic(s, t), printf("%lld\n", 1ll * ans * r + 1ll * (n - ans) * b);
  for (int i = 1; i <= n; ++i) putchar(edge[id[i]] ^ f ? 'b' : 'r');
}