Quantum-chemical study of the mechanism of the hydrolysis of amides in the gas phase and in aqueous solution