add solution to fourth problem