Structure and electronic state of the TiO2 and SrO terminated SrTiO3(100) surfaces