Eat the Chocolate Bar I have a chocolate bar and I need help eating it so you'll be writing a program just to do that.

Explanation

The first line is the input. Examples are separated by an empty line.

7
   ____
 __|__|
|__|__|
|__|__|
|__|__|

6
_______
|__|__|
|__|__|
|__|__|

5
   ____
 __|__|
|__|__|
|__|__|

0


1
   ____
   |__|


Spec

Hopefully the examples clearly specify this challenge but to avoid any possible confusion, here's a spec:

You can have a single optional trailing/leading whitespace

An input of 0 is an empty output.

If the input is even, the top rows looks like:

_______
|__|__|


If it's odd, the top row is:

   ____
   |__|


If it's odd and greater than 1, the top rows are:

  ____
__|__|




The following rows are:

|__|__|


until the number of instances of |__| is the same as the input
Haskell, 101 bytes

Haskell has never been great for code golfing...

b="\n|__|__|"
h="   ____\n "
f 1=h++"  |__|"
f 2="_______"++b
f 3=h++"__|__|"++b
f n=f(n-2)++b
f _=""