You go through customs in the first country you land in. For instance, if you fly from Paris to Los Angeles with a layover in Philadelphia, you would go through customs in Philadelphia. When you go through customs in Philadelphia, you have to pick up your checked bags, go through customs, and then re-check them.