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.util.*;
import java.io.*;
public class Shop
{
	public static void main(String[] args) throws Exception
	{
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		int k = in.nextInt();
		int n = in.nextInt();
		int m = in.nextInt();
		
		long[] array = new long[k];
		for(int x = 0; x < k; x++)
		{
			array[x] = in.nextInt();
		}
		
		ArrayList<Item>[] skills = new ArrayList[k];
		for(int x = 0; x < skills.length; x++)
		{
			skills[x] = new ArrayList<Item>();
		}
		
		ArrayList<Item> mult = new ArrayList<Item>();
		Item[] init = new Item[k];
		TreeSet<Integer> ones = new TreeSet<Integer>();
		for(int y = 0; y < n; y++)
		{
			int t = in.nextInt();
			int i = in.nextInt() - 1;
			int b = in.nextInt();
			
			if(t == 3)
			{
				mult.add(new Item(t, b, y));
			}
			else if(t == 2)
			{
				skills[i].add(new Item(t, b, y));
			}
			else
			{
				if(b >= array[i] && (init[i] == null || b > init[i].amount))
				{
					init[i] = new Item(t, b, y);
				}
				
				ones.add(y);
			}
		}
		
		Collections.sort(mult);
		
		for(int z = 0; z < skills.length; z++)
		{
			if(init[z] != null)
			{
				skills[z].add(new Item(2, init[z].amount - array[z], init[z].index));
			}
			
			Collections.sort(skills[z]);
		}
		
		int[] indices = new int[k];
		
		double[] adds = new double[m + 1];
		for(int a = 0; a < array.length; a++)
		{
			adds[0] += Math.log(array[a]);
		}
		
		PriorityQueue<Add> pq = new PriorityQueue<Add>();
		for(int b = 0; b < skills.length; b++)
		{
			if(skills[b].size() > 0)
			{
				pq.add(new Add(array[b], skills[b].get(0).amount, b));
			}
		}
		
		int totalAdds = 0;
		ArrayList<Integer> addResult = new ArrayList<Integer>();
		while(pq.size() > 0 && totalAdds < m)
		{
			totalAdds++;
			
			Add current = pq.poll();
			
			adds[totalAdds] = adds[totalAdds - 1] - Math.log(array[current.skill]) + Math.log(array[current.skill] + current.amount);
			array[current.skill] += current.amount;
			
			indices[current.skill]++;
			
			if(indices[current.skill] < skills[current.skill].size())
			{
				pq.add(new Add(array[current.skill], skills[current.skill].get(indices[current.skill]).amount, current.skill));
			}
			
			addResult.add(skills[current.skill].get(indices[current.skill] - 1).index);
		}
		
//		System.out.println(Arrays.toString(array));
//		System.out.println(Arrays.toString(adds));
		
		double best = -1;
		int countMults = -1;
		double current = 0;
		for(int c = 0; c <= Math.min(m, mult.size()); c++)
		{
			if(current + adds[Math.min(m - c, totalAdds)] > best)
			{
				best = current + adds[Math.min(m - c, totalAdds)];
				countMults = c;
			}
			
//			System.out.println(current);
			
			if(c < mult.size())
			{
				current += Math.log(mult.get(c).amount);
			}
		}
		
		int countAdds = Math.min(m - countMults, totalAdds);
		
		out.println(countAdds + countMults);
		
		ArrayList<Integer> result = new ArrayList<Integer>();
		for(int d = 0; d < countAdds; d++)
		{
			if(ones.contains(addResult.get(d)))
			{
				result.add(addResult.get(d));
			}
		}
		
		for(int e = 0; e < countAdds; e++)
		{
			if(!ones.contains(addResult.get(e)))
			{
				result.add(addResult.get(e));
			}
		}
		
		for(int f = 0; f < countMults; f++)
		{
			result.add(mult.get(f).index);
		}
		
		for(int g = 0; g < result.size(); g++)
		{
			if(g > 0)
			{
				out.print(" ");
			}
			
			out.print(result.get(g) + 1);
		}
		
//		System.out.println(addResult);
		
		out.println();
		
		out.close();
	}
	
	static class Item implements Comparable<Item>
	{
		int type;
		long amount;
		int index;
		
		public Item(int t, long a, int i)
		{
			type = t;
			amount = a;
			index = i;
		}
		
		public int compareTo(Item o)
		{
			return -Long.compare(amount, o.amount);
		}
	}
	
	static class Add implements Comparable<Add>
	{
		long value;
		long amount;
		int skill;
		
		public Add(long v, long a, int s)
		{
			value = v;
			amount = a;
			skill = s;
		}
		
		public int compareTo(Add o)
		{
			return -Long.compare(amount * o.value, value * o.amount);
		}
	}
	
	static class FastScanner
	{
		BufferedReader br;
		StringTokenizer st;
		
		public FastScanner(InputStream input)
		{
			br = new BufferedReader(new InputStreamReader(input));
			st = new StringTokenizer("");
		}
		
		public String next() throws IOException
		{
			if(st.hasMoreTokens())
			{
				return st.nextToken();
			}
			else
			{
				st = new StringTokenizer(br.readLine());
				return next();
			}
		}
		
		public int nextInt() throws IOException
		{
			return Integer.parseInt(next());
		}
	}
}