Deuteronomy 5:9-10

9You shall not bow down to them or serve them; for I the  Lord your God am a jealous God, visiting the iniquity of the fathers on the children to the third and fourth generation of those who hate me, 10but showing steadfast love to a  thousands
Or  to the thousandth generation
of those who love me and keep my commandments.

Copyright information for ESV