solving problem 1