let draw h w =
	let rec draw_s w =
		match w with
		|0 -> print_string "\n"
		|_ -> print_string "#";draw_s (w-1)
	in
	let draw_d w =
		let rec dot w =
			match w with
			|0 -> print_string "\n"
			|1 -> print_string "#";dot 0
			|_ -> print_string ".";dot (w-1)
		in
		print_string "#";dot (w-1)
	in
	let rec draw_d_n w n =
		match n with
		|0 -> ()
		|_ -> draw_d w;draw_d_n w (n-1)
	in
	draw_s w;draw_d_n w (h-2);draw_s w;print_string "\n";;

let rec loop () =
	Scanf.sscanf(read_line()) "%d %d" (fun x y -> if x = 0 && y = 0 then () else (draw x y;loop()));;

loop();;

