Pagan hits three-run homer to lead Giants