Dynamic Service Programming with Path Preprocessing