Solving rational expectation models with first order perturbation: what Dynare does (Part 1 of 2)