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.
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;


public class B
{
        String line;
        StringTokenizer inputParser;
        BufferedReader is;
        FileInputStream fstream;
        DataInputStream in;
        String FInput="";
        
        void openInput(String file)
        {

                if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin
                else
                {
                        try{
                
                                
                        fstream = new FileInputStream(file);
                        in = new DataInputStream(fstream);
                        is = new BufferedReader(new InputStreamReader(in));
                        }catch(Exception e)
                        {
                                System.err.println(e);
                        }
                }

        }
        
        void readNextLine()
    	{
    		try {
    			line = is.readLine();
    			inputParser = new StringTokenizer(line, " ,\t");
    			//System.err.println("Input: " + line);
    		} catch (IOException e) {
    			System.err.println("Unexpected IO ERROR: " + e);
    		}	
    		catch (NullPointerException e)
    		{
    			line=null;
    			
    		}
    		
    	}
        
        long NextLong()
        {
                String n = inputParser.nextToken();
                
                long val = Long.parseLong(n);
                
                 return val;
        }
        
        int NextInt()
        {
                String n = inputParser.nextToken();
                int val = Integer.parseInt(n);
                
                //System.out.println("I read this number: " + val);
                return val;
        }
        
        String NextString()
        {
                String n = inputParser.nextToken();
                return n;
        }
        
        void closeInput()
        {
                try {
                        is.close();
                } catch (IOException e) {
                        System.err.println("Unexpected IO ERROR: " + e);
                }
                        
        }
        
        
        public static void main(String [] argv)
        {
                //String filePath="circles.in";
                String filePath=null;
                if(argv.length>0)filePath=argv[0];
                new B(filePath);
                
        }
        
        public B(String inputFile)
        {
        	openInput(inputFile);
    		StringBuilder sb = new StringBuilder();
    		readNextLine();
    		int N=NextInt();
    		
    		//GraphSmall g = new GraphSmall(N);
    		Graph g = new Graph(N);
    		
        	sb.append(g.toTable());
        	System.out.println(sb);
    		closeInput();		
      
        }
        
        private class Graph
        {
        	boolean [] [] p = new boolean[1000][1000];

        	public Graph(int N)
        	{
        		join(0, 999);
        		join(0, 998);
        		for(int i=999; i>=939; i-=2)
        		{
        			join(i, i-2);
        			join(i, i-3);
        			join(i-1, i-2);
        			join(i-1, i-3);
        		}
        		
        		int id=930;
        		for(int i=0; i<30; i++)
        		{
        			int ii=i+2;
        			join(ii, id);
        			for(int j=0; j<30-i; j++)
        			{
        				join(id, --id);
        			}
        			join(id--, 1);
        		}
        		
        		int x=0;
        		while(N>0)
        		{
        			if((N&1)==1)
        			{
        				join(getId(x), x+2);
        			}
        			N/=2;
        			x++;
        		}
        	}
        	
        	int getId(int x)
        	{
        		return 998-2*x;
        	}
        	
			public String toTable() {
				StringBuilder sb = new StringBuilder();
				sb.append(p.length+"\n");
				for(int i=0; i<p.length; i++)
				{
					for(int j=0; j<p.length; j++)
					{
						sb.append(p[i][j]?"Y":"N");
					}
					sb.append("\n");
				}
				return sb.toString();
			}
			
			private void join(int a, int b)
			{
				p[a][b]=p[b][a]=true;
			}
			
        }
        
        private class GraphSmall
        {
        	boolean [] [] p = new boolean[40][40];

        	public GraphSmall(int N)
        	{
        		join(0, 39);
        		join(0, 38);
        		for(int i=39; i>=25; i-=2)
        		{
        			join(i, i-2);
        			join(i, i-3);
        			join(i-1, i-2);
        			join(i-1, i-3);
        		}
        		
        		int id=20;
        		for(int i=0; i<4; i++)
        		{
        			int ii=i+2;
        			join(ii, id);
        			for(int j=0; j<4-i; j++)
        			{
        				join(id, --id);
        			}
        			join(id--, 1);
        		}
        		
        		int x=0;
        		while(N>0)
        		{
        			if((N&1)==1)
        			{
        				join(getId(x), x+2);
        			}
        			N/=2;
        			x++;
        		}
        	}
        	
        	int getId(int x)
        	{
        		return 38-2*x;
        	}
        	
			public String toTable() {
				StringBuilder sb = new StringBuilder();
				sb.append(p.length+"\n");
				for(int i=0; i<p.length; i++)
				{
					for(int j=0; j<p.length; j++)
					{
						sb.append(p[i][j]?"Y":"N");
					}
					sb.append("\n");
				}
				return sb.toString();
			}
			
			private void join(int a, int b)
			{
				p[a][b]=p[b][a]=true;
				//System.out.println(a+" "+b);
			}
			
        }


}