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 static java.lang.Math.*;
import static java.util.Arrays.*;

public class B {

	private final static boolean autoflush = false;

	int BASE;

	public B () {
		int K = sc.nextInt();

		for (int b = 2; ; ++b) {
			BASE = b;
			if (eval(K) <= 1000) {
				solve(K);
				return;
			}
		}
	}

	int eval(int K) {
		int N = 2;
		int D = 0;
		while (K > 0) {
			int Y = hd(K);
			int Q = tz(Y);
			K -= Y; D = max(D, Q);
			if (Q > 0) {
				N += BASE*Q;
				if (D == Q) {}
				else {
					N += D-Q;
				}
			} else {
				if (D == Q)
					++N;
				else
					N += D;
			}
		}
		return N;
	}

	void solve(int K) {
		System.err.println("BASE = " + BASE);
		int N = 2;
		char [][] G = new char [1000][1000];
		for (char [] g : G)
			fill(g, 'N');

		int D = 0;
		while (K > 0) {
			int Y = hd(K);
			int Q = tz(Y);
			K -= Y; D = max(D, Q);
			if (Q > 0) {
				for (int j : rep(BASE))
					G[0][N+j] = 'Y';
				for (int i : rep(Q-1))
					for (int j : rep(BASE))
						for (int k : rep(BASE, 2*BASE))
							G[N+BASE*i+j][N+BASE*i+k] = 'Y';

				N += BASE*Q;
				if (D == Q)
					for (int i : rep(BASE))
						G[N-1-i][1] = 'Y';
				else {
					for (int i : rep(BASE))
						G[N-1-i][N] = 'Y';
					for (int j : rep(1, D-Q))
						G[N+j-1][N+j] = 'Y';
					N += D-Q;
					G[N-1][1] = 'Y';
				}
			} else
				if (D == Q) {
					G[0][N] = G[N][1] = 'Y';
					++N;
				}
				else {
					G[0][N] = 'Y';
					for (int j : rep(1, D))
						G[N+j-1][N+j] = 'Y';
					N += D;
					G[N-1][1] = 'Y';
				}
		}

		for (int i : rep(N))
			for (int j : rep(N))
				if (G[i][j] == 'Y')
					G[j][i] = 'Y';

		print(N);
		for (int i : rep(N)) {
			String res = new String(G[i], 0, N);
			print(res);
		}
	}

	int hd(int K) {
		long res = 1;
		while (BASE*res <= K)
			res *= BASE;
		return (int)res;
	}

	int tz(int Y) {
		int res = 0;
		while (Y % BASE == 0) {
			Y /= BASE;
			++res;
		}
		return res;
	}
	///////////////////////////////////////////////////////////////////////////
	private static int [] rep(int N) { return rep(0, N); }
	private static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	////////////////////////////////////////////////////////////////////////////////////
	private final static MyScanner sc = new MyScanner();
	private static class MyScanner {
		public String next() { newLine(); return line[index++]; }
		public int nextInt() { return Integer.parseInt(next()); }
		//////////////////////////////////////////////
		private boolean eol() { return index == line.length; }
		private String readLine() {
			try {
				return r.readLine();
			} catch (Exception e) {
				throw new Error (e);
			}
		}
		private final java.io.BufferedReader r;
		private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
		private MyScanner (java.io.BufferedReader r) {
			try {
				this.r = r;
				while (!r.ready())
					Thread.sleep(1);
				start();
			} catch (Exception e) {
				throw new Error(e);
			}
		}
		private String [] line;
		private int index;
		private void newLine() {
			if (line == null || eol()) {
				line = readLine().split(" ");
				index = 0;
			}
		}
	}
	private static void print (Object o, Object... a) { printDelim(" ", o, a); }
	private static void printDelim (String delim, Object o, Object... a) { pw.println(build(delim, o, a)); }
	private static void exit() {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static String build (String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.substring(delim.length());
	}
	private static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = java.lang.reflect.Array.getLength(o);
			for (int i = 0; i < L; ++i)
				append(b, java.lang.reflect.Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>)
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		else
			b.append(delim).append(o);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static void start() { t = millis(); }
	private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);
	private static long t;
	private static long millis() { return System.currentTimeMillis(); }
	public static void main (String[] args) { new B(); exit(); }
}