I believe that the answer to the question asked above is that
work done by ideal heat engine = q1 - q2
where q = vRTln(Va/Vb)
thus
w = vRTln1(Va/Vb) -vRTln2(Vc/Vd)
Hope my answer would be a great help for you. If you have more questions feel free to ask here at Brainly.