As you can see in the image, I'm trying to merge selected polygons and their respective attributes. I have thousands of these polygons (some very small, others very large). I have to create areas of around 40000 m^2 (doesn't have to be exactly this area, but approximately). Some of these polygons already exceed this area value, so in that case, they shouldn't be merged with others (in the cases they are very large, ideally they should be divided into parts with the referred area value, but this procedure is not as important).
I also need that the merged polygons, merge their attributes (such as sum the population value, so that the final polygon has the total population value of all the merged polygons).
Is there any way to AUTOMATE this task? The shape of the final polygon doesn't matter, as long as it has around 40000 m^2 and its attribute values are summed up. I'm using QGIS 3.26.3.