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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class TaskD {

  public static void main(String[] args)
  {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    PrintWriter out = new PrintWriter(outputStream);
    TaskD solver = new TaskD();
    solver.solve(1, new InputStreamReader(inputStream), out);
    out.close();
  }


  static class Query
  {
    public int type, ind, val, id;
    public long cum;
    private Query(int type, int ind, int val, int id) {
      this.type = type;
      this.ind = ind;
      this.val = val;
      this.id = id;
    }
    @Override
    public String toString() {
      return "Query [type=" + type + ", ind=" + ind + ", val=" + val
          + ", id=" + id + ", cum=" + cum + "]";
    }
  }


  public void solve(int test, Reader input, PrintWriter out)
  {
    MyScanner in = new MyScanner(input);

    int k = in.nextInt(), n = in.nextInt(), m = in.nextInt();
    int[] a = new int[k];
    for(int i = 0; i < k; i++)
      a[i] = in.nextInt();

    Query[] qs = new Query[n];
    for(int i = 0;i < n;i++){
      qs[i] = new Query(in.nextInt(), in.nextInt()-1, in.nextInt(), i);
    }

    Query[] muls = new Query[n];
    int mp = 0;
    for(int i = 0;i < n;i++){
      if(qs[i].type == 3)muls[mp++] = qs[i];
    }
    muls = Arrays.copyOf(muls, mp);
    Arrays.sort(muls, new Comparator<Query>() {
      public int compare(Query a, Query b) {
        return -(a.val - b.val);
      }
    });

    Query[] assigns = new Query[k];
    for(int i = 0;i < n;i++){
      if(qs[i].type == 1 && (assigns[qs[i].ind] == null || qs[i].val > assigns[qs[i].ind].val) && qs[i].val > a[qs[i].ind]){
        assigns[qs[i].ind] = qs[i];
      }
    }

    Query[][] adds = new Query[k][];
    int[] aps = new int[k];
    for(int i = 0;i < k;i++)if(assigns[i] != null)aps[i]++;
    for(int i = 0;i < n;i++){
      if(qs[i].type == 2){
        aps[qs[i].ind]++;
      }
    }
    for(int i = 0;i < k;i++)adds[i] = new Query[aps[i]];
    for(int i = 0;i < k;i++)if(assigns[i] != null){
      assigns[i].val -= a[i];
      adds[i][--aps[i]] = assigns[i];
    }
    for(int i = 0;i < n;i++){
      if(qs[i].type == 2){
        adds[qs[i].ind][--aps[qs[i].ind]] = qs[i];
      }
    }
    for(int i = 0;i < k;i++)assert aps[i] == 0;

    for(int i = 0;i < k;i++){
      if(adds[i].length == 0)continue;
      Arrays.sort(adds[i], new Comparator<Query>() {
        public int compare(Query a, Query b) {
          return -Long.compare(a.val, b.val);
        }
      });
      adds[i][0].cum = a[i];
      for(int j = 1;j < adds[i].length;j++){
        adds[i][j].cum = adds[i][j-1].cum + adds[i][j-1].val;
      }
    }

    Query[] con = new Query[n];
    int cp = 0;
    for(int i = 0;i < k;i++){
      for(Query q : adds[i]){
        con[cp++] = q;
      }
    }
    Arrays.sort(con, 0, cp, new Comparator<Query>() {
      public int compare(Query a, Query b) {
        if(a.ind == b.ind){
          return -(a.val - b.val);
        }else{
          return Long.compare(a.cum*b.val, a.val*b.cum);
        }
      }
    });

    int bnadd = cp, bnmul = mp;
    if(bnadd + bnmul > m){
      bnadd = Math.min(m, cp); bnmul = m-bnadd;
      for(int nadd = Math.max(0, m-mp);nadd <= cp-1 && nadd < m;nadd++){ // #add
        int nmul = m-nadd;
        long orig = con[nadd].cum * muls[nmul-1].val;
        long next = con[nadd].cum + con[nadd].val;
        if(orig > next){
          bnadd = nadd; bnmul = nmul;
          break;
        }
      }
    }

    Arrays.sort(con, 0, bnadd, new Comparator<Query>() {
      public int compare(Query a, Query b) {
        return a.type - b.type;
      }
    });


    out.println(bnadd+bnmul);
    for(int i = 0;i < bnadd;i++){
      out.print(con[i].id+1 + " ");
    }
    for(int i = 0;i < bnmul;i++){
      out.print(muls[i].id+1 + " ");
    }
    out.println();
  }

  //-----------MyScanner class for faster input----------
  public static class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner(Reader reader) {
      br = new BufferedReader(reader);
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine(){
      String str = "";
      try {
        str = br.readLine();
      } catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }

  }
  //--------------------------------------------------------
}