Fermat's sandwich theorem