improve P6
add problem 7