Deriving Clausius inequality in the case of two reservoirs is quite simple. We assume that there is a thermal machine operating between two reservoirs, the first at temperature $T\_1$ and the second at temperature $T\_2$ with $T\_2 < T\_1$.

The whole idea is that we can write the efficiency

$$\eta= 1-\dfrac{Q\_2}{Q\_1},$$

for that machine and compare with the effiency of a reversible machine operating between the reservoirs:

$$\eta\_r = 1 - \dfrac{T\_2}{T\_1}.$$

By Kelvin's statement of the second law we have $\eta \leq \eta\_r$. This implies directly that

$$\dfrac{Q\_2}{Q\_1}\geq\dfrac{T\_2}{T\_1}\Longrightarrow \dfrac{Q\_1}{T\_1}-\dfrac{Q\_2}{T\_2}\leq 0.$$

But we already know that $Q\_2 < 0$ because $Q\_2$ is the rejected heat, so that $-Q\_2 = |Q\_2|$, while $Q\_1 = |Q\_1|$ because $Q\_1 > 0$. This gives Clausius inequality

$$\dfrac{|Q\_1|}{T\_1}+\dfrac{|Q\_2|}{T\_2}\leq 0.$$

Now, suppose we want to do it with three reservoirs. That is, we know that a heat $Q\_3> 0$ is extracted from a reservoir at $T\_3$, heat $Q\_2>0$ is extracted from a reservoir at $T\_2$ and heat $Q\_1 > 0$ is rejected to a reservoir at temperature $T\_1$. 

I want to derive Clausius inequality, but I don't know how to do, because we have three reservoirs, instead of two. In that case we cannot use the efficiencies directly it seems.

How do we derive this result here?