Hi,
You'd need two variables that will hold the numbers of last page for each type (l_page_type_3 and l_page_type_53, for example). I hope you are able to determine those... If not, one would need to see how you control the smartfrom page breaks to figure that out... Once you have figured out those, create final windows for totals output, with condition sfsy-page = l_page_type_3 and sfsy-page = l_page_type_53.
cheers,
Jānis