Pagan’s 9th inning bomb lifts Giants