open Printf
open Scanf

let print_frame n = String.make (n+2) '#' |> printf "%s\n"

let () =
  let h, w = scanf "%d %d\n" (fun x y -> (x, y)) in
  let rec loop n =
    if n = 0 then ()
    else
      begin
        let s = scanf "%s\n" (fun x -> x) in
        print_char '#';
        print_string s;
        print_char '#';
        print_newline ();
        loop (n-1)
      end in
  print_frame w;
  loop h;
  print_frame w
