solve up to problem 4