jiahuimbzuai/CoQuIR huggingface dataset:
//  [swift]
let a=Int(readLine()!)!
let b=Int(readLine()!)!
let c=Int(readLine()!)!
let x=Int(readLine()!)!
var r=0
for i in 0...x/500 {
	for j in 0...(x-500*i)/100 {
		let k=x-500*i-100*j
		if k%50==0&&c>=k/50&&a>=i&&b>=j {r+=1}
	}
}
print(r)
//  [swift]
import Foundation
let A = Int(readLine()!)!
let B = Int(readLine()!)!
let C = Int(readLine()!)!
let X = Int(readLine()!)!
var count = 0
//500A + 100B + 50C = X を満たす(A,B,C)

for a in 0 ... A {
    for b in 0 ... B {
        for c in 0 ... C {
            if 500*a + 100*b + 50*c == X {
                count += 1
            }
        }
    }
}
print(count)
//  [swift]
    let A = Int(readLine()!)!
    let B = Int(readLine()!)!
    let C = Int(readLine()!)!
    let X = Int(readLine()!)!
    
    if (A == 0) && (B == 0) && (C == 0) {
        //exit(0)
    }
    
    if (50...20000 ~= X) && (X % 50 != 0) {
        //exit(0)
    }
    
    var collectCount = 0
    for _500Coins in 0...A{
        for _100Coins in 0...B{
            for _50Coins in 0...C{
                let totalPrice = _500Coins * 500 + _100Coins * 100 + _50Coins * 50
                if X == totalPrice{
                    collectCount += 1
                }
            }
        }
    }
    
    print(collectCount)
//  [swift]
func main() {
    let fiveHandledCount = Int(readLine()!)!
    let handledCount = Int(readLine()!)!
    let fiftyCount = Int(readLine()!)!
    let amount = Int(readLine()!)!
    
    var hitCount = 0
    
    for fiveHandledSelect in 0...fiveHandledCount {
        if fiveHandledSelect * 500 == amount {
            hitCount += 1
            continue
        }
        for handledSelect in 0...handledCount {
            if (fiveHandledSelect * 500) + (handledSelect * 100) == amount {
                hitCount += 1
                continue
            }
            for fiftyCount in 0...fiftyCount {
                if (fiveHandledSelect * 500) + (handledSelect * 100) + (fiftyCount * 50) == amount {
                    hitCount += 1
                    continue
                }
            }
        }
    }
    
    print("\(hitCount)")
}

main()
//  [typescript]
function Main(input) {
  let all = input.split("\n").map((x) => parseInt(x, 10));
  let a = all[0];
  let b = all[1];
  let c = all[2];
  let x = all[3];

  let ans = 0;
  for (let i = 0; i <= a; i++) {
    for (let j = 0; j <= b; j++) {
      for (let k = 0; k <= c; k++) {
        if (500 * i + 100 * j + 50 * k === x) {
          ans++;
        }
      }
    }
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import * as fs from "fs";
const input = (fs.readFileSync("/dev/stdin", "utf8") as string)
  .split(/\n/)
  .map(Number);

let x = input[3];
let count = 0;
for (let a = 0; a <= input[0]; a++) {
  for (let b = 0; b <= input[1]; b++) {
    for (let c = 0; c <= input[2]; c++) {
      if (a * 500 + b * 100 + c * 50 === x) count++;
    }
  }
}

console.log(count);
//  [typescript]
function main(input: string) {
  const inputNumbers: number[] = input.split('\n').map(n => parseInt(n, 10))

  const A: number = inputNumbers[0]
  const B: number = inputNumbers[1]
  const C: number = inputNumbers[2]
  const X: number = inputNumbers[3]

  let count: number = 0

  for (let i = 0; i <= A; i ++) {
    for (let j = 0; j <= B; j++) {
      for (let k = 0; k<= C; k ++) {
        let result: number = 500 * i + 100 * j + 50 * k
        if (result === X) count ++ 
      }
    }
  }

  console.log(count)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [typescript]
const lines = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

reader.on("line", function (line) {
  lines.push(line);
});
reader.on("close", function () {
  const fiveHanYenNum = lines[0] as number;
  const oneHanYenNum = lines[1] as number;
  const fiftyYenNum = lines[2] as number;
  const applyYen = lines[3] as number;

  console.log(countApply(fiveHanYenNum, oneHanYenNum, fiftyYenNum, applyYen));
});

function countApply(
  fiveHanYenNum: number,
  oneHanYenNum: number,
  fiftyYenNum: number,
  applyYen: number
): number {
  let count = 0;

  for (let i = 0; i <= fiveHanYenNum; i++) {
    for (let j = 0; j <= oneHanYenNum; j++) {
      for (let k = 0; k <= fiftyYenNum; k++) {
        if (500 * i + 100 * j + k * 50 == applyYen) count = count + 1;
      }
    }
  }

  return count;
}
//  [typescript]
s=require('fs').readFileSync('/dev/stdin','utf8').split('\n').map(n=>n|0);
c=0
Array(s[0]+1).fill().map((_,i)=>
Array(s[1]+1).fill().map((_,j)=>
Array(s[2]+1).fill().map((_,k)=>
i*500+j*100+k*50==s[3]&&c++)))
console.log(c)
//  [typescript]
[a,b,c,x]=require('fs').readFileSync('/dev/stdin','utf8').split('\n').map(n=>n|0)
r=0
Array(a+1).fill().map((_,i)=>
Array(b+1).fill().map((_,j)=>
Array(c+1).fill().map((_,k)=>
	i*500+j*100+k*50==x&&r++
)))
console.log(r)
//  [python]
import numpy as np
N=int(input())
print((N//2+N%2)/N)
//  [python]
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    N = int(input())
    odd = 0
    even = 0
    for i in range(1, N + 1):
        if i % 2 == 0:
            even += 1
        else:
            odd += 1
    print(odd / (odd + even))


if __name__ == '__main__':
    main()
//  [python]
from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math

from scipy.sparse.csgraph import floyd_warshall

BIG_NUM = 200000000000
MOD = 1000000007
EPS = 0.000000001

N = int(input())
print(math.ceil(N/2)/N)
//  [java]
import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        double a = (double)(N/2);
        sc.close();

        if(N%2 == 0){
            System.out.println(a/(double)N);
        } else{
            System.out.println((a+1)/(double)N);
        }
    }
}
//  [java]
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();

    long cnt = IntStream.range(1, n).filter(i -> i % 2 != 0).count();
    System.out.println((double) (n - cnt) / n);
  }
}
//  [java]
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int nums[] = IntStream.rangeClosed(1,n).toArray();

    double oddSum = 0;
    for (int i=0; i < n; i++) {
      if (nums[i] % 2 != 0) {
        oddSum = oddSum + 1;
      }
    }
    System.out.println(oddSum / n);
  }
}
//  [cpp]
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007
#define _GLIBCXX_DEBUG
 
vector<long> fac(MAX);
vector<long> finv(MAX);
vector<long> inv(MAX);
vector<long> Primelist;
//template functions
/////////////////////////
void Prinit(){
long PR=10000001;
vector<long> P(PR,0);
for(long i=2;i*i<PR;i++){
    if(P.at(i)==0){
        long j=i;
      j+=i;
        while(j<PR){
            P.at(j)=1;
             j+=i;         
        }
    }
}

for(long i=2;i*i<PR;i++){//Primelist.size()=446
    if(P.at(i)==0){
        Primelist.push_back(i);
    }
}
}

void Cominit(){
  fac.at(0)=fac.at(1)=1;
  finv.at(0)=finv.at(1)=1;
  inv.at(1)=1;
  for(long i=2;i<MAX;i++){
      fac.at(i)=(fac.at(i-1)*i)%MOD;
      inv.at(i)=MOD-inv.at(MOD%i)*(MOD/i)%MOD;
      finv.at(i)=finv.at(i-1)*inv.at(i)%MOD;
  }
}

long facComb(long N,long M){// nCm%
if(N<M) return 0;
if(N<0||M<0) return 0;
return fac.at(N)*(finv.at(M)*finv.at(N-M)%MOD)%MOD;
}

long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}

long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}

long GCM(long A,long B){
            long W,r;
    if(A<B){

        W=B;
        B=A;
        A=W;
    }
    while(A%B!=0){
        r=A%B;
        A=B;
        B=r;
    }
    return B;
}
long LCM(long A,long B){
    return (A*B)/GCM(A,B);
}

long upDiv(long a,long b){
  return (a+b-1)/b;
}

long strtolong(string str){
istringstream ss;
ss=istringstream(str);
long num;
ss>>num;
return num;
}

long chartolong(char ch){
long num;
num=ch-'0';
return num;
}

long Max2(long a,long b){
if(a>b){
    return a;
}else{
    return b;
}
}

long Min2(long a,long b){
if(a>b){
    return b;
}else{
    return a;
}
}


string longtostr(long N){
    string str;
    str=to_string(N);
    return str;
}









/////////////////////////


//Answer


int main() {
long N;
double A;
cin>>N;
if(N%2==0){
  A=(N/2)/(double)N;
}else{
  A=((N+1)/2)/(double)N;
}


cout<< fixed << setprecision(10) << A<<endl;

}
//  [cpp]
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;


bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}

struct tree {
	queue<lli> leaf;
	lli num;
};

Tree t[200001];

void dfs(lli n, lli num) {
	t[n].num += num;
	while (!t[n].leaf.empty()) {
		dfs(t[n].leaf.front(), t[n].num);
		t[n].leaf.pop();
	}

}
int main() {
	double a;
	cin >> a;
	cout << ((int)(1+a)/2)/a;
}
//  [c]
#include <stdio.h>

int main() 
{
int i;
double a,p,N;
scanf ("%lf",&N);
for (i=1;i<=N;i++)
{
    if (i%2==1)
    {
         a++;
    }
}
p=a/N;
printf ("%.10lf\n",p);
    return 0;
}
//  [c]
#include <stdio.h>
 
int main()
{

double r,N;
scanf("%lf",&N);
r=remainder(N,2);
if(r==0){ printf("%0.6lf\n",(N/2)/N);}
else{ printf("%0.6lf\n",(((N-1)/2)+1)/N);}
 return 0;
}
//  [c]
#include<stdio.h>
int main()
{
double count=0,f;
int i,N;
scanf("%d",&N);
for(i=0;i<=N;i++)
{
if(i%2!=0)
count=count+1;
}
f=count/N;
printf("%.10lf\n",f);
return 0;
}
//  [javascript]
function Main(input){
  var N = input.split(' ');
  N = parseInt(N,10);

  var hal2 = Math.ceil(N/2);

  console.log(hal2/N);


}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(arg) {
 
    var N = arg-0;

    var oddnum = 0;
    oddnum = Math.ceil(N / 2);

    console.log(oddnum/N);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
    input = parseInt(input, 10);  
    var bunbo = input;
    var bunshi = Math.ceil(input/2);
    console.log(bunshi/bunbo);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [ruby]
n=gets.to_i()
print (((n+1)/2).to_f()/n)
//  [ruby]
### SNIPPET
  # n = gets.split.map(&:to_i)
  # array = n.times.map { gets.split.map(&:to_i) }
  # [].all?(&:even?)
  # a = [*1..m].repeated_combination(n).to_a
  # [1,2,3,4,5].select { |num| num.even? }  # => [2, 4]
  # ["a","a","b"].group_by(&:itself).map{|k,v| [k, v.count]}.to_h #=> {"a"=>2, "b"=>1}
  # 切り捨て: .floor(2).to_f ,切り上げ： .ceil(2).to_f,四捨五入: round(2)
  # 3.upto(6) do |i|, 6.downto(3) do |i|
  # 公約数125.gcd(100)、公倍数125.lcm(100)
  # PI = Math::PI
  # 高さ = a * Math.sin(w / 180.0 * Math::PI), 底辺 = a * Math.cos(w / 180.0 * Math::PI)
  # def chmax(a, b) a > b ? a : b end
  # INF = Float::INFINITY
  # def chmin(a, b) a < b ? a : b end

n = gets.to_i

sum = 0
n.times do |i|
  sum += 1 if (i+1) % 2 == 1
end

puts sum / n.to_f
//  [ruby]
n = gets.to_i

array = [*1..n]
odd_array = []

array.each do |i|
  if i.odd?
    odd_array.push(i)
  end
end

pp odd_array.length / n.to_f
//  [rust]
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();

    let N = buf.trim().parse::<u32>().unwrap();
    let NN = buf.trim().parse::<f32>().unwrap();
    let ans = match N % 2 == 1 {
        true => (NN / 2.0 + 0.5) / NN,
        false => 0.5,
    };

    println!("{}", ans);
}
//  [rust]
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        n: usize
    };
    let c = (n + 1) / 2;
    let res = c as f64 / n as f64;
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}
//  [rust]
fn main() {
    let n: i32 = read_line_as_value();
    if n % 2 == 0 {
        println!("0.5");
    } else {
        println!("{:?}", ((n/2)+1) as f32 / n as f32);
    }
}

fn read_line_as_value<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    let res = std::io::stdin().read_line(&mut input);
    if let Err(error) = res {
        panic!("io error at stdin.read_line: {}", error);
    };
    match input.trim().parse() {
        Ok(val) => val,
        _ => panic!("error while parsing input: {}", input)
    }
}
//  [swift]
let N = Int(readLine()!)!
print(Double((N+1)/2)/Double(N))
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let n = Int(readLine()!)!
    
    if n % 2 == 0 {
        print("0.5")
    } else {
        print(Double(n / 2 + 1) / Double(n))
    }
}

main()
//  [swift]
let n=Double(readLine()!)!
if Int(n)%2==0{
  print(0.5)
}else{
  print((n+1)/(2*n))
}
//  [typescript]
const main = input => {
  let n = input;
  console.log((Math.ceil(n / 2)) / n);
} 

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const Main = (input) => {
  const n = Number(input);
  if (n % 2 === 0) {
    console.log(0.5);
  } else {
    console.log(((n + 1) /2 ) / n);
  }
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [n]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    return `${n % 2 == 0 ? (n / 2) / n : (n + 1) / 2 / n}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [python]
import sys
H, W = map(int, raw_input().split())
a = [raw_input() for _ in range(H)]
for i in range(H + 2):
    for j in range(W + 2):
        if i == 0 or j == 0 or i == H + 1 or j == W + 1:
            sys.stdout.write('#')
        else:
            sys.stdout.write(str(a[i - 1][j - 1]))
    print("")
//  [python]
inputs = [int(x) for x in input().split(" ")]

H = inputs[0]
W = inputs[1]

strs = [input() for _ in range(H)]

print("#" * (W+2))

for s in strs:
	print("#" + s + "#")

print("#" * (W+2))
//  [python]
H,W = [int(x) for x in input().split()]

image = []
for i in range(H):
    image.append(input())

framed_image = []
for i in range(H+2):
    if i == 0 or i == H+1:
        framed_image.append("#"*(W+2))
    else:
        framed_image.append("#"+image[0]+"#")
        del image[0]

for line in framed_image:
    print(line)
//  [python]
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

H,W = IL()
p = [[i for i in "#"*(W+2)] for i in range(H+2)]

for i in range(1,H+1):
  s = S()
  for j in range(W):
    p[i][j+1] = s[j]
    
for i in p:
  print("".join(i))
//  [python]
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy

def j(q):
    if q==1: print("yes")
    else:print("no")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


#n = ip()                              #入力整数1つ
h,w= (int(i) for i in input().split())      #入力整数横2つ
#n,x,y = (int(i) for i in input().split())    #入力整数横3つ
#n,a,b,c= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
a=[input() for i in range(h)]
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
c = []
e = ["#" for i in range(w+2)]
c.append(''.join(e))
for i in range(h):
    d = ["#",a[i],"#"]
    c.append(''.join(d))
e = ["#" for i in range(w+2)]
c.append(''.join(e))
for  i in range(h+2):
    print(c[i])
//  [python]
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools

def solve():
    h, w = map(int, input().split())
    hoge = []
    for i in range(h):
        hoge.append(input())
    print("#"*(w+2))
    for i in range(h):
        print("#"+hoge[i]+"#")
    print("#"*(w+2))
    return 0

if __name__ == "__main__":
    solve()
//  [java]
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int h = in.nextInt();
            int w = in.nextInt();
            char[] s = new char[w + 2];
            Arrays.fill(s, '#');
            out.println(new String(s));
            for (int i = 0; i < h; i++) {
                out.println('#' + in.nextLine() + '#');
            }
            out.println(new String(s));
        }

    }

    static class InputReader {
        StringTokenizer st;
        BufferedReader br;

        public InputReader(InputStream is) {
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            this.br = br;
        }

        public String next() {
            if (st == null || !st.hasMoreTokens()) {
                String nextLine = null;
                try {
                    nextLine = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (nextLine == null)
                    return null;
                st = new StringTokenizer(nextLine);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String nextLine() {
            String str = null;
            try {
                str = br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return str;
        }

    }
}
//  [java]
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        String [][] a = new String [H+2][W+2];
        for (int i = 0 ; i < H + 2 ; i++ ) {
            for (int j = 0 ; j < W + 2 ; j++ ) {
                a[i][j] = "#";
            }
        }
        for (int i = 1 ; i <= H ; i++ ) {
            String s = sc.next();
            for (int j = 1 ; j <= W ; j++) {
                a[i][j] = String.valueOf(s.charAt(j - 1));
            }
        }

        for (int i = 0 ; i < H + 2 ; i++ ) {
            for (int j = 0 ; j < W + 2 ; j++ ) {
                System.out.print(a[i][j]);
            }
            System.out.println("");
        }
    }

}
//  [java]

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h, w;
		String a[];
		h = sc.nextInt();
		w = sc.nextInt();
		a = new String[h];
		for(int i = 0; i < h; ++i) {
			a[i] = sc.next();
		}
		sc.close();
		
		for(int i = -1; i < h + 1; ++i) {
			for(int j = -1; j < w + 1; ++j) {
				if(i == -1 || i == h || j == -1 || j == w)System.out.print("#");
				else System.out.print(a[i].charAt(j));
			}
			System.out.println();
		}
	}

}
//  [java]

import java.util.*;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();

        IntStream.range(0,W+2).forEach(i -> System.out.print("#"));
        System.out.print("\n");
        for(int y=0;y<H;y++){
            System.out.print("#");
            String s = sc.next();
            System.out.print(s);
            System.out.print("#\n");
        }
        IntStream.range(0,W+2).forEach(i -> System.out.print("#"));
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc062_b.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int H, W;
  cin >> H >> W;

  vector<string> s(H);
  rep(i, H) { cin >> s[i]; }

  rep(i, H) { s[i] = '#' + s[i] + '#'; }

  string h;
  rep(i, W + 2) { h += '#'; }

  printf("%s\n", h.c_str());
  rep(i, H) { printf("%s\n", s[i].c_str()); }
  printf("%s\n", h.c_str());
}
//  [cpp]
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int h,w;
    cin>>h>>w;
    for(int i=0;i<w+2;i++){
        cout<<'#';
    }
    cout<<endl;
    for(int i=0;i<h;i++){
        cout<<'#';
        string s;
        cin>>s;
        cout<<s;
        cout<<'#';
        cout<<endl;
    }
    for(int i=0;i<w+2;i++){
        cout<<'#';
    }
    cout<<endl;
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

#define f first
#define s second
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define pb push_back

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b); i >= (a); i--)
#define R0F(i, a) ROF(i, 0, a-1)
#define trav(x, a) for (auto& x: a)

const int MX  = 2e5+5;
const int MOD = 1e9+7;
const ll  INF = 1061109567; // 4557430888798830399LL
const ld  EPS = 1e-9;
const ld  PI  = acos(-1);

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int H,W; cin >> H >> W;

    cout << string(W+2,'#') << "\n";

    F0R(i,H) {
        cout << "#";
        string x; cin >> x;
        cout << x << "#\n";
    }
    cout << string(W+2,'#') << "\n";



}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    for (int i = 0; i <= b+1; i++)
        cout << "#";
    cout << endl;
    for (int i = 0; i < a; i++) {
        cout << "#";
        for (int j = 0; j < b; j++) {
            char t;
            cin >> t;
            cout << t;
        }
        cout << "#" << endl;
    }
    for (int i = 0; i <= b+1; i++)
        cout << "#";
    return 0;
}
//  [cpp]
#include <iostream>

using namespace std;

int main(){
  int h, w;
  cin >> h >> w;
  
  for(int i = 0; i < w + 2; i++){
    cout << "#";
  }
  cout << endl;
  
  for(int i = 0; i < h; i++){
    string s;
    cin >> s;
    cout << "#" << s << "#" << endl;
  }
  
  for(int i = 0; i < w + 2; i++){
    cout << "#";
  }
  cout << endl;
  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  int H, W;
  char a;
  cin >> H >> W;
  
  for(int i=0;i < H+2;i++){
    for(int j=0;j < W+2;j++){
      if(i==0 || i==H+1)
        cout << '#';
      else{
        if(j==0 || j==W+1)
          cout << '#';
        else{
          cin >> a;
          cout << a;
        }
      }
    }
    cout << endl;
  }
}
//  [c]
#include<stdio.h>
int main()
{
	int i,j;
	while (scanf("%d%d",&i,&j)!=EOF)
	{
		getchar( );
		int a,b;
		char vx[100][100];
		for(a=0;a<i;a++)
		{
			for(b=0;b<j;b++)
			{
				scanf("%c",&vx[a][b]);
			}
			getchar( );
		}
		for(a=0;a<j+2;a++)
		{
			printf("#");
		}
		printf("\n");
		for(a=0;a<i;a++)
		{
			printf("#");
			for(b=0;b<j;b++)
			{
				printf("%c",vx[a][b]);
			}
			printf("#\n");
		}
		for(a=0;a<j+2;a++)
		{
			printf("#");
		}
		printf("\n");
	}
	return 0;
}
//  [c]
#include<stdio.h>
int main()

{
    int i,j,a,b,c,d,n,m;
    scanf("%d",&m);
    scanf("%d ",&n);
    char ar[m+2][n+2];
    for(i=0;i<m+2;i++)
    {
      for(j=0;j<n+2;j++)
      {
          ar[i][j]='#';
      }
    }
 
     for(a=1;a<=m;a++)
    {
      for(b=1;b<=n;b++)
      {
          if(b==n && a!=m)
            scanf("%c ",&ar[a][b]);
          else
            scanf("%c",&ar[a][b]);
      }
    }
     for(c=0;c<m+2;c++)
    {
      for(d=0;d<n+2;d++)
      {
          printf("%c",ar[c][d]);

      }
    printf("\n");
    }
    return 0;
}
//  [c]
#include<stdio.h>
int main()
{
int i,j,h,w;
char str[101][101];
scanf("%d %d",&h,&w);
for(i=1;i<=h;i++)
{
        scanf("%s",&str[i][1]);
    
}
i=1;
j=1;
while(i<=w+2){
    printf("#");
    i++;
}
printf("\n");
for(i=1;i<=h;i++)
{
    printf("#");
    for(j=1;j<=w;j++)
    {
        printf("%c",str[i][j]);
    }
    printf("#\n");
}
i=1;
while(i<=w+2){
    printf("#");
    i++;
}
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

#define IMGHGT 100
#define IMGWDT 100
#define FRMHGT (IMGHGT + 2)
#define FRMWDT (IMGWDT + 2)

int ih, iw, fh, fw;
char id[IMGHGT][IMGWDT], fd[FRMHGT][FRMWDT];

void read(void)
{
    int r, c;
    
    scanf("%d %d%*[\n]", &ih, &iw);
    for (r = 0; r < ih; ++r) {
        for (c = 0; c < iw; ++c)
            scanf("%c", &id[r][c]);
        scanf("%*[\n]");
    }
}

void exec(void)
{
    int ir, ic, fr, fc;
    
    fh = ih + 2, fw = iw + 2;
    for (fr = 0, fc = 0; fc < fw; ++fc)
        fd[fr][fc] = '#';
    for (fr = 1, ir = 0; ir < ih; ++ir, ++fr) {
        fd[fr][fc = 0] = '#';
        for (++fc, ic = 0; ic < iw; ++ic, ++fc)
            fd[fr][fc] = id[ir][ic];
        fd[fr][fc] = '#';
    }
    for (fr = fh - 1, fc = 0; fc < fw; ++fc)
        fd[fr][fc] = '#';
}

void write(void)
{
    int fr, fc;
    
    for (fr = 0; fr < fh; ++fr) {
        for (fc = 0; fc < fw; ++fc)
            printf("%c", fd[fr][fc]);
        putchar('\n');system("pause > NUL");
    }
}

int main(void)
{
    read();
    exec();
    write();
    return 0;
}
//  [c]
#define _GLIBCXX_DEBUG

#include <unistd.h>
#include <stdlib.h>

void get_nums(int *array, char *s, int count)
{
    int num;
    int i;
    int j;
    
    i = -1;
    while (s[++i] != 10)
    {
        if (s[i] != 32)
        {
            num = 0;
            while ('0' <= s[i] && s[i] <= '9')
            {
                num = num * 10 + s[i++] - '0';
                if (!s[i])
                {
                    array[count++] = num;
                    return ;                    
                }
            }
            array[count++] = num;
            i--;
        }
    }  
}

void get_stirngs(char *s, char *tmp, int pass_flag, int count)
{
    int i;
    int j;
    
    i = -1;
    while (count < pass_flag)
    {
        while (tmp[++i] != 10)
            ;
        count++;
    }
    j = 0;
    while (tmp[++i] != 10)
    {
        while (31 < tmp[i] && tmp[i] < 127)
        {
            s[j++] = tmp[i++];
            if (!tmp[i])
            {
                s[j] = 0;
                return ;                    
            }
        }
        s[j] = 0;
        i--;
    }  
}

void get_ans(int x, int y, char *tmp)
{
    int i;
    int j;
    char s[x + 1];
    
    j = -1;
    while (++j < y + 2)
    {
        if (0 < j  && j <= y)
            get_stirngs(s, tmp, j, 0);
        i = -1;
        while (++i < x + 2)
        {
            if (0 < j  && j <= y && 0 < i && i <= x)
                write(1, &s[i - 1], 1);
            else
                write(1, "#", 1);
        }
        write(1, "\n", 1);
    }
}

char *create_array(char *s, char *new_arr, char *t, int size)
{
    int i;
    int j;
    
    i = -1;
    while (s[++i])
        new_arr[i] = s[i];
    free(s);
    j = -1;
    while (++j < size)
        new_arr[i++] = t[j];   
    new_arr[i] = 0;
    return (new_arr);
}

char *get_data(char *s)
{
    int size;
    int sum_size;
    char t[5];
    char *new_arr;
    
    sum_size = 0;
    while ((size = read(0, t, 5)))
    {
        if (size == -1)
            return (NULL);
        sum_size += size;
        if (!(new_arr = (char*)malloc(sum_size + 1)))
            return (NULL);
        s = create_array(s, new_arr, t, size);
    }
    return (s);
}

int main(void){
    int num[2];
    char *s;
    
    s = malloc(1);
    s = get_data(s);
    
    //printf("%s\n\n",s);
    //write(1,s,6);
    get_nums(num, s, 0);
    //printf("num[0]=%d,num[1]=%d\n",num[0],num[1]);
    get_ans(num[1],num[0], s);
    return (0);
}
//  [c]
#include <unistd.h>

void get_nums(int *array, int count)
{
    char c;
    int num;

    c = 0;
    while (c != 10)
    {
        if (read(0, &c, 1) == -1)
            return ;
        if (c != 32)
        {
            num = 0;
            while ('0' <= c && c <= '9')
            {
                num = num * 10 + c - '0';
                if (read(0, &c, 1) == 0)
                {
                    array[count++] = num;
                    return ;                    
                }
            }
            array[count++] = num;
        }
    }  
}

void get_stirngs(char *s, int i)
{
    char c;

    c = 0;
    while (c != 10)
    {
        if (read(0, &c, 1) == -1)
            return ;
        while (31 < c && c < 127)
        {
            s[i++] = c;
            if (read(0, &c, 1) == 0)
            {
                s[i] = 0;
                return ;                    
            }
        }
        s[i] = 0;
    }  
}

void get_ans(int x, int y, int i, int j)
{
    char s[x + 1];
    
    while (++j < y + 2)
    {
        if (0 < j  && j <= y)
            get_stirngs(s, 0);
        i = -1;
        while (++i < x + 2)
        {
            if (0 < j  && j <= y && 0 < i && i <= x)
                write(1, &s[i - 1], 1);
            else
                write(1, "#", 1);
        }
        write(1, "\n", 1);
    }
}

int main(void){
    int num[2];
    
    get_nums(num, 0);
    get_ans(num[1],num[0], -1, -1);
    return (0);
}
//  [javascript]
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}

function Main(input) {
  input = myconv(input,3);
  var H = myconv(input[0],4)[0];
  var W = myconv(input[0],4)[1];
  input.shift();
  var uesita = "";
  for(var i = 0; i < W +2; i++){
    uesita += "#";
  }
  var output = [];
  output.push(uesita);
  for(var i = 0; i < H; i++){
    output.push("#" + input[i] + "#");
  }
  output.push(uesita);
  myout(output.join("\n"));
}

Main(myin());
//  [javascript]
'use strict'

function main(s) {

  s = s.split('\n');

  const w = Number(s[0].split(' ')[1]);

  const top = [...Array(w + 2)].fill('#').join('');
  const mid = s.slice(1, -1).map(n => '#' + n + '#');
  const btm = [...Array(w + 2)].fill('#').join('');

  const ans = [top, ...mid, btm];

  console.log(ans.join('\n'));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict';

const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
const numbers = input[0].split(' ').map(n => parseInt(n, 10));

const h = numbers[0];
const w = numbers[1];

console.log('#'.repeat(w + 2));

for (let i = 1; i < h + 1; i++) {
  const line = input[i];
  console.log('#' + line + '#');
}

console.log('#'.repeat(w + 2));
//  [javascript]
"use strict";

const main = arg => {
    const H = parseInt(arg.split("\n")[0].split(" ")[0]);
    const W = parseInt(arg.split("\n")[0].split(" ")[1]);
    const pixel = arg.split("\n").slice(1, H + 1);
    
    let answer = [];
    
    answer[0] = [];
    answer[0].push("#".repeat(W + 2));
    
    for(let i=1; i<=H; i++) {
        answer[i] = [];
        answer[i].push("#" + pixel[i - 1] + "#");
    }

    answer[H + 1] = [];
    answer[H + 1].push("#".repeat(W + 2));
    
    console.log(answer.join("\n"));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
'use strict';

const fs = require('fs');

const repeatString = (s, n) => {
  let r = '';
  for (let i = 0; i < n; i++) {
    r += s;
  }
  return r;
};

const input = fs.readFileSync('/dev/stdin', 'utf8').split('\n');
const numbers = input[0].split(' ').map(n => parseInt(n, 10));

const h = numbers[0];
const w = numbers[1];

console.log(repeatString('#', w + 2));

for (let i = 1; i < h + 1; i++) {
  const line = input[i];
  console.log('#' + line + '#');
}

console.log(repeatString('#', w + 2));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var H, W int

func main() {
	sc.Split(bufio.ScanWords)

	H, W = nextInt(), nextInt()
	S := make([]string, H)
	for i := 0; i < H; i++ {
		S[i] = nextStr()
	}

	//fmt.Println(S)
	buf := bufio.NewWriter(os.Stdout)
	hash := ""
	for j := 0; j < W+2; j++ {
		hash += "#"
	}
	for i := 0; i < H+2; i++ {
		if i%(H+1) == 0 {
			buf.Write([]byte(fmt.Sprintf("%s\n", hash)))
		} else {
			buf.Write([]byte(fmt.Sprintf("#")))
			buf.Write([]byte(fmt.Sprintf("%s", string(S[i-1]))))
			buf.Write([]byte(fmt.Sprintf("#\n")))
		}
	}
	buf.Flush()
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	sc.Split(bufio.ScanWords)
	h, w := nextInt(), nextInt()
	a := make([]string, h)
	for i := range a {
		a[i] = next()
	}

	puts(strings.Repeat("#", w+2))
	for i := range a {
		putf("#%s#\n", a[i])
	}
	puts(strings.Repeat("#", w+2))
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	// "reflect"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func first_and_last(w int) string{
    _ret := make([]string, 0)
    for i:=0; i<w+2; i++{
        _ret = append(_ret, "#")
    }
    ret := strings.Join(_ret, "") + "\n"
    return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	h, w := nextInt(), nextInt()
	fmt.Fprint(out, first_and_last(w))
	for y:=0; y<h; y++{
		line := next()
		s := "#" + line + "#" + "\n"
		fmt.Fprint(out, s)
	}
	fmt.Fprint(out, first_and_last(w))
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	h := nextInt()
	w := nextInt()
	l := make([]string, h)
	for i := 0; i < h; i++ {
		l[i] = nextStr()
	}

	for i := 0; i < h+2; i++ {
		for j := 0; j < w+2; j++ {
			if i == 0 || i == h+1 || j == 0 || j == w+1 {
				fmt.Printf("#")
			} else {
				fmt.Printf("%c", l[i-1][j-1])
			}
		}
		fmt.Printf("\n")
	}

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var h, w int
	fmt.Scan(&h, &w)
	a := make([]string, h)
	for i := 0; i < h; i++ {
		fmt.Scan(&a[i])
	}

	for i := -1; i <= h; i++ {
		for j := -1; j <= w; j++ {
			if i == -1 || j == -1 || i == h || j == w {
				fmt.Print("#")
			} else {
				fmt.Print(string(a[i][j]))
			}
		}
		fmt.Println()
	}
}
//  [go]
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var h,w int
    fmt.Scan(&h,&w)
    s := scanString(h)
    for i:=0;i<h+2;i++{
        for j:=0;j<w+2;j++{
            if i==0 || j==0 || i==h+1 || j==w+1{
                fmt.Printf("#")
            } else {
                fmt.Printf("%c", s[i-1][j-1])
            }
        }
        fmt.Printf("\n")
    }
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func makeTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func sortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}

func reverseString(s string) string{
    t := []rune(s)
    for i,j := 0, len(s)-1 ; i < j ; i, j = i+1, j-1 {
        t[i], t[j] = t[j], t[i]
    }
    return string(t)
}

func inside(h,w,H,W int) bool{
    if h>=0 && h<H && w>=0 && w<W{
        return true
    }
    return false
}
//  [ruby]
h, w = gets.split.map(&:to_i)
ary = []
h.times do
  ary << gets.strip
end
ary.each_with_index do |k, i|
  ary[i] = "##{k}#"
end
ary << "#"*(w+2)
ary.insert(0, "#"*(w+2))
puts ary
//  [ruby]
H,W=gets.split.map(&:to_i)

w = W+2
puts '#'*w
H.times do
    puts "##{gets.chomp}#"
end
puts '#'*w
//  [ruby]
H, W = gets.split.map(&:to_i)
a = []

H.times do |i|
  a[i] = gets.chomp
end

puts "#" * (W + 2) # 文字列オブジェクトを指定した回数繰り返す

a.each do |word|
  puts ("#" + word + "#").to_s
end

puts "#" * (W + 2) # # 文字列オブジェクトを指定した回数繰り返す
//  [ruby]
require 'prime'
require 'set'
require 'tsort'
include Math
def max(a,b);              a > b ? a : b                              end
def min(a,b);              a < b ?  a : b                             end
def swap(a,b);             a, b = b, a                                end
def gif;                   gets.to_i                                  end
def gff;                   gets.to_f                                  end
def gsf;                   gets.chomp                                 end
def gi;                    gets.split.map(&:to_i)                     end
def gf;                    gets.split.map(&:to_f)                     end
def gs;                    gets.chomp.split.map(&:to_s)               end
def gc;                    gets.chomp.split('')                       end
def pr(num);               num.prime_division                         end
def digit(num);            num.to_s.length                            end
def array(s,ini=nil);      Array.new(s){ini}                          end
def darray(s1,s2,ini=nil); Array.new(s1){Array.new(s2){ini}}          end
def rep(num);              num.times{|i|yield(i)}                     end
def repl(st,en,n=1);       st.step(en,n){|i|yield(i)}                 end

h ,w = gi
str = []
str << '#'*(w+2)
rep h do
str << '#'+gsf+'#'
end
str << '#'*(w+2)

puts str
//  [ruby]
h,w=gets.chomp.split(" ").map(&:to_i)
puts "#" * (w+2)
h.times do
  str = $stdin.gets.chomp
  str = "#" + str + "#"
  puts str
end
puts "#" * (w+2)
//  [ruby]
H, W = gets.split.map(&:to_i)

a = H.times.map { gets.chomp }

puts '#' * (W + 2)

a.each do |str|
  puts "##{str}#"
end

puts '#' * (W + 2)
//  [rust]
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let v : Vec<usize> = get_vec();
    let h = v[0];
    let w = v[1];

    let mut mat : Vec<String> = Vec::new();
    mat.push(std::iter::repeat("#").take(w+2).collect::<String>());
    for _i in 0..h {
        let s : String = get_one();
        mat.push("#".to_owned() + &s + "#")
    }
    mat.push(std::iter::repeat("#").take(w+2).collect::<String>());
    for hi in mat.iter() {
        println!("{}", hi);
    }
}
//  [rust]
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<usize>();
    let (h, w) = (v[0], v[1]);
    for _ in 0..w + 2 {
        print!("#");
    }
    println!("");

    for _ in 0..h {
        let s = read::<String>();
        println!("#{}#", s);
    }

    for _ in 0..w + 2 {
        print!("#");
    }
    println!("");
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}