We used the fact that the engine itself is periodic, so its internal energy has not changed after one cycle. The same is true for its entropy, so the entropy increase "S"2 - "S"1 of our system after one cycle is given by the reduction of entropy of the hot source and the increase of the cold sink. The entropy increase of the total system "S"2 - "S"1 is equal to the entropy production "S"i due to irreversible processes in the engine so