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 = 100000, INF = (1 << 30) - 1;
int n, m, v[2], x[N + 9], y[N + 9], ord[N + 9], co;
int opt[N + 9], l[N + 9], d[N + 9];
void into() {
  scanf("%d%d%d%d", &n, &m, &v[0], &v[1]);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &x[i], &y[i]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d%d", &opt[i], &l[i], &d[i]);
    assert(d[i] >= 0 && d[i] <= n);
  }
}
int dx[N + 9], dy[N + 9], cx[N + 9], cy[N + 9];
void Get_xy() {
  for (int i = 1; i <= m; ++i) dx[i] = dy[i] = n;
  for (int i = 1; i <= n; ++i) ord[++co] = x[i];
  sort(ord + 1, ord + co + 1);
  co = unique(ord + 1, ord + co + 1) - ord - 1;
  for (int i = 1; i <= n; ++i)
    ++cx[x[i] = lower_bound(ord + 1, ord + co + 1, x[i]) - ord];
  for (int i = 1; i <= m; ++i) {
    if (opt[i] == 2) continue;
    int p = lower_bound(ord + 1, ord + co + 1, l[i]) - ord;
    if (l[i] == ord[p]) dx[p] = min(dx[p], d[i]);
  }
  co = 0;
  for (int i = 1; i <= n; ++i) ord[++co] = y[i];
  sort(ord + 1, ord + co + 1);
  co = unique(ord + 1, ord + co + 1) - ord - 1;
  for (int i = 1; i <= n; ++i)
    ++cy[y[i] = lower_bound(ord + 1, ord + co + 1, y[i]) - ord];
  for (int i = 1; i <= m; ++i) {
    if (opt[i] == 1) continue;
    int p = lower_bound(ord + 1, ord + co + 1, l[i]) - ord;
    if (l[i] == ord[p]) dy[p] = min(dy[p], d[i]);
  }
}
int st, td, st0, td0, cn;
int sum, df[N * 2 + 9];
long long ans;
struct side {
  int y, next, f;
} e[N * 20 + 9];
int lin[N * 2 + 9], cs;
void Ins(int x, int y, int f) {
  e[++cs].y = y;
  e[cs].f = f;
  e[cs].next = lin[x];
  lin[x] = cs;
}
void Ins_flow(int x, int y, int f) {
  Ins(x, y, f);
  Ins(y, x, 0);
}
void Get_graph() {
  cs = 1;
  st0 = n * 2 + 1;
  td0 = n * 2 + 2;
  st = n * 2 + 3;
  td = cn = n * 2 + 4;
  for (int i = 1; i <= n; ++i) Ins_flow(x[i], y[i] + n, 1);
  for (int i = 1; i <= n; ++i) {
    int l = max(cx[i] - dx[i] + 1 >> 1, 0), r = cx[i] - l;
    if (l > r) {
      ans = -1;
      return;
    }
    Ins_flow(st0, i, r - l);
    df[st0] -= l;
    df[i] += l;
    l = max(cy[i] - dy[i] + 1 >> 1, 0);
    r = cy[i] - l;
    if (l > r) {
      ans = -1;
      return;
    }
    Ins_flow(i + n, td0, r - l);
    df[i + n] -= l;
    df[td0] += l;
  }
  for (int i = 1; i <= cn - 2; ++i) {
    if (!df[i]) continue;
    df[i] > 0 ? Ins_flow(st, i, df[i]) : Ins_flow(i, td, -df[i]);
    sum += max(df[i], 0);
  }
  Ins_flow(td0, st0, INF);
}
int dis[N * 2 + 9];
queue<int> q;
bool Bfs_dis(int st, int td) {
  for (int i = 1; i <= cn; ++i) dis[i] = 0;
  dis[st] = 1;
  q.push(st);
  for (; !q.empty();) {
    int t = q.front();
    q.pop();
    for (int i = lin[t]; i; i = e[i].next)
      if (e[i].f && !dis[e[i].y]) dis[e[i].y] = dis[t] + 1, q.push(e[i].y);
  }
  return dis[td];
}
int cur[N * 2 + 9];
int Dfs_flow(int k, int td, int f) {
  if (k == td || !f) return f;
  int res = 0;
  for (int &i = cur[k]; i; i = e[i].next)
    if (e[i].f && dis[k] + 1 == dis[e[i].y]) {
      int t = Dfs_flow(e[i].y, td, min(f, e[i].f));
      if (!t) dis[e[i].y] = 0;
      f -= t;
      res += t;
      e[i].f -= t;
      e[i ^ 1].f += t;
      if (!f) return res;
    }
  return res;
}
int Max_flow(int st, int td) {
  int res = 0;
  for (; Bfs_dis(st, td); res += Dfs_flow(st, td, INF))
    for (int i = 1; i <= cn; ++i) cur[i] = lin[i];
  return res;
}
int flag;
void Get_ans() {
  if (ans == -1) return;
  if (v[0] < v[1]) swap(v[0], v[1]), flag = 1;
  int t = Max_flow(st, td);
  ans = t == sum ? Max_flow(st0, td0) : -1;
}
void work() {
  Get_xy();
  Get_graph();
  Get_ans();
}
void outo() {
  if (ans == -1)
    puts("-1");
  else {
    printf("%lld\n", (n - ans) * v[0] + ans * v[1]);
    for (int i = 2; i <= n << 1; i += 2) putchar(e[i].f ^ flag ? 'r' : 'b');
  }
}
int main() {
  into();
  work();
  outo();
  return 0;
}