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

public class B {
	static final int all = 1000;
	boolean[][] g = new boolean[1000][1000];
	int cntV = 0;

	void copy(int v1, int v2) {
		for (int i = 0; i < cntV; i++) {
			if (g[v1][i]) {
				g[v1][i] = g[i][v1] = false;
				g[v2][i] = g[i][v2] = true;
			}
		}
	}

	int build(int k) {
		if (k == 1) {
			g[1][0] = g[0][1] = true;
			cntV = 2;
			return 1;
		}
		int len = build(k / 2);
		cntV++;
		copy(0, cntV - 1);
		g[cntV - 1][cntV] = g[cntV][cntV - 1] = true;
		cntV++;
		g[cntV - 2][cntV] = g[cntV][cntV - 2] = true;
		cntV++;
		for (int i = 0; i < cntV; i++) {
			g[0][i] = g[i][0] = false;
		}
		g[cntV - 1][0] = g[cntV - 2][0] = g[0][cntV - 1] = g[0][cntV - 2] = true;
		len += 2;
		if (k % 2 == 1) {
			int old = 0;
			for (int i = 0; i < len - 1; i++) {
				g[old][cntV] = g[cntV][old] = true;
				cntV++;
				old = cntV - 1;
			}
			g[old][1] = g[1][old] = true;
		}
		return len;
	}

	void solve() throws IOException {
		int k = nextInt();
		build(k);
		out.println(cntV);
		for (int i = 0; i < cntV; i++) {
			for (int j = 0; j < cntV; j++) {
				if (g[i][j]) {
					out.print("Y");
				} else {
					out.print("N");
				}
			}
			out.println();
		}
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

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

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String temp = in.readLine();
			if (temp == null) {
				return null;
			}
			st = new StringTokenizer(temp);
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

}
