Fifth problem solution