Valmiki Ramayana Kishkindha Kanda Sarga 18 Shloka 32
Original Shlokaराजभिर्धृतदण्डास्तु कृत्वा पापानि मानवाः। निर्मलास्स्वर्गमायान्ति सन्तस्सुकृतिनो यथा4.18.32।।
1 source checked for this shloka
मानवाः human beings, पापानि sins, कृत्वा having done, राजभिः by kings, धृतदण्डाः those punished, निर्मलाः purified, सुकृतिनः like those men performing good deeds, सन्तः यथा like pious men, स्वर्गम् heaven, आयान्ति will attain.
'Men who have perpetrated sins should be subjected to punishment by kings so that they become stainless and attain heaven like pious men who have performed good deeds.