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.*;
import java.lang.reflect.Array;
import java.util.*;

public class DMain {
    String noResultMessage = "NoResult";
    Parser in = new Parser();
    PrintWriter out;

    int k = in.nextInteger();
    int n = in.nextInteger();
    int m = in.nextInteger();

    long[] as = in.nextLongs(k);

    long gcd(long a, long b){
        if(a < b)return gcd(b, a);
        while(b != 0){
            long rem = a%b;
            a = b;
            b = rem;
        }
        return a;
    }

    static class Improve implements Comparable<Improve>{
        int number;
        int type;
        int i;
        long b;

        long nom;
        long den;

        Improve(int number, int type, int i, int b) {
            this.number = number;
            this.type = type;
            this.i = i;
            this.b = b;
        }

        @Override
        public int compareTo(Improve o) {
            return Long.compare(o.b, b);
        }
    }

    public void solve() {

        Improve[] is = new Improve[n];

        int[][] count = new int[k][3];

        for(int i = 0; i < n; ++i){
            is[i] = new Improve(i + 1,
                    in.nextInteger() - 1,
                    in.nextInteger() - 1,
                    in.nextInteger());
            count[is[i].i][is[i].type]++;
        }

        Improve[][][] bucket = new Improve[k][3][];
        for(int i = 0; i < k; ++i){
            for(int t = 0; t < 3; ++t){
                bucket[i][t] = new Improve[count[i][t]];
            }
        }
        for(Improve i : is){
            bucket[i.i][i.type][--count[i.i][i.type]] = i;
        }
        List<Improve> possible = new ArrayList<Improve>(n);
        for(int i = 0; i < k; ++i){
            long a = as[i];
            Improve[] type2 = bucket[i][1];
            Arrays.sort(bucket[i][0]);
            if(bucket[i][0].length > 0 && bucket[i][0][0].b > as[i]){
                Improve impr = bucket[i][0][0];
                impr.b = impr.b - a;
                type2 = Arrays.copyOf(type2, type2.length + 1);
                type2[type2.length - 1] = impr;
            }
            Arrays.sort(type2);
            for(Improve impr : type2){
                long gcd = gcd(impr.b, as[i]);
                impr.nom = (impr.b + a) / gcd;
                impr.den = a / gcd;
                a += impr.b;
                possible.add(impr);
            }
            for(Improve impr : bucket[i][2]){
                impr.nom = impr.b;
                impr.den = 1;
                possible.add(impr);
            }
        }
        if(m < possible.size()) {
            Collections.sort(possible, new Comparator<Improve>() {
                @Override
                public int compare(Improve o1, Improve o2) {
                    return Long.compare(o2.nom * o1.den, o1.nom * o2.den);
                }
            });

            possible = possible.subList(0, m);
        }

        out.println(possible.size());

        for(int d = 0; d < 3; ++d){
            for(Improve i : possible){
                if(i.type != d) continue;
                out.print(i.number);
                out.print(" ");
            }
        }
    }

    static public class Parser{
        Scanner scanner;

        public Parser() {
            scanner = new Scanner(System.in).useLocale(Locale.ENGLISH);
        }

        public Parser(String str) {
            scanner = new Scanner(str).useLocale(Locale.ENGLISH);
        }

        long nextLong(){
            return scanner.nextLong();
        }

        int nextInteger(){
            return scanner.nextInt();
        }

        double nextDouble(){
            return scanner.nextDouble();
        }

        String nextLine(){
            return scanner.nextLine();
        }

        String next(){
            return scanner.next();
        }

        int[] nextIntegers(int count){
            int[] result = new int[count];
            for(int i = 0; i < count; ++i){
                result[i] = nextInteger();
            }
            return result;
        }

        long[] nextLongs(int count){
            long[] result = new long[count];
            for(int i = 0; i < count; ++i){
                result[i] = nextLong();
            }
            return result;
        }

        int[][] nextIntegers(int fields, int count){
            int[][] result = new int[fields][count];
            for(int c = 0; c < count; ++c){
                for(int i = 0; i < fields; ++i){
                    result[i][c] = nextInteger();
                }
            }
            return result;
        }
    }

    void noResult(){
        throw new NoResultException();
    }

    void noResult(String str){
        throw new NoResultException(str);
    }

    void run(){
        try{
            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
            out = new PrintWriter(System.out);
            solve();
            out.close();
            System.out.print(outStream.toString());
        } catch (NoResultException exc){
            System.out.print(null == exc.response ? noResultMessage : exc.response);
        }
    }

    public static void main(String[] args) {
        new DMain().run();
    }

    public static class NoResultException extends RuntimeException{
        private String response;

        public NoResultException(String response) {
            this.response = response;
        }

        public NoResultException() {
        }
    }
}