How did ancient philosophers understand the relationship between human capacities for thinking and our experiences of pleasure and pain?