puts $<.map {|l|
  ('%05d' % l.chomp.to_i).each_char.map(&:to_i).each_with_object([]) {|x, cs|
    cs << (x / 5 == 0 ? [?*, ?\ , ?=] : [?\ , ?*, ?=]) + [?*] * (x % 5) + [?\ ] + [?*] * (4 - x % 5)
  }.transpose.map(&:join).join ?\n
}.join "\n\n"