flag = true
while line = gets
  if flag
    flag = false
  else puts
  end
  line.chomp!
  nums = line.rjust(5,"0").split("").map(&:to_i);
  nums.each do |n|
    if n<5
      print "*"
    else print " "
    end
  end
  puts
  nums.each do |n|
    if n>=5
      print "*"
    else print " "
    end
  end
  puts
  puts "====="
  a = nums.map{|n| n%5}
  1.upto(5) do |i|
    a.each_with_index do |x,j|
      if i<=x
        print "*"
      else
        print " "
        a[j]=5
      end
    end
    puts
  end
end