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;


public final class FoxMinPath {

	private static StringBuilder[] graph = new StringBuilder[1000];
	
//	private static void generatePrimes(int n) {
//		boolean[] primes = new boolean[n+1];
//		//ArrayList<Integer> primesList = new ArrayList<Integer>();
//		Arrays.fill(primes, true);
//		for (int i=2; i<=n; i++) {
//			if(primes[i]) {
//				System.out.println(i);
//				//primesList.add(new Integer(i));
//				for(int j=2; j*i<=n; j++)
//					primes[i*j] = false;
//			}
//		}
//	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String row = "";
		
		for(int i=0; i<graph.length; i++) {
			row += "N";
		}
		for(int i=0; i<graph.length; i++) {
			graph[i] = new StringBuilder(row);
		}
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		try {
			long k = Long.valueOf(r.readLine()).longValue();
			int maxBit;
			for(maxBit=30; maxBit>=0; maxBit--)
				if((k & (1<<maxBit)) == (1<<maxBit)) break;
			int x=2, v1,v2,v3;
			v1 = x++;
			v2 = x++;
			v3 = x++;
			connectGraph(0, v1);
			connectGraph(0, v2);
			connectGraph(0, v3);
			while(--maxBit>=0) {
				connectGraph(v1, x);
				connectGraph(v1, x+1);
				connectGraph(v2, x);
				connectGraph(v2, x+1);
				if((k & (1<<maxBit)) == (1<<maxBit)) {
					connectGraph(v3, x);
					connectGraph(v3, x+1);
				}
				connectGraph(v3, x+2);
				v1 = x++;
				v2 = x++;
				v3 = x++;
			}
			connectGraph(1, v1);
			System.out.println(graph.length);
			for(int i=0; i<graph.length; i++) {
				System.out.println(graph[i]);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	private static void connectGraph(int i, int j) {
		graph[i].setCharAt(j, 'Y');
		graph[j].setCharAt(i, 'Y');
	}

}