Man gets 40 years for killing his wife, three children