(define (solve a b s) (let ((da (abs (- a s))) (db (abs (- b s)))) (cond ((or (<= da db) (= s 1)) (+ da s)) ((not (= a 0)) (+ db a (min (- s 1) k))) (else (+ t s 1))))) (let* ((a (read)) (b (read)) (s (read))) (print (solve a b s)))