Its simple. You need to know some formulae here:
Perimeter of a Circle (given radius r) is: 2*pi*r
Area of a circle is: pi*r^2
Perimeter of a square is: 4*length of side
Area of a square is: side^2
Based on the inputs from the question, we know that 'r' is the radius of the circle. So, the perimeter of the circle (length of wire used) is: 2*pi*r
So, the remaining wire is: (40-2*pi*r) that will be used for making a square. The side of the square (40-2*pi*r)/4 (since a square has 4 sides). So, the area of the square will be ((40-2*pi*r)/4)^2. This can be further reduced to (10-pi*r/2)^2
Adding both the areas will give you the answer: pi*r^2 + (10-pi*r/2)^2