naive solution to problem 7
problem6