virgin = true

readlines.each do |input|
  puts "" unless virgin

  na = input.chomp.chars.map(&:to_i)
  digit_n = na.size
  zero = "* = ****"
  result = Array.new(5)
  result.map!{zero.dup}
  ri = 5 - digit_n

  0.upto(digit_n-1) do |i|
    result[ri][3] = '*' unless (na[i] % 5).zero?
    if 5 <= na[i]
      result[ri][0] = ' '
      result[ri][1] = '*'
    end
    result[ri][na[i]%5+3] = ' '
    ri += 1
    break if 4 < ri
  end

  0.upto(7) do |i|
    0.upto(4) do |j|
      print result[j][i]
      puts "" if j == 4
    end
  end

  virgin = false if virgin
end