(define (mystery f g h a b)
  (if (> a b)
      h
      (g (f a) (mystery f g h (+ a 1) b))))

(mystery (lambda (x) (* x x)) + 0 1 5)