Optimal throughput for multistage input-output processes