who was the first elected president of the United States after the civil war