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 = 2e5 + 100, M = N << 5, INF = 0x3f3f3f3f;
int n, m, R, B, w[N];
bool fg;
int read() {
  int ret = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) ret = ret * 10 + (c ^ 48), c = getchar();
  return ret;
}
void failed() {
  puts("-1");
  exit(0);
}
namespace Flow {
int S, T, SS, TT, tot, sum;
int head[N], cur[N], d[N], dis[N];
queue<int> q;
struct Tway {
  int v, w, nex;
} e[M];
void add(int u, int v, int w) {
  e[++tot] = (Tway){v, w, head[u]};
  head[u] = tot;
  e[++tot] = (Tway){u, 0, head[v]};
  head[v] = tot;
}
void addud(int u, int v, int l, int r) {
  add(u, v, r - l);
  d[u] -= l;
  d[v] += l;
}
void updata() {
  for (int i = 0; i < N; ++i)
    if (d[i] > 0)
      add(SS, i, d[i]), sum += d[i];
    else
      add(i, TT, -d[i]);
}
void initflow() {
  S = N - 1;
  T = N - 2;
  SS = N - 3;
  TT = N - 4;
  tot = 1;
}
bool bfs(int s, int t) {
  memset(dis, -1, sizeof(dis));
  memcpy(cur, head, sizeof(head));
  q.push(s);
  dis[s] = 0;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = head[x]; i; i = e[i].nex) {
      int v = e[i].v;
      if (e[i].w && !~dis[v]) dis[v] = dis[x] + 1, q.push(v);
    }
  }
  return ~dis[t];
}
int dfs(int x, int fn, int flow) {
  if (x == fn || !flow) return flow;
  int used = 0, u;
  for (int &i = cur[x]; i; i = e[i].nex) {
    int v = e[i].v;
    if (dis[v] == dis[x] + 1 && (u = dfs(v, fn, min(e[i].w, flow - used)))) {
      e[i].w -= u;
      e[i ^ 1].w += u;
      used += u;
      if (used == flow) break;
    }
  }
  return used;
}
int dinic(int s, int t) {
  int res = 0;
  while (bfs(s, t)) res += dfs(s, t, INF);
  return res;
}
void FFFlow() {
  updata();
  add(T, S, INF);
  int res = dinic(SS, TT);
  if (res ^ sum) failed();
  res = dinic(S, T);
  printf("%lld\n", 1ll * res * R + 1ll * (n - res) * B);
  for (int i = 1; i <= n; ++i) putchar((e[w[i]].w ^ fg) ? 'b' : 'r');
}
}  // namespace Flow
using namespace Flow;
namespace DreamLolita {
int cnt1, cnt2;
int sum1[N], sum2[N], mi1[N], mi2[N];
pair<int, int> a[N], b[N], p[N];
map<int, int> f1, f2;
void solve() {
  n = read();
  m = read();
  R = read();
  B = read();
  initflow();
  if (R > B) swap(R, B), fg = 1;
  for (int i = 1; i <= n; ++i)
    a[i].first = read(), b[i].first = read(), a[i].second = b[i].second = i;
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  for (int i = 1; i <= n; ++i) {
    if (a[i].first ^ a[i - 1].first) f1[a[i].first] = ++cnt1;
    p[a[i].second].first = cnt1;
    sum1[cnt1]++;
    if (b[i].first ^ b[i - 1].first) f2[b[i].first] = ++cnt2;
    p[b[i].second].second = cnt2;
    sum2[cnt2]++;
  }
  for (int i = 1; i <= cnt1; ++i) mi1[i] = sum1[i];
  for (int i = 1; i <= cnt2; ++i) mi2[i] = sum2[i];
  for (int i = 1; i <= n; ++i)
    add(p[i].first, p[i].second + cnt1, 1), w[i] = tot - 1;
  for (int i = 1; i <= m; ++i) {
    int t = read(), l = read(), d = read();
    if (t & 1) {
      if (!f1.count(l)) continue;
      l = f1[l];
      mi1[l] = min(mi1[l], d);
    } else {
      if (!f2.count(l)) continue;
      l = f2[l];
      mi2[l] = min(mi2[l], d);
    }
  }
  for (int i = 1; i <= cnt1; ++i) {
    if (!mi1[i] && sum1[i] & 1) failed();
    addud(S, i, (sum1[i] - mi1[i] + 1) / 2, (sum1[i] + mi1[i]) / 2);
  }
  for (int i = 1; i <= cnt2; ++i) {
    if (!mi2[i] && sum2[i] & 1) failed();
    addud(i + cnt1, T, (sum2[i] - mi2[i] + 1) / 2, (sum2[i] + mi2[i]) / 2);
  }
  FFFlow();
}
}  // namespace DreamLolita
int main() {
  DreamLolita::solve();
  return 0;
}