Square root of ASCII art You are working as an intern for a mathematician who really hates TeX, LaTeX, etc. So much so that he has decided to abandon all typesetting whatsoever and make you do all the formatting in ASCII. You got tired of this after a while and decided to start automating parts of it, starting with square roots.

Here's how a square root is made:

###  this is the input
###
###

_____  put a row of underscores stretching one character off either side on top
 ### 
 ### 
 ### 

   _____  put a diagonal of slashes in front going the height of the input
  / ### 
 /  ### 
/   ### 

      _____ put a diagonal of backslashes in front of that, going up half of the input's height rounded up
     / ###
 \  /  ###
  \/   ###


And that's it!

Rules

You are to make a program or function that takes in a string, list of strings  (i.e. lines), or array of characters, and outputs the input transformed according to the description above (not necessarily by the exact same order or process)

You may assume that the input is rectangular if preferred. Trailing whitespace is neither required nor disallowed.

This is code-golf, so the shortest answer in bytes wins.

Examples:

Input:
40
Output:
  ____
\/ 40

Input:
  ____
\/ 40
Output:
   ________
  /   ____
\/  \/ 40 

Input:
/| 
 | 
 | 
_|_
Output:
      _____
     / /|
    /   |
\  /    |
 \/    _|_

Input:
#  # 
#  # 
#####
   # 
   # 
Output:
        _______
       / #  #  
      /  #  #  
\    /   ##### 
 \  /       #  
  \/        #
Python 2, 196 bytes



x=Q=input()
l=len(x)
k=(l+1)/2
q=l+k
x=[[' ']*(q+1)+list(y)for y in x]
for i in range(k):x[i+l/2][i]='\\'
for j in range(l):x[j][q-j-1]='/'
print'\n'.join([' '*q+'_'*(2+len(Q[0]))]+map(''.join,x))


Try it online!

-2 bytes thanks to Step Hen

-13 bytes thanks to Jonathan Allan