The 2 approximating rectangles each have width = π/4 (which is 1/2 the width of the entire interval).

The x-coordinate of the midpt of the 1st subinterval is π/8. (1/2 way between 0 and π/4).

The x-coordinate of the midpt of the 2nd subinterval is 3π/8. (1/2 way between π/4 and π/2).

So the sum of those 2 areas = π/4 ⋅ f(π/8) + π/4 ⋅ f(3π/8). Compare that mdpt sum to the exact area given.