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;
const int N = 100005;
struct frac {
  long long x, y;
  bool operator<(const frac &a) const { return 1ll * x * a.y < 1ll * y * a.x; }
};
priority_queue<pair<int, int> > Q[4][N];
int k, n, m, nn;
int mx[N * 4], type[N];
frac val[N * 2];
long long a[N], b[N];
vector<int> Q1, Q2, Q3;
int Mx(int x, int y) { return val[x] < val[y] ? y : x; }
void build(int n) {
  for (nn = 1; nn <= n + 1; nn <<= 1)
    ;
  for (int i = (int)(0); i <= (int)(nn - 1); i++)
    val[i] = (frac){0, 1}, mx[i + nn] = i;
  for (int i = (int)(nn - 1); i >= (int)(1); i--)
    mx[i] = Mx(mx[i * 2], mx[i * 2 + 1]);
}
void update(int x) {
  val[x] = (frac){0, 1};
  frac tmp;
  if (Q[1][x].empty())
    tmp = (frac){0, 1};
  else
    tmp = (frac){Q[1][x].top().first - a[x], b[x]};
  if (!(tmp < val[x])) val[x] = tmp, type[x] = 1;
  if (Q[2][x].empty())
    tmp = (frac){0, 1};
  else
    tmp = (frac){Q[2][x].top().first, b[x]};
  if (!(tmp < val[x])) val[x] = tmp, type[x] = 2;
  if (Q[3][x].empty())
    tmp = (frac){0, 1};
  else
    tmp = (frac){Q[3][x].top().first - 1, 1};
  if (!(tmp < val[x])) val[x] = tmp, type[x] = 3;
  for (x = (x + nn) >> 1; x; x >>= 1) mx[x] = Mx(mx[x * 2], mx[x * 2 + 1]);
}
int main() {
  scanf("%d%d%d", &k, &n, &m);
  for (int i = (int)(1); i <= (int)(k); i++) scanf("%lld", &a[i]), b[i] = a[i];
  for (int i = (int)(1); i <= (int)(n); i++) {
    int x, y, v;
    scanf("%d%d%d", &x, &y, &v);
    Q[x][y].push(pair<int, int>(v, i));
  }
  build(k);
  for (int i = (int)(1); i <= (int)(k); i++) update(i);
  for (int i = (int)(1); i <= (int)(m); i++) {
    frac tmp = val[mx[1]];
    if (!((frac){0, 1} < tmp)) break;
    int x = mx[1];
    if (type[x] == 1) {
      Q1.push_back(Q[1][x].top().second);
      int v = Q[1][x].top().first - a[x];
      a[x] += v;
      b[x] += v;
      Q[1][x].pop();
      update(x);
    } else if (type[x] == 2) {
      Q2.push_back(Q[2][x].top().second);
      b[x] += Q[2][x].top().first;
      Q[2][x].pop();
      update(x);
    } else {
      Q3.push_back(Q[3][x].top().second);
      Q[3][x].pop();
      update(x);
    }
  }
  printf("%d\n", Q1.size() + Q2.size() + Q3.size());
  for (int i = (int)(0); i <= (int)(Q1.size() - 1); i++) printf("%d ", Q1[i]);
  for (int i = (int)(0); i <= (int)(Q2.size() - 1); i++) printf("%d ", Q2[i]);
  for (int i = (int)(0); i <= (int)(Q3.size() - 1); i++) printf("%d ", Q3[i]);
}