If one consider the Maxwell action as $$S=-\int \mathrm{d^{4}}x\! \ \frac{1}{4}F_{ab}F^{ab} \,$$ one find the usual Maxwell equation $$\partial_{a}F^{ab}=0$$ Then one can simply arrive the following the Maxwell on-shell action $$-\int \mathrm{d^{4}}x\! \ \frac{1}{2}\partial_{a}(A_{b}F^{ab}) \,$$
Now my question is for Einstein Hilbert action. What is the expression of on-shell Einstein Hilbert action $$S=\int \mathrm{d^{4}}x\! \ R \,$$ I know how to find Einstein equation from variational principle, which is given as $$R_{ab}-\frac{1}{2}g_{ab}R=0$$
How to write on-shell Einstein Hilbert action with above equation?