I think the cheapest way to do it would be book an open jaw itinerary home-Tokyo and Hong Kong-home (or reverse) and then book Tokyo-Shanghai-Hong Kong on a discount carrier.
However, I'm not sure you can use the free transit visa if you go this route, so the cost of the visas might tip the...