Sandoval's homer, 3 hits help Giants beat Reds 6-5