Proverbs 19:25

When the pestilent are scourged, the foolish will become wiser. But if you chastise the wise, he will understand discipline

Other versions

King James Version

Smite a scorner, and the simple will beware: and reprove one that hath understanding, and he will understand knowledge.

English Standard Version

Strike a scoffer, and the simple will learn prudence; reprove a man of understanding, and he will gain knowledge.

New International Version

Flog a mocker, and the simple will learn prudence; rebuke a discerning man, and he will gain knowledge.