Problem:
Score : 500 points

Problem Statement

You are given two integers A and B.

Print a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:

Let the size of the grid be h \times w (h vertical, w horizontal). Both h and w are at most 100.

The set of the squares painted white is divided into exactly A connected components.

The set of the squares painted black is divided into exactly B connected components.

It can be proved that there always exist one or more solutions under the conditions specified in Constraints section.
If there are multiple solutions, any of them may be printed.

Notes

Two squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.

A set of squares painted white, S, forms a connected component when the following conditions are met:

Any two squares in S are connected.

No pair of a square painted white that is not included in S and a square included in S is connected.

A connected component of squares painted black is defined similarly.

Constraints

1 \leq A \leq 500

1 \leq B \leq 500

Input

Input is given from Standard Input in the following format:

A B

Output

Output should be in the following format:

In the first line, print integers h and w representing the size of the grid you constructed, with a space in between.

Then, print h more lines. The i-th (1 \leq i \leq h) of these lines should contain a string s_i as follows:

If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted white, the j-th character in s_i should be ..

If the square at the i-th row and j-th column (1 \leq j \leq w) in the grid is painted black, the j-th character in s_i should be #.

Sample Input 1

2 3

Sample Output 1

3 3
##.
..#
#.#

This output corresponds to the grid below:

Sample Input 2

7 8

Sample Output 2

3 5
#.#.#
.#.#.
#.#.#

Sample Input 3

1 1

Sample Output 3

4 2
..
#.
##
##

Sample Input 4

3 14

Sample Output 4

8 18
..................
..................
....##.......####.
....#.#.....#.....
...#...#....#.....
..#.###.#...#.....
.#.......#..#.....
#.........#..####.

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// using System.Numerics;
using System.Runtime.CompilerServices;
using System.Diagnostics;
using ll=System.Int64;
using static Contest_D.MyIO;



public class Contest_D
{
	static void swap1<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
	static void swap2<T>(ref T a, ref T b) where T : IComparable { if (a.CompareTo(b)==1) swap1(ref a, ref b); }  // b の方が小さければ交換
	static bool chmin<T>(ref T a, T b) where T : IComparable { if (a.CompareTo(b)== 1) { a = b; return true; } return false; }  // b の方が小さければ a を更新
	static bool chmax<T>(ref T a, T b) where T : IComparable { if (a.CompareTo(b)==-1) { a = b; return true; } return false; }  // b の方が大きければ a を更新
	static bool inside(long i, long n) => (0<=i&&i<n);
	static bool inside(long x, long y, long w, long h) => (inside(x,w)&&inside(y,h));
	static T min<T>(params T[] a) where T : IComparable => a.Min();
	static T max<T>(params T[] a) where T : IComparable => a.Max();
	static long mod(long a, long m) { var v = a%m; return (v<0?v+m:v); }
	static T[][] init<T>(long len1,long len2,T val) where T : struct { T[][] m = new T[len1][]; for (int i=0;i<m.Length;i++) m[i] = Enumerable.Repeat(val,(int)len2).ToArray(); return m; }
	static T[][][] init<T>(long len1,long len2,long len3,T val) where T : struct { T[][][] m = new T[len1][][]; for (int i=0;i<m.Length;i++) m[i] = init(len2,len3,val); return m; }
	public const long MOD1 = 1000000007; // 10^9+7
	public const double EPS1 = 1e-8;
	public const long INF1 = 1000000000000000;  // 10^15

	public static void Main() {
		checked{
			long  a, b;
			MyIO.RM(out a, out b);

			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < 50; i++)
			{
				for (int j = 0; j < 100; j++)
				{
					if(i%2==0&&j%2==0&&1<a){
						sb.Append('.');
						a--;
					}else{
						sb.Append('#');
					}
				}
				sb.AppendLine();
			}
			for (int i = 99; 50<=i; i--)
			{
				for (int j = 0; j < 100; j++)
				{
					if(i%2==0&&j%2==0&&1<b){
						sb.Append('#');
						b--;
					}else{
						sb.Append('.');
					}
				}
				sb.AppendLine();
			}


			MyIO.WM("100 100\n"+sb.ToString());
		}
	}














#region MyIO

public struct VT<T,U>
{
	public T Item1; public U Item2;
    public VT(T a,U b) { Item1 = a; Item2 = b; }
}
public struct VT<T,U,V>
{
	public T Item1; public U Item2; public V Item3;
    public VT(T a,U b,V c) { Item1 = a; Item2 = b; Item3 = c; }
}
public struct VT<T,U,V,W>
{
	public T Item1; public U Item2; public V Item3; public W Item4;
    public VT(T a,U b,V c,W d) { Item1 = a; Item2 = b; Item3 = c; Item4 = d; }
}

public static class MyIO
{
	class Prt : System.IO.StreamWriter
	{
		public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
		public Prt(System.IO.Stream s) : base(s,new UTF8Encoding(false,true)) {}
		public Prt(System.IO.Stream s,Encoding e) : base(s,e) {}
	}
	
	static char[] sp = new char[] {' '};
	[MethodImpl(256)]
	static bool eq<T,U>() => typeof(T).Equals(typeof(U));
	[MethodImpl(256)]
	static T ct<T,U>(U a) => (T)Convert.ChangeType(a,typeof(T));
	static T cv<T>(string s) =>
		eq<T,int>()    ? ct<T,int>(int.Parse(s))
	  : eq<T,long>()   ? ct<T,long>(long.Parse(s))
	  : eq<T,double>() ? ct<T,double>(double.Parse(s,System.Globalization.CultureInfo.InvariantCulture))
	  : eq<T,char>()   ? ct<T,char>(s[0])
					   : ct<T,string>(s);
	public static string[] RM<T>(out T a) {
		var z = Console.ReadLine().Split(sp,StringSplitOptions.RemoveEmptyEntries); 
		a = cv<T>(z[0]);
		return z;
	}
	public static string[] RM<T,U>(out T a,out U b) {
		var z = RM<T>(out a); 
        b = cv<U>(z[1]);
		return z;
	}
	public static string[] RM<T,U,V>(out T a,out U b,out V c) {
		var z = RM<T,U>(out a,out b); 
        c = cv<V>(z[2]);
		return z;
	}
	public static string[] RM<T,U,V,W>(out T a,out U b,out V c,out W d) {
		var z = RM<T,U,V>(out a,out b,out c); 
        d = cv<W>(z[3]);
		return z;
	}
	public static string[] RM<T,U,V,W,X>(out T a,out U b,out V c,out W d,out X e) {
		var z = RM<T,U,V,W>(out a,out b,out c,out d); 
        e = cv<X>(z[4]);
		return z;
	}
	public static string[] RM<T,U,V,W,X,Y>(out T a,out U b,out V c,out W d,out X e,out Y f) {
		var z = RM<T,U,V,W,X>(out a,out b,out c,out d,out e); 
        f = cv<Y>(z[5]);
		return z;
	}
	public static string[] RA<T>(out T[] a) {		
		var z = Console.ReadLine().Split(sp,StringSplitOptions.RemoveEmptyEntries);
		a = z.Select(cv<T>).ToArray();
		return z;
	}
	public static string[][] RL<T>(long n,out T[] a) {
		a = new T[n];
		var y = new string[n][];
		for(int i=0;i<n;i++) y[i] = RM(out a[i]);
		return y;
	}
	public static string[][] RL<T,U>(long n,out VT<T,U>[] a) {
		a = new VT<T,U>[n];
		var y = new string[n][];
		for(int i=0;i<n;i++) {
			T o; U p;
			y[i] = RM(out o,out p);
			a[i] = new VT<T,U>(o,p);
		}
		return y;
	}
	public static string[][] RL<T,U,V>(long n,out VT<T,U,V>[] a) {
		a = new VT<T,U,V>[n];
		var y = new string[n][];
		for(int i=0;i<n;i++) {
			T o; U p; V q;
			y[i] = RM(out o,out p,out q);
			a[i] = new VT<T,U,V>(o,p,q);
		}
		return y;
	}
	public static string[][] RL<T,U,V,W>(long n,out VT<T,U,V,W>[] a) {
		a = new VT<T,U,V,W>[n];
		var y = new string[n][];
		for(int i=0;i<n;i++) {
			T o; U p; V q; W r;
			y[i] = RM(out o,out p,out q,out r);
			a[i] = new VT<T,U,V,W>(o,p,q,r);
		}
		return y;
	}
	public static string[][] RX<T>(long n,out T[][] a) {
		a = new T[n][];
		var y = new string[n][];
		for(int i=0;i<n;i++) y[i] = RA(out a[i]);
		return y;
	}

	static void wwp(Action act){
		var s = new Prt(Console.OpenStandardOutput()){AutoFlush = false};
		Console.SetOut(s);
		act();
		Console.Out.Flush();
		s.AutoFlush = true;
		Console.SetOut(s);
	}
	[MethodImpl(256)]
	static string wfm(Type t) =>t.Equals(typeof(double)) ? "{0:F10}" : "{0}";
	public static void WM(params object[] a) {
		wwp(()=>{
			for(int i=0;i<a.Length;i++) {
				var f = wfm(a[i].GetType()) + ((i<a.Length-1) ? " " : Environment.NewLine);
				Console.Write(f,a[i]);
			}
		});
	}
	public static void WA<T>(IList<T> a) {
		wwp(()=>{
			var f = wfm(typeof(T));
			var g = f + " ";
			var h = f + Environment.NewLine;
			for(int i=0;i<a.Count;i++) Console.Write(((i<a.Count-1) ? g : h),a[i]);
		});
	}
	public static void WL<T>(IList<T> a) {
		wwp(()=>{
			var f = wfm(typeof(T)) + Environment.NewLine;
			foreach(T x in a) Console.Write(f,x);
		});
	}


}

#endregion


}