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;
namespace io {
const int SI = 1 << 21 | 1;
char IB[SI], *IS, *IT, OB[SI], *OS = OB, *OT = OS + SI - 1, c, ch[100];
int f, t;
inline void flush() { fwrite(OB, 1, OS - OB, stdout), OS = OB; }
inline void pc(char x) {
  *OS++ = x;
  if (OS == OT) flush();
}
template <class I>
inline void rd(I &x) {
  for (f = 1, c = (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin),
                              IS == IT ? EOF : *IS++)
                            : *IS++);
       c < '0' || c > '9';
       c = (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin),
                       IS == IT ? EOF : *IS++)
                     : *IS++))
    if (c == '-') f = -1;
  for (x = 0; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + (c & 15),
      c = (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin),
                      IS == IT ? EOF : *IS++)
                    : *IS++))
    ;
  x *= f;
}
inline void rds(char *s, int &x) {
  for (c = (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin),
                       IS == IT ? EOF : *IS++)
                     : *IS++);
       c < 33 || c > 126;
       c = (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin),
                       IS == IT ? EOF : *IS++)
                     : *IS++))
    ;
  for (x = 0; c >= 33 && c <= 126;
       s[++x] = c, c = (IS == IT ? (IT = (IS = IB) + fread(IB, 1, SI, stdin),
                                   IS == IT ? EOF : *IS++)
                                 : *IS++))
    ;
  s[x + 1] = '\0';
}
template <class I>
inline void print(I x, char k = '\n') {
  if (!x) pc('0');
  if (x < 0) pc('-'), x = -x;
  while (x) ch[++t] = x % 10 + '0', x /= 10;
  while (t) pc(ch[t--]);
  pc(k);
}
inline void prints(string s) {
  int x = s.length();
  while (t < x) pc(s[t++]);
  pc('\n'), t = 0;
}
struct Flush {
  ~Flush() { flush(); }
} flusher;
}  // namespace io
using io::print;
using io::prints;
using io::rd;
using io::rds;
const int N = 1e5 + 7;
int n, m, k, s;
unsigned int t[N];
long long a[N], b;
pair<long long, int> v1[N];
vector<pair<long long, int> > v2[N], v3;
priority_queue<pair<long double, int> > q;
vector<int> ans;
inline void print() {
  for (int i = 1; i <= k; i++) {
    for (unsigned int j = 0; j < t[i]; j++)
      if (v2[i][j].second < 0) ans.push_back(-v2[i][j].second);
    for (unsigned int j = 0; j < t[i]; j++)
      if (v2[i][j].second > 0) ans.push_back(v2[i][j].second);
  }
  while (v3.size()) ans.push_back(v3.back().second), v3.pop_back();
  print(ans.size());
  for (auto x : ans) print(x, ' ');
}
inline void get(int x) {
  if (t[x] < v2[x].size())
    q.push(make_pair(1.0L * v2[x][t[x]++].first / a[x], x));
}
int main() {
  rd(k), rd(n), rd(m);
  for (int i = 1; i <= k; i++) rd(a[i]);
  for (int i = 1, o, x; i <= n; i++) {
    rd(o), rd(x), rd(b);
    if (o == 1) v1[x] = max(v1[x], make_pair(b, i));
    if (o == 2) v2[x].push_back(make_pair(b, i));
    if (o == 3) v3.push_back(make_pair(b, i));
  }
  for (int i = 1; i <= k; i++) {
    if (v1[i].first > a[i])
      v2[i].push_back(make_pair(v1[i].first - a[i], -v1[i].second));
    sort(v2[i].begin(), v2[i].end());
    reverse(v2[i].begin(), v2[i].end());
    s += v2[i].size();
  }
  sort(v3.begin(), v3.end());
  reverse(v3.begin(), v3.end());
  while ((int)v3.size() > m) v3.pop_back();
  if (s + (int)v3.size() <= m) {
    for (int i = 1; i <= k; i++) t[i] = v2[i].size();
    return print(), 0;
  }
  for (int i = 1; i <= k; i++) get(i);
  for (int i = v3.size(); i < m; i++) {
    int x = q.top().second;
    q.pop(), a[x] += v2[x][t[x] - 1].first, get(x);
  }
  while (v3.size()) {
    int x = q.top().second;
    long long b1 = v2[x][t[x] - 1].first, b2 = v3.back().first;
    if (b1 <= a[x] * (b2 - 1)) break;
    q.pop(), v3.pop_back(), a[x] += b1, get(x);
  }
  while (q.size()) {
    int x = q.top().second;
    q.pop(), --t[x];
  }
  return print(), 0;
}