class Aba
  def initialize
    @a = []
    @a[0]="* = ****".split(//)
    @a[1]="* =* ***".split(//)
    @a[2]="* =** **".split(//)
    @a[3]="* =*** *".split(//)
    @a[4]="* =**** ".split(//)
    @a[5]=" *= ****".split(//)
    @a[6]=" *=* ***".split(//)
    @a[7]=" *=** **".split(//)
    @a[8]=" *=*** *".split(//)
    @a[9]=" *=**** ".split(//)
  end
  def transpose(p)  # p: m(rows) x n(columns)
    m = p.length
    n = p[0].length
    q = Array.new(n).map{Array.new(m)}

    0.upto(m-1){|i|
      0.upto(n-1){|j|
        q[j][i]=p[i][j]
      }
    }
    return q
  end

  def conv(n)
    s = sprintf("%.5d", n).split(//).map{|x|x.to_i}
    m = [@a[s[0]],@a[s[1]],@a[s[2]],@a[s[3]],@a[s[4]]]
    t=m.transpose.map{|x| x.join}
    return t
  end

end

def main
  if true then
    fh=STDIN
  else
    fh=open("in1_0128.txt")
  end

  ab = Aba.new
  glyph = []
  while fh.gets do
    n=$_.chomp.to_i
    glyph.push(ab.conv(n))
  end

  0.upto(glyph.length-1){|i|
    puts glyph[i]
    puts if i != glyph.length-1
  }

end

if $0 == __FILE__ then
  main
end