solved tasks 1-4