[Question]
  [
Write the shortest program that takes a single integer as input and prints out a [Suanpan abacus](http://en.wikipedia.org/wiki/Suanpan)
Testcases
Input:
```
314159
```
Output:
```
|\======================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  ||
||  (__)  (__)  (__)  (__)   ||    ||   ||
||   ||    ||    ||    ||    ||    ||   ||
||   ||    ||    ||    ||   (__)  (__)  ||
|<======================================>|
||  (__)  (__)  (__)  (__)   ||   (__)  ||
||  (__)   ||   (__)   ||    ||   (__)  ||
||  (__)   ||   (__)   ||    ||   (__)  ||
||   ||    ||   (__)   ||    ||   (__)  ||
||   ||    ||    ||    ||    ||    ||   ||
||   ||    ||    ||    ||   (__)   ||   ||
||   ||   (__)   ||   (__)  (__)   ||   ||
||   ||   (__)   ||   (__)  (__)   ||   ||
||  (__)  (__)   ||   (__)  (__)   ||   ||
||  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/======================================\|
```
Input:
```
6302715408
```
Output:
```
|\==============================================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
||   ||   (__)  (__)  (__)   ||   (__)   ||   (__)  (__)   ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||  (__)   ||    ||    ||   (__)   ||   (__)   ||    ||   (__)  ||
|<==============================================================>|
||  (__)  (__)   ||   (__)  (__)  (__)   ||   (__)   ||   (__)  ||
||   ||   (__)   ||   (__)  (__)   ||    ||   (__)   ||   (__)  ||
||   ||   (__)   ||    ||    ||    ||    ||   (__)   ||   (__)  ||
||   ||    ||    ||    ||    ||    ||    ||   (__)   ||    ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||   ||    ||   (__)   ||    ||    ||   (__)   ||   (__)   ||   ||
||  (__)   ||   (__)   ||    ||   (__)  (__)   ||   (__)   ||   ||
||  (__)   ||   (__)  (__)  (__)  (__)  (__)   ||   (__)   ||   ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)   ||   (__)  (__)  ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/==============================================================\|
```
  
[Answer]
## J, 126 124 121 119 116 115 113 105 116 115 112 characters
```
'|'s":(' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1[(s=:[,.~,.)9!:7'\=/<=>/=\|='
```
Takes input from the keyboard. Example:
```
   '|'s":(' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1[(s=:[,.~,.)9!:7'\=/<=>/=\|='
6302715408
|\==============================================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
||   ||   (__)  (__)  (__)   ||   (__)   ||   (__)  (__)   ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||  (__)   ||    ||    ||   (__)   ||   (__)   ||    ||   (__)  ||
|<==============================================================>|
||  (__)  (__)   ||   (__)  (__)  (__)   ||   (__)   ||   (__)  ||
||   ||   (__)   ||   (__)  (__)   ||    ||   (__)   ||   (__)  ||
||   ||   (__)   ||    ||    ||    ||    ||   (__)   ||   (__)  ||
||   ||    ||    ||    ||    ||    ||    ||   (__)   ||    ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||   ||    ||   (__)   ||    ||    ||   (__)   ||   (__)   ||   ||
||  (__)   ||   (__)   ||    ||   (__)  (__)   ||   (__)   ||   ||
||  (__)   ||   (__)  (__)  (__)  (__)  (__)   ||   (__)   ||   ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)   ||   (__)  (__)  ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/==============================================================\|
```
The main trick here is the abuse of J's boxing by redefining the characters it uses. It uses a [global parameter](http://jsoftware.com/help/dictionary/dx009.htm) - `9!:7` - to do this. There may be room for further golfing, but to be honest I was just glad to get something working that should compensate for [my last attempt at this question](https://codegolf.stackexchange.com/a/1585/737).
Fits in a tweet with enough characters left to say 'Gaz made this' :-).
**Edit:** 3 characters of savings are due to borrowing the `2 6$' || (__)'` from [Jesse Millikan's](https://codegolf.stackexchange.com/a/1777/737) answer.
**Further edit:** Lost 11 characters adding extra spaces at either side that I hadn't noticed were not present.
**Explanation:**
The code is in three main sections:
**1) Setup**
```
[(s=:[,.~,.)9!:7'\=/<=>/=\|='
```
This is itself in two parts.  
`9!:7'\=/<=>/=\|='` redefines the characters that J will use to display boxes. J's boxing normally looks like this:
```
   2 2$<"0[1 2 3 4
┌─┬─┐
│1│2│
├─┼─┤
│3│4│
└─┴─┘
```
but after redefining it looks like this:
```
   2 2$<"0[1 2 3 4
\===/
|1|2|
<===>
|3|4|
/===\
```
`(s=:[,.~,.)` defines a verb I'm going to be using a couple of times later. This turns out to be the best place to declare it. It takes a character on the left and an array of characters on the right and sandwiches the array between the character. For example:
```
   3 5$'abcdefghijklmno'
abcde
fghij
klmno
   '-' s 3 5$'abcdefghijklmno'
-abcde-
-fghij-
-klmno-
```
The final `[` just serves to separate the setup from the next part.
**2) Input and Representation**
```
,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
```
`".,.1!:1[1` takes the input from the keyboard and separates it into individual digits:
```
   ".,.1!:1[1
314159
3 1 4 1 5 9
```
`((i.5)</5|])` creates a zeros and ones representation of the bottom part of the abacus:
```
   ((i.5)</5|]) 3 1 4 1 5 9
1 1 1 1 0 1
1 0 1 0 0 1
1 0 1 0 0 1
0 0 1 0 0 1
0 0 0 0 0 0
```
`|:@(1,.<&5)` creates a zeroes and ones representation of the top part of the abacus:
```
   |:@(1,.<&5) 3 1 4 1 5 9
1 1 1 1 1 1
1 1 1 1 0 0
```
These two parts are boxed together using `;`:
```
   (|:@(1,.<&5);((i.5)</5|])) 3 1 4 1 5 9
\=======================/
|1 1 1 1 1 1|1 1 1 1 0 1|
|1 1 1 1 0 0|1 0 1 0 0 1|
|           |1 0 1 0 0 1|
|           |0 0 1 0 0 1|
|           |0 0 0 0 0 0|
/=======================\
```
Then the boxes are placed one on top of the other to form the basis of the abacus, giving:
```
   ,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
\===========/
|1 1 1 1 1 1|
|1 1 1 1 0 0|
<===========>
|1 1 1 1 0 1|
|1 0 1 0 0 1|
|1 0 1 0 0 1|
|0 0 1 0 0 1|
|0 0 0 0 0 0|
/===========\
```
**3) Output**
```
'|'s":(' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>
```
`&.>` means that what follows will operate on both boxes in turn.  
`(,-.)` this is a hook which will negate the input and then add it to the end of the original:
```
   2 5$1 0 1 0 1
1 0 1 0 1
1 0 1 0 1
   (,-.) 2 5$1 0 1 0 1
1 0 1 0 1
1 0 1 0 1
0 1 0 1 0
0 1 0 1 0
```
This is really part of the representation, but for golfing purposes it's better to have it in this section. Applied to the previous input:
```
   (,-.)&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
\===========/
|1 1 1 1 1 1|
|1 1 1 1 0 0|
|0 0 0 0 0 0|
|0 0 0 0 1 1|
<===========>
|1 1 1 1 0 1|
|1 0 1 0 0 1|
|1 0 1 0 0 1|
|0 0 1 0 0 1|
|0 0 0 0 0 0|
|0 0 0 0 1 0|
|0 1 0 1 1 0|
|0 1 0 1 1 0|
|1 1 0 1 1 0|
|1 1 1 1 1 1|
/===========\
```
`[:,.(_6[\' || (__)'){~` The zeroes and ones are now used to select a string to represent a bead or the absence of one:
```
   ([:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
\====================================/
| (__)  (__)  (__)  (__)  (__)  (__) |
| (__)  (__)  (__)  (__)   ||    ||  |
|  ||    ||    ||    ||    ||    ||  |
|  ||    ||    ||    ||   (__)  (__) |
<====================================>
| (__)  (__)  (__)  (__)   ||   (__) |
| (__)   ||   (__)   ||    ||   (__) |
| (__)   ||   (__)   ||    ||   (__) |
|  ||    ||   (__)   ||    ||   (__) |
|  ||    ||    ||    ||    ||    ||  |
|  ||    ||    ||    ||   (__)   ||  |
|  ||   (__)   ||   (__)  (__)   ||  |
|  ||   (__)   ||   (__)  (__)   ||  |
| (__)  (__)   ||   (__)  (__)   ||  |
| (__)  (__)  (__)  (__)  (__)  (__) |
/====================================\
```
But now, as Howard pointed out to me, there is one space short on either side of the beads. So we use the predefined `s` verb to sandwich the contents of each box between two columns of spaces:
```
   (' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
\======================================/
|  (__)  (__)  (__)  (__)  (__)  (__)  |
|  (__)  (__)  (__)  (__)   ||    ||   |
|   ||    ||    ||    ||    ||    ||   |
|   ||    ||    ||    ||   (__)  (__)  |
<======================================>
|  (__)  (__)  (__)  (__)   ||   (__)  |
|  (__)   ||   (__)   ||    ||   (__)  |
|  (__)   ||   (__)   ||    ||   (__)  |
|   ||    ||   (__)   ||    ||   (__)  |
|   ||    ||    ||    ||    ||    ||   |
|   ||    ||    ||    ||   (__)   ||   |
|   ||   (__)   ||   (__)  (__)   ||   |
|   ||   (__)   ||   (__)  (__)   ||   |
|  (__)  (__)   ||   (__)  (__)   ||   |
|  (__)  (__)  (__)  (__)  (__)  (__)  |
/======================================\
```
Having done that, all that's left is to convert this into a string using `":` so that we can sandwich it between two columns of `|`:
```
   '|'s":(' 's[:,.(_6[\'  ||   (__)'){~(,-.))&.>,.(|:@(1,.<&5);((i.5)</5|]))".,.1!:1[1
314159
|\======================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  ||
||  (__)  (__)  (__)  (__)   ||    ||   ||
||   ||    ||    ||    ||    ||    ||   ||
||   ||    ||    ||    ||   (__)  (__)  ||
|<======================================>|
||  (__)  (__)  (__)  (__)   ||   (__)  ||
||  (__)   ||   (__)   ||    ||   (__)  ||
||  (__)   ||   (__)   ||    ||   (__)  ||
||   ||    ||   (__)   ||    ||   (__)  ||
||   ||    ||    ||    ||    ||    ||   ||
||   ||    ||    ||    ||   (__)   ||   ||
||   ||   (__)   ||   (__)  (__)   ||   ||
||   ||   (__)   ||   (__)  (__)   ||   ||
||  (__)  (__)   ||   (__)  (__)   ||   ||
||  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/======================================\|
```
[Answer]
## Ruby 1.9, 154 characters
```
puts'|\%s/|'%$r=?=*(2+6*gets.size),(0..14).map{|a|a==4?"|<#$r>|":"|| #{$_.gsub(/./){(5*a+n=$&.hex)/10!=1&&(a-n%5)/5!=1?' (__) ':'  ||  '}} ||"},"|/#$r\\|"
```
Assumes the input is *not* terminated by a newline.
Fun fact: Due to the way I'm turning the input digits into numbers (`$&.hex` is one byte shorter than `$&.to_i`), this abacus actually works with hex digits up to `e`:
```
$ echo -n "0123456789abcdef" | ruby suanpan.rb
|\==================================================================================================/|
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)   ||    ||    ||    ||    ||    ||   ||
||  (__)  (__)  (__)  (__)  (__)   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   (__)  ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   (__)  (__)  (__)  (__)  (__)  (__)  ||
||   ||    ||    ||    ||    ||   (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
|<==================================================================================================>|
||   ||   (__)  (__)  (__)  (__)   ||   (__)  (__)  (__)  (__)   ||   (__)  (__)  (__)  (__)   ||   ||
||   ||    ||   (__)  (__)  (__)   ||    ||   (__)  (__)  (__)   ||    ||   (__)  (__)  (__)   ||   ||
||   ||    ||    ||   (__)  (__)   ||    ||    ||   (__)  (__)   ||    ||    ||   (__)  (__)   ||   ||
||   ||    ||    ||    ||   (__)   ||    ||    ||    ||   (__)   ||    ||    ||    ||   (__)   ||   ||
||   ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||    ||   ||
||  (__)   ||    ||    ||    ||   (__)   ||    ||    ||    ||   (__)   ||    ||    ||    ||   (__)  ||
||  (__)  (__)   ||    ||    ||   (__)  (__)   ||    ||    ||   (__)  (__)   ||    ||    ||   (__)  ||
||  (__)  (__)  (__)   ||    ||   (__)  (__)  (__)   ||    ||   (__)  (__)  (__)   ||    ||   (__)  ||
||  (__)  (__)  (__)  (__)   ||   (__)  (__)  (__)  (__)   ||   (__)  (__)  (__)  (__)   ||   (__)  ||
||  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  (__)  ||
|/==================================================================================================\|
```
For `0xf`, a third bead magically appears in the upper half.
When allowing additional flags during script invocation, this can be shortened to 152 bytes (149 bytes code + 3 bytes additional invocation flags):
```
puts'|\%s/|'%$r=?=*(2+6*~/$/),(0..14).map{|a|a==4?"|<#$r>|":"|| #{$_.gsub(/./){(5*a+n=$&.hex)/10!=1&&(a-n%5)/5!=1?' (__) ':'  ||  '}} ||"},"|/#$r\\|"
```
Run with `ruby -n suanpan.rb`.
[Answer]
## Perl (151 chars)
(~~168~~ ~~163~~ ~~158~~ ~~157~~ ~~156~~ ~~154~~)
```
$i=<>;$c.=$_-4?"
||  $i||":"
|<$m>|",$m='==',$c=~s!\d!$m.='='x6;($_-$&%5)/5%2|(5*$_+$&)/10%7==1?' ||   ':'(__)  '!eg for 0..14;print"|\\$m/|$c
|/$m\\|"
```
### Explanation
```
# Read the number from STDIN.
$i = <>;
# for statement starts here...
    # Append to $c a line containing either the horizontal dividing bar (in row #4)
    # or the current abacus row with the digits in place of the pegs.
    # This relies on the fact that $m will have been computed after at least one iteration.
    $c .= $_-4 ? "\n||  $i||" : "\n|<$m>|",
    # Notice that $m is redundantly recomputed from scratch in each iteration.
    $m = '==',
    # Substitute the correct pegs for the digit characters.
    $c =~ s!\d!
        $m .= '=' x 6;
        # Weird expression for the abacus function.
        # I have to use “% 7” because otherwise the division is floating-point...
        # Notice that $_ is the row and $& is the digit.
        ($_ - $& % 5)/5 % 2 | (5*$_ + $&)/10 % 7 == 1
        ? ' ||   '
        : '(__)  '
    !eg
for 0..14;
# Could shorten further by using “say” if you don’t mind excluding the “-E” from the count...
print "|\\$m/|$c\n|/$m\\|"
```
### Edits
* **(154 → 151)** Changed three `\n`s to actual newline characters. Can’t believe I didn’t think of that earlier!
[Answer]
## Windows PowerShell, 191
```
$y='='*(2+6*($i=[char[]]"$input").Count)
filter f($v){"|| $((' (__)','  || ')[($i|%{iex $_%$v})])  ||"}"|\$y/|"
f 1
f 10-ge5
f 1+1
f 10-lt5
"|<$y>|"
1..5|%{f 5-lt$_}
1..5|%{f 5-ge$_}
"|/$y\|"
```
History:
* 2011-03-11 23:54 **(340)** Initial attempt.
* 2011-03-12 00:21 **(323)** Using string interpolation throughout the code.
* 2011-03-12 00:21 **(321)** Inlined `$l`.
* 2011-03-12 01:07 **(299)** Used a function for the more repetitive parts as well as a format string.
* 2011-03-12 01:19 **(284)** Changed the arguments to the function slightly. Hooray for command parsing mode.
* 2011-03-12 01:22 **(266)** More variables for recurring expressions.
* 2011-03-12 01:28 **(246)** Now every row is generated by the function.
* 2011-03-12 01:34 **(236)** Since I use the chars only in string interpolation I can safely ignore the `%` that makes numbers from the digits.
* 2011-03-12 01:34 **(234)** Slightly optimized the array index generation in the function.
* 2011-03-12 01:42 **(215)** I no longer need `$r` and `$b`. And `$a` is also obsolete. As is `$l`.
* 2011-03-12 01:46 **(207)** No need to set `$OFS` if I need it only once.
* 2011-03-12 01:49 **(202)** Inlined `$f`.
* 2011-03-12 01:57 **(200)** No need for the format string anymore. String interpolation works just fine.
* 2011-03-12 02:00 **(198)** Slightly optimized generating the individual rows (re-ordering the pipeline and array index).
* 2011-03-12 02:09 **(192)** No need for `-join` since we can actually use the additional space to good effect.
[Answer]
## Haskell, 243 characters
```
z x|x=" (__) ";z _="  ||  "
h[a,b]d f w='|':a:replicate(2+6*length d)'='++b:"|\n"++q z++q(z.not)
 where q b=w>>=(\v->"|| "++(d>>=b.(>v).f)++" ||\n")
s d=h"\\/"d(5-)[-9,0]++h"><"d(`mod`5)[0..4]++h"/\\"d id[]
main=interact$s.map(read.(:[])).init
```
Not particularly clever. I'm sure it can be shortened somehow...
---
* Edit: (246 -> 243) took @FUZxxl's suggestion to use interact
[Answer]
## Delphi, 348
This version builds up a string to write just once; The digits are handled by a separate function that works via a `digit modulo m >= value` construct (negated if value <0).
```
var d,s,o,p:string;c:Char;i:Int8;function g(m,v:Int8):string;begin p:='|| ';for c in d do p:=p+Copy('  ||   (__) ',1+6*Ord(((Ord(c)+2)mod m>=Abs(v))=(v>0)),6);g:=p+' ||'^J;end;begin ReadLn(d);s:=StringOfChar('=',2+6*Length(d));for i:=1to 5do o:=g(5,6-i)+o+g(5,-i);Write('|\'+s+'/|'^J+g(1,-1)+g(10,-5)+g(1,1)+g(10,5)+'|<'+s+'>|'^J+o+'|/'+s+'\|')end.
```
Delphi, 565
First attempt : 
```
var _:array[0..6]of string=('  ||  ',' (  ) ','======','|\==/|','||  ||','|/==\|','|<==>|');m:array[0..186]of Byte;o:array[0..16]of string;i,j,c,f,l:Word;begin for i:=0to 9do begin f:=i*17;m[f+1]:=1;m[f+2]:=Ord(i<5);m[f+3]:=0;m[f+4]:=Ord(i>4);for j:=6to 10do m[f+j]:=Ord(i mod 5>j-6);for j:=11to 15do m[f+j]:=Ord(i mod 5<=j-11);m[f]:=2;m[5+f]:=2;m[16+f]:=2;end;f:=170;m[f]:=3;for i:=1to 15do m[f+i]:=4;m[f+5]:=6;m[f+16]:=5;repeat for i:=0to 16do Insert(_[m[f+i]],o[i],l);Read(PChar(@c)^);c:=c-48;f:=c*17;l:=Length(o[0])-2;until c>9;for i:=0to 16do WriteLn(o[i])end.
```
This uses 3 arrays; one for the 7 strings that could be discerned, one for the output lines and one to map the 7 strings to 11 columns (10 digits and 1 initial column).
[Answer]
### GolfScript, 139 characters
```
0+17'|':Q*:R'\<||'4Q**'/'+@{48-.5<)[1]*2,2*$+4<\5%[1]*2,5*$+10<+`{{1$=}%+2>'=='1/*5/('='+\+}+'     (|_|_ )'2//}/;;;;'/>||'4Q**'\\'+R]zip n*
```
Not much golfed yet, but it fits into a tweet (with only ASCII). Try it [here](http://golfscript.apphb.com/?c=IjMxNDE1OSIKCjArMTcnfCc6USo6UidcPHx8JzRRKionLycrQHs0OC0uNTwpWzFdKjIsMiokKzQ8XDUlWzFdKjIsNSokKzEwPCtge3sxJD19JSsyPic9PScxLyo1LygnPScrXCt9KycgICAgICh8X3xfICknMi8vfS87Ozs7Jy8%2BfHwnNFEqKidcXCcrUl16aXAgbioK&run=true).
[Answer]
# J, 225
Passes two tests given, should work up to at least several hundred digits.
```
c=:2 6$'   ||   (__)'
f=:(2{.[),('='#~2+6*#@]),2}.[
d=:'||',"1'  ||',~"1,"2&(c{~|:)
g=:('|\/|'&f,d&(1,.-.,.0,.])&(4&<),'|<>|'&f,d&(5($!.0"1)0,~"(1)1#~"0|~&5),|.&d&(5($!.0"1)1#~"0(5-5|])),'|/\|'&f)
4(1!:2)~LF,"1 g"."0}:(1!:1)3
```
First off: Yes, yes, gravedigging. Second: That's just embarassingly long. Oh well. I haven't decided yet whether to golf it further or curl up in fetal position and cry. (Or both!)
Here's a bit of explanation in lieu of a shorter program:
* c is 2x6 table of empty cell, bead cell for rendering.
* f renders an '=' row with the four outside characters as left argument.
* d renders an abacus row by translating 0/1 matrices into bead cells padded with ||
* g takes digits and vertically compiles character rows using f for 'formatting' rows and d for abacus rows.
* The last row gets input, splits into characters and converts those to numbers, feeds to g and then prints.
[Answer]
## C, ~~277~~ 274 characters
You know, it seems to me that we just don't have enough solutions here that really take advantage of the C preprocessor. Partly that's because those `#define`s actually take up a fair bit of space. But still, there's so much potential. I feel the need to address this deficiency.
```
#define L(x,z)for(printf("|"x),p=b;*p||puts(#z)<0;++p)printf(
#define F(x,y,z)L(#x,==z|)"======",y);
#define T(y)L("|  ",||)*p-47 y?"(__)  ":" ||   ");
i;char*p,b[99];main(j){gets(b);F(\\,0,/)T()T(<6)T(<1)T(>5)F(<,*p>52?*p-=5:0,>)
for(;++i<6;)T(>i)for(;++j<7;)T(<j)F(/,0,\\)}
```
That's better.
[Answer]
# Mathematica 281
```
w@n_:= Module[{t=Table,f,g},
 f@d_:=ReplacePart["O"~t~{7},{2-Quotient[d,5]-> "|",3+Mod[d,5]-> "|"}];
 g@k_:=IntegerDigits@n~PadLeft~10;
 Grid[Insert[Insert[(f/@g@n)T,"=="~t~{10},{{1},{3},{8}}]T,""~t~{10},{{1},{11}}]T]]
```
**Example**
```
w[6302715408]
```
![abacus](https://i.stack.imgur.com/EIr1U.png)
[Answer]
## C, 548
```
#define p(a) printf(a);
#define F(x,m) for(x=0;x<m;x++)
#define I(x) {p("||")F(j,l)if(b[l*(i+x)+j]){p("  (__)")}else{p("   || ")}p("  ||\n")}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int a,char* c[]){int i,j,l,m,*b;l=strlen(c[1]);b=(int*)malloc(l*56);m=6*l;F(i,14*l)b[i]=0;
F(j,l){b[j]=1;if(c[1][j]<53){b[l+j]=1;}else{b[3*l+j]=1;c[1][j]-=5;}F(i,5){if(i<c[1][j]-'0'){
b[(i+5)*l+j]=1;}else{b[(i+9)*l+j]=1;}}}p("|\\=")F(i,m)p("=")p("=/|\n")F(i,4)I(0)p("|<=")F(i,m)
p("=")p("=>|\n")F(i,9)I(5)p("|/=")F(i,m)p("=")p("=\\|\n")}
```
First version, just a bit of golfing so far.
[Answer]
## Scala (489 characters)
```
def a(i:String){val b=" (__) ";val n="  ||  ";1 to 17 map{l=>;{print(l match{case 1=>"|\\=";case 6=>"|<=";case 17=>"|/=";case _=>"|| "});print(l match{case 1|6|17=>"======"*i.size;case 2|16=>b*i.size;case 4|11=>n*i.size;case 3=>i flatMap{d=>{if(d.asDigit<5)b else n}};case 5=>i flatMap{d=>{if(d.asDigit>4)b else n}};case _=>i flatMap{d=>{if(l<11)if(d.asDigit%5<l-6)n else b else if(d.asDigit%5>l-12)n else b}}});;print(l match{case 1=>"=/|";case 6=>"=>|";case 17=>"=\\|";case _=>" ||"})}}}
```
Pretty crappy attempt really.
[Answer]
# [Sclipting](http://esolangs.org/wiki/Sclipting), 77 chars
The bounty refers to *tweets*, and Twitter counts *characters* (not bytes). :)
```
꿓뤽꿓뤽①長復標독렽꿐②껷렊밃겠上❶가侔是丟돃렽꿐②꿧렊不돇렠글⓶①各❷❷걐剩減갰減갰分❸⓷걀大加增增감右與꺅뭟꺒갠⓵긇롼긂갠嗎⓶終丟돇렊終終돂묽꿐②뇇렊
```
I actually wrote this years ago (when this challenge was posted), but I never posted it because I invented Sclipting after this challenge was first posted. If you feel that this makes it ineligible, I understand.
## Explanation
```
꿓뤽꿓뤽①長復 | let x = "======" times the length of the input string
標 | mark
독렽꿐②껷렊 | "|\\==" + x + "/|\n"
밃겠上 | for row in [-4 .. 10]
    ❶가侔是 | if row == 0
        丟돃렽꿐②꿧렊 | "|<==" + x + ">|\n"
    不 | else
        돇렠글 | "||  "
        ⓶①各 | foreach char c in input
            | ((r-(c%5)-3)/3 & ((r + (c>4?3:2)) >> 1)) ? "(__) " : " ||   "
            ❷❷걐剩減갰減갰分❸⓷걀大加增增감右與꺅뭟꺒갠⓵긇롼긂갠嗎⓶
        終丟
        돇렊 | "||\n"
    終
終
돂묽꿐②뇇렊 | "|/==" + x + "\\|\n"
```
[Answer]
# Python, ~~309~~ ~~301~~ 288 chars
Compact version:
```
q=p,b="  ||  "," (__) "
t="|| %s ||\n"
a=lambda h:t%"".join(q[i]for i in h)
n=[int(d)for d in str(input())]
c=len(n)
e="="*(c*6+2)
h="|\\"+e+"/|"
print h+"\n"+t%(b*c)+a(d<5 for d in n)+t%(p*c)+a(d>4 for d in n)+"|<"+e+">|\n"+"".join(a((d%5>i%5)^(i>4)for d in n)for i in range(10))+h[::-1]
```
Clear version:
```
bead = " (__) "
pole = "  ||  "
template = "|| %s ||\n"
output = ""
def addline(hasbeads):
    global output
    output += template % "".join([bead if item else pole for item in hasbeads])
digits = [int(d) for d in str(input())]
count = len(digits)
equalsigns = "=" * (count * 6 + 2)
output = ""
header = "|\\" + equalsigns + "/|"
output += header + "\n"
output += template % (bead * count)
addline([d < 5 for d in digits])
output += template % (pole * count)
addline([d > 4 for d in digits])
output += "|<" + equalsigns + ">|\n"
for i in range(5):
    addline([d % 5 > i for d in digits])
for i in range(5):
    addline([d % 5 <= i for d in digits])
output += header[::-1]
print output
```
Note that for compactification, variables were renamed to a single letter, and list comprehensions were changed to generators that don't require extra brackets.
]