SAN FRANCISCO (Reuters) - Facebook agreed to pay an undisclosed amount of cash and stock to settle a long- running legal battle over whether founder Mark Zuckerberg stole ideas for the site from fellow Harvard students, according to court documents released late on Wednesday.