Answer:
The maximum amount is the $51,000 investigation costs related to the bakery.
Stanford is neither in the bakery business or in the restaurant business. It is in the cleaning business. Therefore, it can only deduct investigation expenses that resulted in acquistions of businesses in other sectors.
As Stanford did not buy the restaurant, it cannot deduct the $28,000 spent on investigation. It can oly deduct the $51,000 spend on investigation costs because it did buy the bakery.