#lang scheme

(define a 4)

(define (h c)
  (* c c))

(define (f b)
  (define c (+ b a))
  (define (g b)
    (if (> b c)
        (begin (set! a b)
               (h (- b 1)))
        (begin (set! a (f (- (quotient b 2) 2)))
               (+ a c))))
  (define (h c)
    (define a (+ b 2))
    (define (while)
      (cond [(< a c)
             (set! a (+ a (g b)))
             (while)]))
    (while)
    a)
  
  (if (> b 0)
      (h (g c))
      c))

(f 5)