How to get dog used to loud children?

My dog hasn’t been around many children but still remains indifferent to them. There was a 4 year old at the pet store shouting “Ball! Ball! Ball!” for the entire time we were in the queue and my dog could not remain focused. The shouting was triggering me so I can understand why he struggled with it, but how would I go about ensuring he can remain focused through loud noises?