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;
template <class T>
int getbit(T s, int i) {
  return (s >> i) & 1;
}
template <class T>
T onbit(T s, int i) {
  return s | (T(1) << i);
}
template <class T>
T offbit(T s, int i) {
  return s & (~(T(1) << i));
}
template <class T>
int cntbit(T s) {
  return __builtin_popcounll(s);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int k, n, m;
int a[200005], b[200005];
vector<pair<int, int> > V[200005];
vector<pair<int, int> > VV;
int M[200005], vt[200005];
vector<pair<long double, int> > T[200005];
vector<pair<long double, int> > TT;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  memset(M, -1, sizeof(M));
  memset(vt, -1, sizeof(vt));
  cin >> k >> n >> m;
  for (int i = (1); i <= (k); ++i) {
    cin >> a[i];
  }
  for (int run = 0; run < (n); ++run) {
    int id, u, v;
    cin >> id >> u >> v;
    b[run + 1] = id;
    if (id == 1) {
      if (M[u] < v) {
        M[u] = v;
        vt[u] = run + 1;
      }
    } else if (id == 2) {
      V[u].push_back(make_pair(v, run + 1));
    } else {
      VV.push_back(make_pair(v, run + 1));
    }
  }
  sort((VV).begin(), (VV).end());
  priority_queue<pair<pair<long double, int>, pair<int, int> > > que;
  for (int i = (1); i <= (k); ++i) {
    if (M[i] > a[i]) {
      V[i].push_back(make_pair(M[i] - a[i], vt[i]));
    }
    sort((V[i]).begin(), (V[i]).end());
    long long run = a[i], temp;
    for (int j = ((int)(V[i]).size()) - 1; j >= 0; j--) {
      temp = run + V[i][j].first;
      T[i].push_back(make_pair(log(temp) - log(run), V[i][j].second));
      run = temp;
    }
    if (((int)(V[i]).size())) {
      que.push(
          make_pair(make_pair(T[i][0].first, T[i][0].second), make_pair(i, 0)));
    }
  }
  long double RR = 0;
  while (!que.empty()) {
    pair<long double, int> PP = que.top().first;
    long double x = PP.first;
    int t = PP.second;
    pair<int, int> P = que.top().second;
    int u = P.first, v = P.second;
    que.pop();
    if (((int)(T[u]).size()) >= v + 2) {
      que.push(make_pair(make_pair(T[u][v + 1].first, T[u][v + 1].second),
                         make_pair(u, v + 1)));
    }
    RR += x;
    TT.push_back(make_pair(RR, t));
  }
  RR = 0;
  long double MAX = -1;
  int vt = -1;
  for (int i = 0; i <= ((int)(VV).size()); i++) {
    if (i > m) break;
    int u = min(m - i, ((int)(TT).size()));
    u--;
    long double x;
    if (u >= 0)
      x = TT[u].first;
    else
      x = 0;
    if (MAX < x + RR) {
      MAX = x + RR;
      vt = i;
    }
    if (i < ((int)(VV).size())) RR += log(VV[((int)(VV).size()) - i - 1].first);
  }
  int u = min(m - vt, ((int)(TT).size()));
  cout << u + vt << endl;
  vector<pair<int, int> > res;
  for (int i = 1; i <= vt; i++)
    res.push_back(make_pair(b[VV[((int)(VV).size()) - i].second],
                            VV[((int)(VV).size()) - i].second));
  for (int i = 0; i < u; i++)
    res.push_back(make_pair(b[TT[i].second], TT[i].second));
  sort((res).begin(), (res).end());
  for (int i = 0; i < (((int)(res).size())); ++i) cout << res[i].second << " ";
  return 0;
}