Problem: Petya sometimes has to water his field. To water the field, Petya needs a tank with exactly V ml of water.

Petya has got N tanks, i-th of them initially containing ai ml of water. The tanks are really large, any of them can contain any amount of water (no matter how large this amount is).

Also Petya has got a scoop that can contain up to K ml of water (initially the scoop is empty). This scoop can be used to get some water from some tank, and after that pour it all into some tank (it is impossible to get water from multiple tanks without pouring it, or leave some water in the scoop when pouring it). When Petya tries to get some water from a tank, he gets min(v, K) water, where v is the current volume of water in the tank.

Is it possible to obtain a tank with exactly V ml of water using these operations? If it is possible, print a sequence of operations that allows to do it. If there are multiple ways to obtain needed amount of water in some tank, print any of them.

Input

The first line contains 3 integers: N (2 ≤ N ≤ 5000), K (1 ≤ K ≤ 5000), and V (0 ≤ V ≤ 109) — the number of tanks, the maximum volume of water the scoop can contain, and the required amount of water in some tank, respectively.

The second line contains N integers ai (0 ≤ ai ≤ 105), where ai is initial volume of water in i-th tank.

Output

If it is impossible to obtain a tank with exactly V ml of water, print NO. 

Otherwise print YES in the first line, and beginning from the second line, print the sequence of operations in the following format: 

Each line has to contain 3 numbers denoting a compressed operation: "cnt x y" (1 ≤ cnt ≤ 109, 1 ≤ x, y ≤ N), where x is the index of the tank where we get water, y is the index of the tank where we pour water, and cnt is the number of times we transfer water from tank x to tank y. 

The number of these lines must not exceed N + 5.

Examples

Input

2 3 5
2 3


Output

YES
1 2 1


Input

2 3 4
2 3


Output

NO


Input

5 2 0
1 3 5 7 9


Output

YES
2 2 1
3 3 1
4 4 1
5 5 1

Solution (in JAVA):

Solution:
/* Author: Ronak Agarwal, reader part not written by me*/
import java.io.* ; import java.util.* ;
import static java.lang.Math.min ; import static java.lang.Math.max ;
import static java.lang.Math.abs ; import static java.lang.Math.log ;
import static java.lang.Math.pow ; import static java.lang.Math.sqrt ;
/* Thread is created here to increase the stack size of the java code so that recursive dfs can be performed */
public class D{
	public static void main(String[] args) throws IOException{
		new Thread(null,new Runnable(){	public void run(){ exec_Code() ;} },"Solver",1l<<27).start() ;
	}
	static void exec_Code(){
		try{
			Solver Machine = new Solver() ;
			Machine.Solve() ; Machine.Finish() ;}
		catch(Exception e){ e.printStackTrace() ; print_and_exit() ;}
		catch(Error e){ e.printStackTrace() ; print_and_exit() ; }
	}
	static void print_and_exit(){ System.out.flush() ; System.exit(-1) ;}
}
/* Implementation of the Reader class */
class Reader { 
	private InputStream mIs;
	private byte[] buf = new byte[1024];
	private int curChar,numChars;
	public Reader() { this(System.in); } 
	public Reader(InputStream is) { mIs = is;} 
	public int read() {
		if (numChars == -1) throw new InputMismatchException();    
		if (curChar >= numChars) {
			curChar = 0;
			try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}
			if (numChars <= 0) return -1;            
		}
		return buf[curChar++];
	} 
	public String nextLine(){
		int c = read();
		while (isSpaceChar(c)) c = read();        
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString() ;
	} 
	public String s(){
		int c = read();
		while (isSpaceChar(c)) c = read();        
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		}while (!isSpaceChar(c));
		return res.toString();
	} 
	public long l(){
		int c = read();
		while (isSpaceChar(c)) c = read();        
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		long res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10 ; res += c - '0' ; c = read();
		}while(!isSpaceChar(c));
		return res * sgn;
	} 
	public int i(){
		int c = read() ;
		while (isSpaceChar(c)) c = read();        
		int sgn = 1;
		if (c == '-') { sgn = -1 ; c = read() ; }
		int res = 0;
		do{
			if (c < '0' || c > '9') throw new InputMismatchException();
			res *= 10 ; res += c - '0' ; c = read() ;
		}while(!isSpaceChar(c));
		return res * sgn;
	} 
	public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } 
	public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } 
}   
/* All the useful functions,constants,renamings are here*/
class Template{
	/* Constants Section */
	final int INT_MIN = Integer.MIN_VALUE ; final int INT_MAX = Integer.MAX_VALUE ;
	final long LONG_MIN = Long.MIN_VALUE ; final long LONG_MAX = Long.MAX_VALUE ;
	static long MOD = 1000000007 ;
	static Reader ip = new Reader() ;	
	static PrintWriter op = new PrintWriter(System.out) ;
	/* Methods for writing */
	static void p(Object o){ op.print(o) ; }
	static void pln(Object o){ op.println(o) ;}
	static void Finish(){ op.flush(); op.close(); }
	/* Implementation of operations modulo MOD */
	static long inv(long a){ return powM(a,MOD-2) ; }
	static long m(long a,long b){ return (a*b)%MOD ; }
	static long d(long a,long b){ return (a*inv(b))%MOD ; }
	static long powM(long a,long b){
		if(b<0) return powM(inv(a),-b) ;
		long ans=1 ;
		for( ; b!=0 ; a=(a*a)%MOD , b/=2) if((b&1)==1) ans = (ans*a)%MOD ;
		return ans ;
	}
	/* Renaming of some generic utility classes */
	final static class mylist extends ArrayList<Integer>{}
	final static class myset extends TreeSet<Integer>{}
	final static class mystack extends Stack<Integer>{}
	final static class mymap extends TreeMap<Integer,Integer>{}
}
/* Implementation of the pair class, useful for every other problem */
class pair implements Comparable<pair>{
	int x ; int y ;
	pair(int _x,int _y){ x=_x ; y=_y ;} 
	public int compareTo(pair p){
		return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ;
	}
}
/* Main code starts here */
class Solver extends Template{
	int n,k,v ;
	int a[] ;
	int ak[] ;
	public void Solve() throws IOException{
		n = ip.i() ; k = ip.i() ; v = ip.i() ;
		a = new int[n+1] ; ak = new int[n+1] ;
		for(int i=1 ; i<=n ; i++) a[i] = ip.i() ;
		if(v==0){
			pln("YES") ;
			pln("1000000000 1 2") ;
			return ;
		}
		int vk = v%k ;
		for(int i=1 ; i<=n ; i++) ak[i] = a[i]%k ;
		int dp[][] = new int[n+1][k] ;
		for(int i=0 ; i<=n ; i++) Arrays.fill(dp[i],-1) ;
		dp[0][0] = 0 ;
		for(int i=1 ; i<=n ; i++){
			for(int j=0 ; j<k ; j++){
				if(dp[i-1][j]!=-1){
					int nj = (j+ak[i])%k ;
					dp[i][nj] = i ;
					if(dp[i][j]==-1) dp[i][j] = dp[i-1][j] ;
				}
			}
		}
		if(dp[n][vk]==-1){
			pln("NO") ; return ;
		}
		mylist path = new mylist() ;
		int id=n ; int tar = vk ;
		while(id>0){
			int tba = dp[id][tar] ;
			if(tba!=0) path.add(tba) ;
			tar = (tar-ak[tba]+k)%k ;
			id = tba-1 ;
		}
		StringBuilder buffer = new StringBuilder() ;
		int vl=0 ;
		if(path.size()!=0){
			vl += a[path.get(0)] ; 
			for(int i=1 ; i<path.size() ; i++){
				vl+=a[path.get(i)] ;
				buffer.append("1000000000 "+path.get(i)+" "+path.get(0)+"\n") ;
			}
		}
		boolean flag = false ;
		if(vl>v){
			flag = true ;
			int times = (vl-v)/k ;
			if(path.size()>1)
				buffer.append(times+" "+path.get(0)+" "+path.get(1)+"\n") ;
			else{
				for(int i=1 ; i<=n ; i++) if(i!=path.get(0)){
					buffer.append(times+" "+path.get(0)+" "+i+"\n") ;
					break ;
				}				
			}
		}else if(vl<v){
			int hit[] = new int[n+1] ;
			for(int elem : path) hit[elem]=1 ;
			int st = -1 ;
			for(int i=1 ; i<=n ; i++) if(hit[i]==0){
				if(st==-1) st=i ;
				else{ 
					buffer.append("1000000000 "+i+" "+st+"\n") ;
					a[st]+=a[i] ;
				}
			}
			if(st!=-1){
				int times = (v-vl)/k ;
				int avail = a[st]/k ;
				if(path.size()!=0)
					buffer.append(min(times,avail)+" "+st+" "+path.get(0)+"\n") ;
				else{
					for(int i=1 ; i<=n ; i++) if(i!=st){
						buffer.append(min(times,avail)+" "+st+" "+i+"\n") ;
						break ;
					}
				}
				times-=min(times,avail) ;
				if(times==0) flag=true ;
			}
		}else{
			flag=true ;
		}
		pln(flag ? "YES" : "NO") ;
		if(flag) p(buffer) ;
	}
}