Proble 017 rewritten