Problem: Vasya plays one very well-known and extremely popular MMORPG game. His game character has k skill; currently the i-th of them equals to ai. Also this game has a common rating table in which the participants are ranked according to the product of all the skills of a hero in the descending order.

Vasya decided to 'upgrade' his character via the game store. This store offers n possible ways to improve the hero's skills; Each of these ways belongs to one of three types:

  1. assign the i-th skill to b; 
  2. add b to the i-th skill; 
  3. multiply the i-th skill by b. 



Unfortunately, a) every improvement can only be used once; b) the money on Vasya's card is enough only to purchase not more than m of the n improvements. Help Vasya to reach the highest ranking in the game. To do this tell Vasya which of improvements he has to purchase and in what order he should use them to make his rating become as high as possible. If there are several ways to achieve it, print any of them.

Input

The first line contains three numbers — k, n, m (1 ≤ k ≤ 105, 0 ≤ m ≤ n ≤ 105) — the number of skills, the number of improvements on sale and the number of them Vasya can afford.

The second line contains k space-separated numbers ai (1 ≤ ai ≤ 106), the initial values of skills.

Next n lines contain 3 space-separated numbers tj, ij, bj (1 ≤ tj ≤ 3, 1 ≤ ij ≤ k, 1 ≤ bj ≤ 106) — the type of the j-th improvement (1 for assigning, 2 for adding, 3 for multiplying), the skill to which it can be applied and the value of b for this improvement.

Output

The first line should contain a number l (0 ≤ l ≤ m) — the number of improvements you should use.

The second line should contain l distinct space-separated numbers vi (1 ≤ vi ≤ n) — the indices of improvements in the order in which they should be applied. The improvements are numbered starting from 1, in the order in which they appear in the input. 

Examples

Input

2 4 3
13 20
1 1 14
1 2 30
2 1 6
3 2 2


Output

3
2 3 4

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int h[100000], h1[100000];
double h2[100000];
int s[100000], d[100000];
void qs(int q, int w) {
  int e = q, r = w, t = d[q + (rand() % (w - q + 1))], y;
  do {
    while ((h1[d[e]] < h1[t]) || ((h1[d[e]] == h1[t]) && (h2[d[e]] > h2[t])))
      e++;
    while ((h1[d[r]] > h1[t]) || ((h1[d[r]] == h1[t]) && (h2[d[r]] < h2[t])))
      r--;
    if (e <= r) {
      y = d[e];
      d[e] = d[r];
      d[r] = y;
      e++;
      r--;
    }
  } while (e <= r);
  if (q < r) qs(q, r);
  if (e < w) qs(e, w);
}
void qs1(int q, int w) {
  int e = q, r = w, t = d[q + (rand() % (w - q + 1))], y;
  do {
    while (h2[d[e]] > h2[t]) e++;
    while (h2[d[r]] < h2[t]) r--;
    if (e <= r) {
      y = d[e];
      d[e] = d[r];
      d[r] = y;
      e++;
      r--;
    }
  } while (e <= r);
  if (q < r) qs1(q, r);
  if (e < w) qs1(e, w);
}
void qs2(int q, int w) {
  int e = q, r = w, t = d[q + (rand() % (w - q + 1))], y;
  do {
    while (h[d[e]] < h[t]) e++;
    while (h[d[r]] > h[t]) r--;
    if (e <= r) {
      y = d[e];
      d[e] = d[r];
      d[r] = y;
      e++;
      r--;
    }
  } while (e <= r);
  if (q < r) qs2(q, r);
  if (e < w) qs2(e, w);
}
int main() {
  int q, w, e, r, t, t1, o;
  long long a[100000];
  cin >> o >> q >> w;
  for (e = 0; e < o; e++) {
    scanf("%d", &r);
    a[e] = r;
    s[e] = -1;
  }
  t = 0;
  for (e = 0; e < q; e++) {
    scanf("%d%d%d", &h[e], &h1[e], &r);
    h2[e] = r;
    h1[e]--;
    if ((h[e] == 1) && (h2[e] > a[h1[e]])) {
      if (s[h1[e]] < 0)
        s[h1[e]] = e;
      else if (h2[s[h1[e]]] < h2[e])
        s[h1[e]] = e;
    }
  }
  for (e = 0; e < o; e++)
    if (s[e] >= 0) {
      d[t] = s[e];
      h2[s[e]] -= a[s[e]];
      t++;
    }
  for (e = 0; e < q; e++)
    if (h[e] == 2) {
      d[t] = e;
      t++;
    }
  if (t > 0) qs(0, t - 1);
  int c;
  for (e = 0; e < t; e++) {
    r = d[e];
    c = (int)(h2[r] + 0.0001);
    h2[r] = ((double)(h2[r] + a[h1[r]])) / ((double)a[h1[r]]);
    a[h1[r]] += c;
  }
  for (e = 0; e < q; e++)
    if (h[e] == 3) {
      d[t] = e;
      t++;
    }
  if (t > 0) qs1(0, t - 1);
  w = min(w, t);
  printf("%d\n", w);
  if (w > 0) qs2(0, w - 1);
  for (e = 0; e < w; e++) printf("%d ", d[e] + 1);
  return 0;
}