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.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;




public class MinimalPath {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static int P = 0;
static long powertwo[] = new long[41];
static int powerid[] = new int[41];
static int dummy_node[] = new int[41];
static char graph[][] = new char[1000][1000];
static int node_id = 2;

static void join(int i,int j){
	graph[i][j] = 'Y';
	graph[j][i] = 'Y';
}
static void disjoin(int i,int j){
	graph[i][j] = 'N';
	graph[j][i] = 'N';
}

static class Pair{
	int id;
	int dis;
	public Pair(int id,int dis){
		this.id = id;
		this.dis = dis;
	}
}

static boolean getBit(int num, int idx) {
return ((num >> idx) & 1) == 1;     
}

	
	public static void main(String[]args)throws Throwable{
		P = Integer.parseInt(br.readLine());
		for(int i=0;i<1000;i++) for(int j=0;j<1000;j++) disjoin(i,j);
		int curr_power = 0;
		
		join(node_id,1);
		
		for(int i=0;i<=31;i++){
			powerid[curr_power++] = node_id;
			join(node_id,++node_id);
			join(node_id,node_id+1);
			join(node_id,node_id+2);
			join(node_id+1,node_id+3);
			join(node_id+2,node_id+3);
			join(node_id+3,node_id+4);
			
			node_id += 4;
			
		}
		
		
		
		node_id++;
		
		curr_power = 0;
		for(int i=0;i<=31;i++){
			
			dummy_node[curr_power++] = node_id;
			join(node_id,node_id+1);
			join(node_id+1,node_id+2);
			join(node_id+2,node_id+3);
			join(node_id+3,node_id+4);
			node_id += 4;
		}
		
		join(0,node_id);
		for(int i=0;i<=31;i++){
			if(getBit(P,i)){
			//	System.out.println(i+" "+powerid[i]+" "+dummy_node[i]);
				join(powerid[i],dummy_node[i]);
			}
		}
	
		StringBuilder sb = new StringBuilder();
		sb.append("1000"+"\n");
		for(int i=0;i<1000;i++){
			for(int j=0;j<1000;j++){
				sb.append(graph[i][j]);
				
			}
			sb.append("\n");
		}
	System.out.print(sb);
		
		
		
	}
}