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;
bool debug;
const int inf = 1e9 + 5;
const int nax = 1e6 + 5;
struct cmp {
  bool operator()(
      pair<pair<long long, long long>, pair<long long, long long> > const& i,
      pair<pair<long long, long long>, pair<long long, long long> > const& j)
      const {
    if (i.first.first * j.first.second == j.first.first * i.first.second)
      return i.second < j.second;
    return i.first.first * j.first.second > j.first.first * i.first.second;
  }
};
set<pair<pair<long long, long long>, pair<long long, long long> >, cmp> secik;
int k, n, m, t, x, b;
long long skill[nax];
pair<int, int> ass[nax];
vector<pair<int, int> > dodaj[nax], mnoz[nax], wynik;
void ogarnij(int x) {
  if (dodaj[x].empty() && mnoz[x].empty()) return;
  pair<pair<long long, long long>, pair<long long, long long> >
      d = make_pair(make_pair(0, 1), make_pair(0, 0)),
      mn = make_pair(make_pair(0, 1), make_pair(0, 0));
  if (!dodaj[x].empty())
    d = make_pair(make_pair(dodaj[x].back().first, skill[x]), make_pair(x, 1));
  if (!mnoz[x].empty())
    mn = make_pair(make_pair(mnoz[x].back().first - 1, 1), make_pair(x, 2));
  if (cmp()(d, mn))
    secik.insert(d);
  else
    secik.insert(mn);
}
int main(int argc, char* argv[]) {
  debug = argc > 1;
  scanf("%d%d%d", &k, &n, &m);
  for (int i = 1; i <= k; ++i) scanf("%lld", &skill[i]);
  for (int i = 0; i <= (n)-1; ++i) {
    scanf("%d%d%d", &t, &x, &b);
    if (t == 1) {
      if (ass[x].first < b) ass[x] = make_pair(b, i + 1);
    }
    if (t == 2) dodaj[x].push_back(make_pair(b, i + 1));
    if (t == 3 && b != 1) mnoz[x].push_back(make_pair(b, i + 1));
  }
  for (int i = 1; i <= k; ++i) {
    if (ass[i].first > skill[i]) {
      dodaj[i].push_back(make_pair(ass[i].first - skill[i], ass[i].second));
      ass[i].first -= skill[i];
    } else
      ass[i].first = 0;
    sort(dodaj[i].begin(), dodaj[i].end());
    sort(mnoz[i].begin(), mnoz[i].end());
    ogarnij(i);
  }
  for (int i = 0; i <= (m)-1; ++i) {
    if (secik.empty()) break;
    pair<int, int> x = secik.begin()->second;
    secik.erase(secik.begin());
    if (x.second == 1) {
      skill[x.first] += dodaj[x.first].back().first;
      if (dodaj[x.first].back().first == ass[x.first].first) {
        wynik.push_back(make_pair(ass[x.first].second, 0));
        ass[x.first].first = 0;
      } else
        wynik.push_back(make_pair(dodaj[x.first].back().second, 1));
      dodaj[x.first].pop_back();
    } else {
      wynik.push_back(make_pair(mnoz[x.first].back().second, 2));
      mnoz[x.first].pop_back();
    }
    ogarnij(x.first);
  }
  sort(wynik.begin(), wynik.end());
  printf("%d\n", (int)wynik.size());
  for (int i = 0; i <= (3) - 1; ++i)
    for (auto j : wynik)
      if (j.second == i) printf("%d ", j.first);
  puts("");
  return 0;
}