Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := [10]string{
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** ",
	}
	for scanner.Scan() {
		tmp := strings.Split(fmt.Sprintf("%05s", scanner.Text()), "")
		ans := make([]string, 0)
		for _, v := range tmp {
			iv, _ := strconv.Atoi(v)
			ans = append(ans, table[iv])
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 5; j++ {
				fmt.Print(string(ans[j][i]))
			}
			fmt.Println()
		}
		fmt.Println()
	}
}

Python: def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

table = \
["* = ****",\
 "* =* ***",\
 "* =** **",\
 "* =*** *",\
 "* =**** ",\
 " *= ****",\
 " *=* ***",\
 " *=** **",\
 " *=*** *",\
 " *=**** "]

N = list(get_input())
for l in range(len(N)):

    if l > 0:
        print("")

    num = int(N[l])
    ans = []

    for i in range(5):
        ans.append(table[num // 10**(4-i)])
        num = num % 10**(4-i)

    for i in range(8):
        for j in range(5):
            print(ans[j][i], end="")
        print("")

Python: from sys import stdout


def upper(n):
    if n < 5:
        return list("* ")
    else:
        return list(" *")


def lower(n):
    m = n % 5
    a = ['*'] * m + [' ']
    a = a + ['*'] * (5 - len(a))
    return a


def abacus(n):
    return upper(n) + ['='] + lower(n)


while True:
    try:
        ns = map(int, ('00000' + raw_input().strip())[-5:])
    except EOFError:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    for i in range(8):
        for j in range(5):
            stdout.write(ab[j][i])
        stdout.write("\n")

    print

Python: from sys import stdout


def upper(n):
    if n < 5:
        return ['*', ' ']
    else:
        return [' ', '*']


def lower(n):
    m = n % 5
    return ['*'] * m + [' '] + ['*'] * (4 - m)


def abacus(n):
    return upper(n) + ['='] + lower(n)


while True:
    try:
        ns = map(int, ('00000' + raw_input().strip())[-5:])
    except EOFError:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    res = []
    for i in range(8):
        for j in range(5):
            res.append(ab[j][i])
        res.append('\n')
    res.append('\n')

    stdout.write(''.join(res[:-2]))

Python: import sys

isnewLine = False

pattern = {"0": "* = ****",
           "1": "* =* ***",
           "2": "* =** **",
           "3": "* =*** *",
           "4": "* =**** ",
           "5": " *= ****",
           "6": " *=* ***",
           "7": " *=** **",
           "8": " *=*** *",
           "9": " *=**** ",
           }

for line in sys.stdin:

    if isnewLine:
        print()
    else:
        isnewLine = True

    line = line[:-1]

    line = "0" * (5 - len(line)) + line

    bar = [pattern[item] for item in line]

    for i1, i2, i3, i4, i5 in zip(bar[0], bar[1], bar[2], bar[3], bar[4]):
        print(i1 + i2 + i3 + i4 + i5)

Python: import sys

pattern = {"0": "* = ****",
           "1": "* =* ***",
           "2": "* =** **",
           "3": "* =*** *",
           "4": "* =**** ",
           "5": " *= ****",
           "6": " *=* ***",
           "7": " *=** **",
           "8": " *=*** *",
           "9": " *=**** ",
           }

for line in sys.stdin:
    line = line[:-1]

    line = "0" * (5 - len(line)) + line

    bar = [pattern[item] for item in line]

    for i1, i2, i3, i4, i5 in zip(bar[0], bar[1], bar[2], bar[3], bar[4]):
        print(i1 + i2 + i3 + i4 + i5)

Python: from sys import stdout


def upper(n):
    if n < 5:
        return list("* ")
    else:
        return list(" *")


def lower(n):
    m = n % 5
    a = ['*'] * m + [' ']
    a = a + ['*'] * (5 - len(a))
    return a


def abacus(n):
    return upper(n) + ['='] + lower(n)


while True:
    try:
        ns = map(int, ("0" + raw_input().strip())[-6:])
    except EOFError:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    for i in range(8):
        for j in range(5):
            stdout.write(ab[j][i])
        stdout.write("\n")

    print

Python: from sys import stdout


def upper(n):
    if n < 5:
        return ['*', ' ']
    else:
        return [' ', '*']


def lower(n):
    m = n % 5
    return ['*'] * m + [' '] + ['*'] * (4 - m)


def abacus(n):
    return upper(n) + ['='] + lower(n)


res = []
while True:
    try:
        ns = map(int, ('00000' + raw_input().strip())[-5:])
    except EOFError:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    for i in range(8):
        for j in range(5):
            res.append(ab[j][i])
        res.append('\n')
    res.append('\n')

stdout.write(''.join(res[:-1]))

Python: abacus = ["* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ",
          " *= ****", " *=* ***", " *=** **", " *=*** *", " *=**** "]
first = False

while 1:
    try:
        n = input()
    except EOFError:
        break

    if first:
        print()
    else:
        first = True

    n = n.zfill(5)
    nlist = list(n)

    ans = []
    for n in nlist:
        ans.append(list(abacus[int(n)]))

    ans_t = [list(x) for x in zip(*ans)]

    for i in range(8):
        print(''.join(a for a in ans_t[i]))

Python: # AOJ 0128 Abacus
# Python3 2018.6.19 bal4u

abacus = [
	[ '*', '*', '*', '*', '*', ' ', ' ', ' ', ' ', ' ' ],
	[ ' ', ' ', ' ', ' ', ' ', '*', '*', '*', '*', '*' ],
	[ '=', '=', '=', '=', '=', '=', '=', '=', '=', '=' ],
	[ ' ', '*', '*', '*', '*', ' ', '*', '*', '*', '*' ],
	[ '*', ' ', '*', '*', '*', '*', ' ', '*', '*', '*' ],
	[ '*', '*', ' ', '*', '*', '*', '*', ' ', '*', '*' ],
	[ '*', '*', '*', ' ', '*', '*', '*', '*', ' ', '*' ],
	[ '*', '*', '*', '*', ' ', '*', '*', '*', '*', ' ' ]]
ans = [['' for c in range(5)] for r in range(8)]

first = True
while True:
	try: n = list(input())
	except: break
	for i in range(5-len(n)):
		for r in range(8): ans[r][i] = abacus[r][0]
	for i in range(len(n)):
		for r in range(8): ans[r][5-len(n)+i] = abacus[r][int(n[i])]
	if first: first = False
	else: print()
	for r in range(8): print(*ans[r], sep='')

Python: abcus = {"0":"* = ****","1":"* =* ***","2":"* =** **","3":"* =*** *","4":"* =**** ",
        "5":" *= ****","6":" *=* ***","7":" *=** **","8":" *=*** *","9":" *=**** "}
num = [["" for i in range(5)] for j in range(8)]
cnt = 0
while True:
    try:
        a = input().zfill(5)
        if cnt != 0:
            print()
        for i in range(5):
            n = abcus[a[i]]
            for j in range(8):
                num[j][i] = n[j]
        for i in range(8):
            print("".join(num[i]))
        cnt+=1
    except:
        break

Python: from sys import stdout


def upper(n):
    if n < 5:
        return list("* ")
    else:
        return list(" *")


def lower(n):
    m = n % 5
    a = ['*'] * m + [' ']
    a = a + ['*'] * (5 - len(a))
    return a


def abacus(n):
    return upper(n) + ['='] + lower(n)


while True:
    try:
        ns = map(int, ('0' + raw_input().strip())[-5:])
    except:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))

    for i in range(8):
        for j in range(5):
            stdout.write(ab[j][i])
        stdout.write("\n")

    print

Python: from sys import stdout


def upper(n):
    if n < 5:
        return ['*', ' ']
    else:
        return [' ', '*']


def lower(n):
    m = n % 5
    return ['*'] * m + [' '] + ['*'] * (4 - m)


def abacus(n):
    return upper(n) + ['='] + lower(n)


while True:
    ns = map(int, ('00000' + raw_input().strip())[-5:])
    if ns == [0, 0, 0, 0, 0]:
        break

    ab = []
    for n in ns:
        ab.append(abacus(n))
    
    res = []
    for i in range(8):
        for j in range(5):
            res.append(ab[j][i])
        res.append('\n')
    res.append('\n')
    
    stdout.write(''.join(res[:-1]))