Problem: Fibonacci numbers are the sequence of integers: f0 = 0, f1 = 1, f2 = 1, f3 = 2, f4 = 3, f5 = 5, ..., fn = fn - 2 + fn - 1. So every next number is the sum of the previous two.

Bajtek has developed a nice way to compute Fibonacci numbers on a blackboard. First, he writes a 0. Then, below it, he writes a 1. Then he performs the following two operations:

  * operation "T": replace the top number with the sum of both numbers; 
  * operation "B": replace the bottom number with the sum of both numbers. 



If he performs n operations, starting with "T" and then choosing operations alternately (so that the sequence of operations looks like "TBTBTBTB..."), the last number written will be equal to fn + 1.

Unfortunately, Bajtek sometimes makes mistakes and repeats an operation two or more times in a row. For example, if Bajtek wanted to compute f7, then he would want to do n = 6 operations: "TBTBTB". If he instead performs the sequence of operations "TTTBBT", then he will have made 3 mistakes, and he will incorrectly compute that the seventh Fibonacci number is 10. The number of mistakes in the sequence of operations is the number of neighbouring equal operations («TT» or «BB»).

You are given the number n of operations that Bajtek has made in an attempt to compute fn + 1 and the number r that is the result of his computations (that is last written number). Find the minimum possible number of mistakes that Bajtek must have made and any possible sequence of n operations resulting in r with that number of mistakes.

Assume that Bajtek always correctly starts with operation "T".

Input

The first line contains the integers n and r (1 ≤ n, r ≤ 106).

Output

The first line of the output should contain one number — the minimum possible number of mistakes made by Bajtek. The second line should contain n characters, starting with "T", describing one possible sequence of operations with that number of mistakes. Each character must be either "T" or "B".

If the required sequence doesn't exist, output "IMPOSSIBLE" (without quotes).

Examples

Input

6 10


Output

2
TBBTTB


Input

4 5


Output

0
TBTB


Input

2 1


Output

IMPOSSIBLE

Solution (in JAVA):

Solution:


import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class B implements Runnable{
	
	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");
	
	void init() throws FileNotFoundException{
		if (ONLINE_JUDGE){
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		}else{
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}
	
	String readString() throws IOException{
		while(!tok.hasMoreTokens()){
			try{
				tok = new StringTokenizer(in.readLine());
			}catch (Exception e){
				return null;
			}
		}
		return tok.nextToken();
	}
	
	int readInt() throws IOException{
		return Integer.parseInt(readString());
	}
	
	long readLong() throws IOException{
		return Long.parseLong(readString());
	}
	
	double readDouble() throws IOException{
		return Double.parseDouble(readString());
	}
	
	public static void main(String[] args){
		new Thread(null, new B(), "", 256 * (1L << 20)).start();
	}
	
	long timeBegin, timeEnd;

	void time(){
		timeEnd = System.currentTimeMillis();
		System.err.println("Time = " + (timeEnd - timeBegin));
	}
	
	long memoryTotal, memoryFree;
	

	void memory(){
		memoryFree = Runtime.getRuntime().freeMemory();
		System.err.println("Memory = " + ((memoryTotal - memoryFree) >> 10) + " KB");
	}
	
	void debug(Object... objects){
		if (DEBUG){
			for (Object o: objects){
				System.err.println(o.toString());
			}
		}
	}
	
	public void run(){
		try{
			timeBegin = System.currentTimeMillis();
			memoryTotal = Runtime.getRuntime().freeMemory();
			init();
			solve();
			out.close();
			time();
			memory();
		}catch (Exception e){
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}
	
	boolean DEBUG = false;
	
	int MAX_VALUE = 100;
	int MAX_N = 100;
	long[][][][] dp = new long[2][MAX_N][MAX_VALUE][MAX_VALUE];
	
	int t = 0, b = 1;
	
	void solve() throws IOException{
		for (int i = 0; i < MAX_N; ++i){
			for (int j = 0; j < MAX_VALUE; ++j){
				Arrays.fill(dp[t][i][j], Integer.MAX_VALUE);
				Arrays.fill(dp[b][i][j], Integer.MAX_VALUE);
			}
		}
		
		dp[b][0][0][1] = 0;
		
		int n = readInt();
		int r = readInt();
		
		if (r == 1){
			if (n == 1){
				out.println(0);
				out.print('T');
			}else{
				out.print("IMPOSSIBLE");
			}
			
			return;
		}
		
		long ans = Integer.MAX_VALUE;
		
		int x = -1;
		int y = -1;
		int last = -1;
		for (int i = 0; i < r; ++i){
			long res = f(n, r, i, t);
			if (ans > res){
				x = r;
				y = i;
				last = t;
				ans = res;
			}
			
			res = f(n, r, i, b);
			if (ans > res){
				x = r;
				y = i;
				last = b;
				ans = res;
			}
			
			res = f(n, i, r, t);
			if (ans > res){
				x = i;
				y = r;
				last = t;
				ans = res;
			}
			
			res = f(n, i, r, b);
			if (ans > res){
				x = i;
				y = r;
				last = b;
				ans = res;
			}
		}
		
		if (ans == Integer.MAX_VALUE){
			out.print("IMPOSSIBLE");
			return;
		}
		
		out.println(ans);
		print(n, x, y, last);
	}
	
	long f(int n, int x, int y, int last){
		if (x < MAX_VALUE && y < MAX_VALUE && n < MAX_N && dp[last][n][x][y] != Integer.MAX_VALUE){
			return dp[last][n][x][y];
		}
		
		if (x * y == 0){
			return Integer.MAX_VALUE;
		}
		
		long res = -1;
		if (last == t){
			if (x < y){
				return Integer.MAX_VALUE;
			}
			
			if (y == 1){
				res = (n == x? x - 1: Integer.MAX_VALUE);
			}else{
				if (n < x / y){
					return Integer.MAX_VALUE;
				}
				
				long left = f(n - x / y, x % y, y, t);
				long right = f(n - x / y, x % y, y, b);
				
				if (left == Integer.MAX_VALUE){
					if (right == Integer.MAX_VALUE){
						res = Integer.MAX_VALUE;
					}else{
						res = right + x / y - 1;
					}
				}else if (right == Integer.MAX_VALUE){
					if (left == Integer.MAX_VALUE){
						res = Integer.MAX_VALUE;
					}else{
						res = left + x / y;
					}
				}else{
					res = min(
							left + x / y,
							right + x / y - 1);
				}
			}
			

		}else{
			if (y < x){
				return Integer.MAX_VALUE;
			}
			
			if (x == 1){
				res = (n == y? y - 2: Integer.MAX_VALUE);
			}else{
				
				if (n < y / x){
					return Integer.MAX_VALUE;
				}
				
				long left = f(n - y / x, x, y % x, t);
				long right = f(n - y / x, x, y % x, b);
				
				if (left == Integer.MAX_VALUE){
					if (right == Integer.MAX_VALUE){
						res = Integer.MAX_VALUE;
					}else{
						res = right + y / x;
					}
				}else if (right == Integer.MAX_VALUE){
					if (left == Integer.MAX_VALUE){
						res = Integer.MAX_VALUE;
					}else{
						res = left + y / x - 1;
					}
				}else{
					res = min(
							left + y / x - 1,
							right + y / x);
				}
			}
		}
		
		if (x < MAX_VALUE && y < MAX_VALUE && n < MAX_N){
			dp[last][n][x][y] = res;
		}
		
		return res;
	}
	
	void print(int n, int x, int y, int last){
//		out.println(n + " " + x + " " + y + " " + last);
		
		if (x < MAX_VALUE && y < MAX_VALUE && n < MAX_N){
			if (dp[last][n][x][y] == Integer.MAX_VALUE){
				return;
			}
		}
		
		if (last == t){
			if (y == 1){
				for (int i = 0; i < x; ++i){
					out.print('T');
				}
				return;
			}else{
				long left = f(n - x / y, x % y, y, t);
				long right = f(n - x / y, x % y, y, b);
				
				if (left == Integer.MAX_VALUE || left > right){
					int count = x / y;
					print(n - count, x % y, y, b);
					for (int i = 0; i < count; ++i){
						out.print('T');
					}
					return;
				}else if (right == Integer.MAX_VALUE || right > left){
					int count = x / y;
					print(n - count, x % y, y, t);
					for (int i = 0; i < count; ++i){
						out.print('T');
					}
					return;
				}
			}
			

		}else{
			if (x == 1){
				out.print('T');
				for (int i = 0; i < y - 1; ++i){
					out.print('B');
				}
				return;
			}else{
				long left = f(n - y / x, x, y % x, t);
				long right = f(n - y / x, x, y % x, b);
				
				if (left == Integer.MAX_VALUE || left > right){
					int count = y / x;
					print(n - count, x, y % x, b);
					for (int i = 0; i < count; ++i){
						out.print('B');
					}
					return;
				}else if (right == Integer.MAX_VALUE || right > left){
					int count = y / x;
					print(n - count, x, y % x, t);
					for (int i = 0; i < count; ++i){
						out.print('B');
					}
					return;
				}
			}
		}
		
		out.print(last == t? 'T': 'B');
	}
}