Homework-4, problem 1 improved.

untill now it have big bug.