Automated Lead Distribution

Automated Lead Distribution

I am try to set up automated lead distribution such that when a new lead come in from Web to Lead form it is automatically assigned to the next Sales agent in a distribution list. However I also need a modifier/rule that states "if the next sales agent is not assigned to the territory (by state) then it is then assigned to the next available sales agent, and so on...
Thanks