The mechanics of slithering locomotion