Problem: Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You should calculate the number of shortest paths between vertex 1 and vertex 2."

Same with some writers, she wants to make an example with some certain output: for example, her birthday or the number of her boyfriend. Can you help her to make a test case with answer equal exactly to k?

Input

The first line contains a single integer k (1 ≤ k ≤ 109).

Output

You should output a graph G with n vertexes (2 ≤ n ≤ 1000). There must be exactly k shortest paths between vertex 1 and vertex 2 of the graph.

The first line must contain an integer n. Then adjacency matrix G with n rows and n columns must follow. Each element of the matrix must be 'N' or 'Y'. If Gij is 'Y', then graph G has a edge connecting vertex i and vertex j. Consider the graph vertexes are numbered from 1 to n.

The graph must be undirected and simple: Gii = 'N' and Gij = Gji must hold. And there must be at least one path between vertex 1 and vertex 2. It's guaranteed that the answer exists. If there multiple correct answers, you can output any of them. 

Examples

Input

2

Output

4
NNYY
NNYY
YYNN
YYNN

Input

9

Output

8
NNYYYNNN
NNNNNYYY
YNNNNYYY
YNNNNYYY
YNNNNYYY
NYYYYNNN
NYYYYNNN
NYYYYNNN

Input

1

Output

2
NY
YN

Note

In first example, there are 2 shortest paths: 1-3-2 and 1-4-2.

In second example, there are 9 shortest paths: 1-3-6-2, 1-3-7-2, 1-3-8-2, 1-4-6-2, 1-4-7-2, 1-4-8-2, 1-5-6-2, 1-5-7-2, 1-5-8-2.

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	public static void main(String args[]) throws NumberFormatException,IOException {
		Stdin in=new Stdin();
		PrintWriter out = new PrintWriter(System.out);
		int div=100000000;
		int pos;
		int size=2+90*10;
		boolean [][]graph=new boolean[size+1][size+1];
		int temp;
		int currentPos=0;
		// k=a1*10^0+a2*10^1+a3*10^2+...a9*10^8  (0<=a1,a2,...a9<=10)
		int a[]=new int[9];
		int level[]=new int[9];
		pos=0;
		for(int i=3;i+90<=size;i+=90){
			level[pos++]=i;
		}
		int k=in.readInt();
		pos=8;
		while(k>0){
			temp=k/div;
			if(temp>0){
				a[pos]=temp;
				k=k%div;
			}
			pos--;
			div/=10;
		}
		
		for(int i=0;i<a.length;i++){
			if(a[i]>0)
				addEdges(graph,i,currentPos,a[i],level);
			currentPos+=10;
		}
		out.println(size);
		print(out,graph);
		out.flush();
		
	}
	
	private static void addEdges(boolean[][] g, int up,int left,int wide,int[] level) {
		
		for(int i=level[0]+left;i<level[0]+wide+left;i++){// fill the first row
			g[i][1]=g[1][i]=true;
		}
		int w=1;
		if(up>0){
			for(int i=level[0]+left;i<level[0]+wide+left;i++ ){// second part for a1,a2...a8
				for(int j=level[1]+left;j<level[1]+left+10;j++){//*10
					g[i][j]=g[j][i]=true;
				}
			}
			w=10;
		}else{
			w=wide;
			}
		for(int i=1;i<up;i++){// the remaining *10
			for(int j=level[i]+left;j<level[i]+left+10;j++)
				for(int k=level[i+1]+left;k<level[i+1]+left+10;k++){
					g[j][k]=g[k][j]=true;
		
				}
			w=10;
		}
			
		
		if(up<8)
			for(int i=level[up]+left;i<level[up]+w+left;i++){
				g[i][level[up+1]+left]=g[level[up+1]+left][i]=true;
			}
		for(int i=up+1;i<level.length-1;i++){
			g[level[i]+left][level[i+1]+left]=g[level[i+1]+left][level[i]+left]=true;
			w=1;
		}					
		for(int i=level[level.length-1]+left;i<level[level.length-1]+left+w;i++){// fill the last row
			g[i][2]=g[2][i]=true;
		}

	}


	private static void print(PrintWriter out, boolean[][] g) {
		for (int i = 1; i <g.length; i++) {
			for (int j = 1; j <g[0].length; j++)
				if (g[i][j])
					out.print('Y');
				else
					out.print('N');
			out.println();
		}

	}

	private static class Stdin {
		InputStreamReader read;
		BufferedReader br;

		StringTokenizer st = new StringTokenizer("");

		private Stdin() {
			read = new InputStreamReader(System.in);
			br = new BufferedReader(read);

		}

		private String readNext() throws IOException {

			while (!st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		private int readInt() throws IOException, NumberFormatException {

			return Integer.parseInt(readNext());

		}

		private long readLong() throws IOException, NumberFormatException {

			return Long.parseLong(readNext());

		}
	}
}