basics for solving problem 4