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.BufferedWriter;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main
{

	private static BufferedWriter out;
	private static int n;
	private static Integer[] arr;

	public static void main(String[] args) throws IOException
	{
		// The input and output streams
		boolean file = false;
		BufferedReader in;
		if (file)
			in = new BufferedReader(new FileReader("input.txt"), 32768);
		else
			in = new BufferedReader(new InputStreamReader(System.in), 32768);
		out = new BufferedWriter(new OutputStreamWriter(System.out));
		StringTokenizer tok;

		// take input
		n = Integer.parseInt(in.readLine());
		boolean g[][] = new boolean[1000][1000];

		// if n = 1
		if (n == 1)
		{
			System.out.println("2");
			System.out.println("NY");
			System.out.println("YN");
			return;
		}

		// exponentiation list
		ArrayList<Long> expoList = new ArrayList<>();
		while (n != 0)
		{
			long curr = 1;
			while (curr * 2 <= n)
				curr *= 2;
			expoList.add(curr);
			n -= curr;
		}

		// make the levels for the first exponentiotation
		int maxLength = getPathLength(expoList.get(0));
		int cur = 2;
		int levels[] = new int[maxLength];
		for (int i = 0; i < maxLength; i++)
		{
			levels[i] = cur;
			cur += 2;
		}

		// connect 0 to last level
		g[0][cur] = true;
		g[cur][0] = true;
		g[cur][levels[maxLength - 1]] = true;
		g[levels[maxLength - 1]][cur] = true;
		g[cur][levels[maxLength - 1] + 1] = true;
		g[levels[maxLength - 1] + 1][cur] = true;
		cur++;

		// connect last level to 1
		g[1][levels[0]] = true;
		g[levels[0]][1] = true;
		g[1][1 + levels[0]] = true;
		g[1 + levels[0]][1] = true;

		// connect the levels
		for (int i = 0; i < levels.length - 1; i++)
		{
			g[levels[i]][levels[i + 1]] = true;
			g[levels[i] + 1][levels[i + 1]] = true;
			g[levels[i]][levels[i + 1] + 1] = true;
			g[levels[i] + 1][levels[i + 1] + 1] = true;

			g[levels[i + 1]][levels[i]] = true;
			g[levels[i + 1]][levels[i] + 1] = true;
			g[levels[i + 1] + 1][levels[i]] = true;
			g[levels[i + 1] + 1][levels[i] + 1] = true;
		}

		// connect the rest
		int pathLength = levels.length;
		for (int i = 1; i < expoList.size(); i++)
		{
			// make a node and extend the path
			long reqChoices = expoList.get(i);
			int diff = pathLength - getPathLength(reqChoices) - 1;
			int levelNeeded = getPathLength(reqChoices);
			int start = cur;
			cur++;

			// connect to the 0
			g[0][start] = true;
			g[start][0] = true;

			// extend path
			for (int j = 0; j < diff; j++)
			{
				g[start][cur] = true;
				g[cur][start] = true;
				start = cur;
				cur++;
			}

			// connect to the position req
			g[levels[levelNeeded]][start] = true;
			g[start][levels[levelNeeded]] = true;
		}

		// output the graph
		System.out.println(1000);
		for (int i = 0; i < 1000; i++)
		{
			StringBuilder ans = new StringBuilder();
			for (int j = 0; j < 1000; j++)
			{
				if (g[i][j])
					ans.append("Y");
				else
					ans.append("N");
			}
			System.out.println(ans.toString());
		}

	}

	private static int getPathLength(long n)
	{
		int sum = 0;
		while (n != 1)
		{
			n /= 2;
			sum++;
		}
		return sum;

	}

}