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 namespace std;
const int N = 200300, M = N * 5, K = 100005, inf = 1e9;
char res[N];
inline int rd() {
  int x = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) x = x * 10 + c - 48, c = getchar();
  return x;
}
int tt, cc = 1, S, T, hd[N], iter[N], dis[N], q[N];
struct E {
  int v, nxt, w, i;
} e[M];
inline void fail() {
  puts("-1");
  exit(0);
}
inline void addedge(int u, int v, int w, int i) {
  e[++cc] = (E){v, hd[u], w, i};
  hd[u] = cc;
  e[++cc] = (E){u, hd[v], 0, i};
  hd[v] = cc;
}
inline bool bfs(int S, int T) {
  memset(dis, -1, sizeof(dis));
  memcpy(iter, hd, sizeof(hd));
  int ql = 0, qr = 0;
  q[++qr] = S;
  dis[S] = 0;
  while (ql < qr) {
    int x = q[++ql];
    for (int i = hd[x]; i; i = e[i].nxt)
      if (e[i].w && dis[e[i].v] == -1) {
        dis[e[i].v] = dis[x] + 1;
        q[++qr] = e[i].v;
      }
  }
  return ~dis[T];
}
int dfs(int x, int T, int f) {
  if (x == T || !f) return f;
  int sf = 0;
  for (int& i = iter[x]; i; i = e[i].nxt)
    if (e[i].w && dis[e[i].v] == dis[x] + 1) {
      int w = dfs(e[i].v, T, min(f, e[i].w));
      if (w) {
        e[i].w -= w;
        e[i ^ 1].w += w;
        f -= w;
        sf += w;
        if (!f) break;
      }
    }
  return sf;
}
int dinic(int S, int T) {
  int f = 0;
  while (bfs(S, T)) f += dfs(S, T, inf);
  return f;
}
int SS, TT, s[N];
inline void add(int u, int v, int a, int b, int i) {
  if (a > b) fail();
  addedge(u, v, b - a, i);
  s[u] -= a;
  s[v] += a;
}
int sol() {
  for (int i = 1; i <= tt; i++)
    if (s[i] > 0)
      addedge(SS, i, s[i], 0);
    else if (s[i] < 0)
      addedge(i, TT, -s[i], 0);
  addedge(T, S, inf, 0);
  dinic(SS, TT);
  int ee = cc;
  for (int i = hd[SS]; i; i = e[i].nxt)
    if (e[i].w) fail();
  hd[S] = e[hd[S]].nxt;
  hd[T] = e[hd[T]].nxt;
  return dinic(S, T) + e[ee].w;
}
inline void calc(int o, int l, int r) {
  for (int x = 1; x < l; x++)
    for (int i = hd[x]; i; i = e[i].nxt)
      if (e[i].v >= l && e[i].v <= r) res[e[i].i] = o ^ e[i].w ? 'b' : 'r';
}
int n, m, r, b, o, nx, ny, x[K], y[K], ox[K], oy[K], sx[K], sy[K], mxx[K],
    mxy[K];
int main() {
  n = rd();
  m = rd();
  r = rd();
  b = rd();
  ;
  if (r > b) swap(r, b), o = 1;
  for (int i = 1; i <= n; i++) ox[i] = x[i] = rd(), oy[i] = y[i] = rd();
  sort(ox + 1, ox + n + 1);
  nx = unique(ox + 1, ox + n + 1) - ox - 1;
  sort(oy + 1, oy + n + 1);
  ny = unique(oy + 1, oy + n + 1) - oy - 1;
  for (int i = 1; i <= n; i++)
    x[i] = lower_bound(ox + 1, ox + nx + 1, x[i]) - ox, sx[x[i]]++;
  for (int i = 1; i <= n; i++)
    y[i] = lower_bound(oy + 1, oy + ny + 1, y[i]) - oy, sy[y[i]]++;
  for (int i = 1; i <= n; i++) mxx[i] = mxy[i] = n;
  for (int i = 1, t, l, d, p; i <= m; i++) {
    t = rd() - 1;
    l = rd();
    d = rd();
    if (!t)
      p = lower_bound(ox + 1, ox + nx + 1, l) - ox;
    else
      p = lower_bound(oy + 1, oy + ny + 1, l) - oy;
    if ((!t && ox[p] != l) || (t && oy[p] != l)) continue;
    if (!t)
      mxx[p] = min(mxx[p], d);
    else
      mxy[p] = min(mxy[p], d);
  }
  S = nx + ny + 1;
  T = S + 1;
  SS = T + 1;
  TT = tt = SS + 1;
  for (int i = 1; i <= n; i++) add(x[i], nx + y[i], 0, 1, i);
  for (int i = 1; i <= nx; i++) {
    int l = 0, r = inf;
    if (!mxx[i] && (sx[i] & 1)) {
      puts("-1");
      return 0;
    }
    if (mxx[i] < sx[i]) l = (sx[i] - mxx[i] + 1) / 2, r = (sx[i] + mxx[i]) / 2;
    add(S, i, l, r, 0);
  }
  for (int i = 1; i <= ny; i++) {
    int l = 0, r = inf;
    if (!mxy[i] && (sy[i] & 1)) {
      puts("-1");
      return 0;
    }
    if (mxy[i] < sy[i]) l = (sy[i] - mxy[i] + 1) / 2, r = (sy[i] + mxy[i]) / 2;
    add(nx + i, T, l, r, 0);
  }
  int ans = sol();
  calc(o, nx + 1, nx + ny);
  printf("%lld\n", 1ll * ans * r + 1ll * (n - ans) * b);
  for (int i = 1; i <= n; i++) putchar(res[i]);
  return 0;
}