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.*;
import java.util.*;

public class B implements Runnable {

	private void solve() throws IOException {
		int k = nextInt();
		if (k == 1) {
			println(2);
			println("NY");
			println("YN");
			return;
		}
		int n = 1000, len = len(k), last = 2;
		boolean[][] g = new boolean[n][n];
		for (int i = 0; i < len; i++)
			g[last][last + 1] = g[last + 1][last++] = true;
		g[last][1] = g[1][last++] = true;
		int curlen = 0, curv = 0;
		while (k > 1) {
			if (k % 2 == 1) {
				g[curv][curlen + 4] = g[curlen + 4][curv] = true;
				k--;
			}
			k /= 2;
			g[curv][last] = g[last][curv] = true;
			g[curv][last + 1] = g[last + 1][curv] = true;
			if (k > 1) {
				g[last][last + 2] = g[last + 2][last] = true;
				g[last + 1][last + 2] = g[last + 2][last + 1] = true;
			} else {
				g[last + 1][1] = g[1][last + 1] = true;
				g[last][1] = g[1][last] = true;
			}
			curv = last + 2;
			last += 3;
			curlen += 2;
		}
		println(last);
		for (int i = 0; i < last; i++) {
			for (int j = 0; j < last; j++)
				print(g[i][j] ? 'Y' : 'N');
			println();
		}
	}
	
	int len(int k) {
		int res = 0;
		while (k > 1) {
			if (k % 2 == 1) k--;
			k >>= 1;
			res++;
		}
		return res * 2;
	}

	public static void main(String[] args) {
		new B().run();
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	public void run() {
		try {
			String file = "";
			file = "system";
			if (file.equals("system")) {
				reader = new BufferedReader(new InputStreamReader(System.in));
				writer = new PrintWriter(System.out);
			} else {
				reader = new BufferedReader(new FileReader(new File("input.txt")));
				writer = new PrintWriter(new File("output.txt"));
			}
			solve();
			writer.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(261);
		}
	}

	void halt() {
		writer.close();
		System.exit(0);
	}

	void print(Object... objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	void println(Object... objects) {
		print(objects);
		writer.println();
	}

	String nextLine() throws IOException {
		return reader.readLine();
	}

	String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			tokenizer = new StringTokenizer(nextLine());
		return tokenizer.nextToken();
	}

	int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}
}