How to solve perimeter and area?