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;
template <typename T>
inline T read(register T& t) {
  register T f = 1;
  register char ch = getchar();
  t = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') t = t * 10 + ch - '0', ch = getchar();
  t *= f;
  return t;
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
const long long p = 998244353;
inline long long power(register long long x, register long long k = p - 2) {
  register long long re = 1;
  for (; k; k >>= 1, x = x * x % p)
    if (k & 1) re = re * x % p;
  return re;
}
int n, m;
int x_pos[1000005], y_pos[1000005];
int dir_l[1000005], tar_l[1000005];
int lim_l[1000005];
map<int, int> x_mp, y_mp;
long long R_val, B_val;
bool swap_flag;
int x_Sum[1000005], y_Sum[1000005];
int x_Limit[1000005], y_Limit[1000005];
namespace maxFlow {
int S, T;
int head[1000005], ne[8000005], to[8000005], val[8000005], total = 1;
inline void add(int a, int b, int c) {
  total++;
  to[total] = b;
  ne[total] = head[a];
  head[a] = total;
  val[total] = c;
}
int flow[1000005];
int s, t;
int maxflow = 0;
int deep[1000005], gra[1000005];
int bel[1000005];
void bfs() {
  memset(deep, 0, sizeof(deep));
  memset(gra, 0, sizeof(gra));
  queue<int> q;
  q.push(t);
  deep[t] = 1;
  gra[1] = 1;
  int p;
  while (q.size()) {
    p = q.front();
    q.pop();
    for (int i = head[p]; i; i = ne[i]) {
      if (deep[to[i]]) continue;
      deep[to[i]] = deep[p] + 1;
      gra[deep[to[i]]]++;
      q.push(to[i]);
    }
  }
}
int dfs(int now, int flow) {
  if (now == t) return maxflow += flow, flow;
  int used = 0, re;
  for (int i = head[now]; i; i = ne[i])
    if (val[i] && deep[to[i]] == deep[now] - 1) {
      re = dfs(to[i], min(val[i], flow - used));
      val[i] -= re;
      val[i ^ 1] += re;
      used += re;
      if (used == flow) return used;
    }
  gra[deep[now]]--;
  if (gra[deep[now]] == 0) deep[s] = n * 2 + 6;
  deep[now]++;
  gra[deep[now]]++;
  return used;
}
int ISAP() {
  bfs();
  maxflow = 0;
  while (deep[s] <= n * 2 + 5) dfs(s, 1e9);
  return maxflow;
}
inline int ceil(int x) {
  if (x < 0) return 0;
  return (x + 1) >> 1;
}
inline int floor(int x) { return x >> 1; }
int Solve() {
  S = 0, T = n * 2 + 1;
  s = T + 1;
  t = T + 2;
  int x_lim = x_mp.size(), y_lim = y_mp.size();
  for (int i = 1; i <= x_lim; i++) {
    if (x_Sum[i] == 0) continue;
    int lower = ceil(x_Sum[i] - x_Limit[i]);
    int upper = floor(x_Sum[i] + x_Limit[i]);
    lower = max(lower, 0);
    upper = min(upper, x_Sum[i]);
    if (lower > upper) printf("-1"), exit(0);
    flow[S] -= lower;
    flow[i] += lower;
    add(S, i, upper - lower);
    add(i, S, 0);
  }
  for (int i = 1; i <= y_lim; i++) {
    if (y_Sum[i] == 0) continue;
    int lower = ceil(y_Sum[i] - y_Limit[i]);
    int upper = floor(y_Sum[i] + y_Limit[i]);
    lower = max(lower, 0);
    upper = min(upper, y_Sum[i]);
    if (lower > upper) printf("-1"), exit(0);
    flow[i + n] -= lower;
    flow[T] += lower;
    add(i + n, T, upper - lower);
    add(T, i + n, 0);
  }
  for (int i = 1; i <= n; i++)
    add(x_pos[i], y_pos[i] + n, 1), bel[i] = total,
                                    add(y_pos[i] + n, x_pos[i], 0);
  add(T, S, 2e9);
  add(S, T, 0);
  int full_flow = 0;
  for (int i = 0; i <= n * 2 + 1; i++) {
    if (flow[i] > 0) add(s, i, flow[i]), add(i, s, 0), full_flow += flow[i];
    if (flow[i] < 0) add(i, t, -flow[i]), add(t, i, 0);
  }
  ISAP();
  if (maxflow != full_flow) printf("-1"), exit(0);
  s = S;
  t = T;
  return ISAP();
}
}  // namespace maxFlow
signed main() {
  read(n, m);
  read(R_val, B_val);
  if (R_val > B_val) swap_flag = 1;
  for (int i = 1; i <= n; i++)
    read(x_pos[i], y_pos[i]), x_mp[x_pos[i]] = 0, y_mp[y_pos[i]] = 0;
  for (int i = 1; i <= m; i++) {
    read(dir_l[i], tar_l[i], lim_l[i]);
  }
  int tot;
  tot = 0;
  for (auto& i : x_mp) i.second = ++tot;
  tot = 0;
  for (auto& i : y_mp) i.second = ++tot;
  for (int i = 1; i <= n; i++)
    x_pos[i] = x_mp[x_pos[i]], y_pos[i] = y_mp[y_pos[i]];
  for (int i = 1; i <= m; i++) {
    if (dir_l[i] == 1)
      tar_l[i] = x_mp[tar_l[i]];
    else
      tar_l[i] = y_mp[tar_l[i]];
  }
  memset(x_Limit, 0x3f, sizeof(x_Limit));
  memset(y_Limit, 0x3f, sizeof(y_Limit));
  for (int i = 1; i <= n; i++) x_Sum[x_pos[i]]++, y_Sum[y_pos[i]]++;
  for (int i = 1; i <= m; i++)
    if (dir_l[i] == 1)
      x_Limit[tar_l[i]] = min(x_Limit[tar_l[i]], lim_l[i]);
    else
      y_Limit[tar_l[i]] = min(y_Limit[tar_l[i]], lim_l[i]);
  long long ans = maxFlow::Solve();
  printf("%lld\n", ans * (swap_flag ? B_val : R_val) +
                       (n - ans) * (swap_flag ? R_val : B_val));
  for (int i = 1; i <= n; i++)
    if (maxFlow::val[maxFlow::bel[i]] == 0)
      printf("%c", swap_flag ? 'b' : 'r');
    else
      printf("%c", swap_flag ? 'r' : 'b');
  return 0;
}