L = 5
table = Array.new(10) {|i| [i / 5, i % 5]}

r = $<.readlines.map {|l| l.chomp.rjust(L, "0").chars.map(&:to_i)}.map do |given|
  soroban = given.map do |place|
    high, low = table[place]
    ((high.zero? ? "* =" : " *=") + "*" * low + " " + "*" * (4 - low)).chars
  end
  soroban.transpose.map {|l| l.join + "\n"}.join
end.join("\n")

print r
