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;
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
long long min(long long a, long long b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}
struct P {
  double x, y;
  P() {}
  P(int x, int y) : x(double(x)), y(double(y)) {}
  P(double x, double y) : x(x), y(y) {}
  P operator+(const P &a) const { return P(x + a.x, y + a.y); }
  P operator-(const P &a) const { return P(x - a.x, y - a.y); }
  double operator^(const P &a) const { return x * a.x + y * a.y; }
  void in() { scanf("%lf%lf", &x, &y); }
  void out() { printf("REQUIRED %.7f %.7f\n", x, y); }
  double dist(P a, P b) {
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
  }
  double sqdist(P a, P b) {
    return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
  }
};
int vv[100001], tot, tot2, n, m, id[100001];
long long a[100001];
struct dat2 {
  long long m, kid;
  int id, ty;
} a2[100001];
struct dat {
  long long m;
  int id;
} a3[100001];
bool operator<(dat u, dat v) { return u.m > v.m; }
bool operator<(dat2 u, dat2 v) {
  if (u.kid < v.kid) return true;
  if (u.kid > v.kid) return false;
  return u.m < v.m;
}
int res[100001], boom[100001];
struct dat3 {
  long long up, down;
  int id;
  dat3(long long up, long long down, int id) : up(up), down(down), id(id) {}
};
bool operator<(dat3 u, dat3 v) { return u.up * v.down < v.up * u.down; }
priority_queue<dat3> Q;
struct dat4 {
  int tt;
  long long id;
} u2[100001];
bool operator<(dat4 u, dat4 v) { return u.tt < v.tt; }
int k;
int main() {
  scanf("%d%d%d", &k, &n, &m);
  for (int i = (1); i <= (k); i++) scanf("%d", &a[i]);
  for (int i = (1); i <= (k); i++) vv[i] = -1;
  for (int i = (1); i <= (n); i++) {
    int ty, ti;
    long long bi;
    scanf("%d%d%I64d", &ty, &ti, &bi);
    if (ty == 1) {
      if (vv[ti] < bi) {
        vv[ti] = bi;
        id[ti] = i;
      }
    } else if (ty == 2) {
      a2[++tot].id = i;
      a2[tot].kid = ti;
      a2[tot].m = bi;
      a2[tot].ty = 2;
    } else if (bi > 1) {
      a3[++tot2].id = i;
      a3[tot2].m = bi;
    }
  }
  for (int i = (1); i <= (k); i++)
    if (vv[i] > a[i]) {
      int dif = vv[i] - a[i];
      a2[++tot].id = id[i];
      a2[tot].kid = i;
      a2[tot].m = (long long)dif;
      a2[tot].ty = 1;
    }
  if (tot + tot2 <= m) {
    printf("%d\n", tot + tot2);
    int cc = 0;
    for (int i = (1); i <= (tot); i++) {
      u2[++cc].id = a2[i].id;
      u2[cc].tt = a2[i].ty;
    }
    for (int i = (1); i <= (tot2); i++) {
      u2[++cc].id = a3[i].id;
      u2[cc].tt = 3;
    }
    sort(u2 + 1, u2 + cc + 1);
    for (int i = (1); i <= (tot + tot2); i++) printf("%d ", u2[i].id);
    puts("");
    return 0;
  }
  sort(a2 + 1, a2 + tot + 1);
  sort(a3 + 1, a3 + tot2 + 1);
  for (int i = (1); i <= (tot); i++) {
    if (i == tot || a2[i].kid != a2[i + 1].kid) {
      Q.push(dat3(a2[i].m, a[a2[i].kid], i));
    }
  }
  int w = 1;
  for (int i = (1); i <= (tot + tot2); i++) {
    if (Q.size() == 0) {
      res[i] = a3[w++].id;
      boom[i] = 3;
    } else {
      dat3 X = Q.top();
      long long p = X.up / X.down + 1;
      if (w > tot2 || p >= a3[w].m) {
        Q.pop();
        res[i] = a2[X.id].id;
        boom[i] = a2[X.id].ty;
        a[a2[X.id].kid] += X.up;
        if (X.id != 1 && a2[X.id].kid == a2[X.id - 1].kid) {
          Q.push(dat3(a2[X.id - 1].m, a[a2[X.id].kid], X.id - 1));
        }
      } else {
        res[i] = a3[w++].id;
        boom[i] = 3;
      }
    }
  }
  for (int i = (1); i <= (m); i++) {
    u2[i].id = res[i];
    u2[i].tt = boom[i];
  }
  sort(u2 + 1, u2 + m + 1);
  printf("%d\n", m);
  for (int i = (1); i <= (m); i++) printf("%d ", u2[i].id);
  puts("");
  return 0;
}