#!/usr/bin/guile \
-e main -s
!#
(use-modules ((srfi srfi-1)
#:select (last unfold)))
(define (Func num max)
(modulo
(last
(unfold (lambda (x) (> (* x (modulo x 10)) max))
(lambda (x) x)
(lambda (x) (1+ x))
num)) 10))
(define (main args)
(with-exception-handler
(lambda (ex)
(display "wrong number of arguments")
(newline))
(lambda ()
(format #t "N = ~a~%"(apply Func (map string->number (cdr args)))))))
IyEvdXNyL2Jpbi9ndWlsZSBcCi1lIG1haW4gLXMKISMKCih1c2UtbW9kdWxlcyAoKHNyZmkgc3JmaS0xKQogICAgICAgICAgICAgICM6c2VsZWN0IChsYXN0IHVuZm9sZCkpKQoKKGRlZmluZSAoRnVuYyBudW0gbWF4KQogIChtb2R1bG8KICAgKGxhc3QKICAgICh1bmZvbGQgKGxhbWJkYSAoeCkgKD4gKCogeCAobW9kdWxvIHggMTApKSBtYXgpKQogICAgICAgICAgICAobGFtYmRhICh4KSB4KQogICAgICAgICAgICAobGFtYmRhICh4KSAoMSsgeCkpCiAgICAgICAgICAgIG51bSkpIDEwKSkKCihkZWZpbmUgKG1haW4gYXJncykKICAod2l0aC1leGNlcHRpb24taGFuZGxlcgogICAgICAobGFtYmRhIChleCkKICAgICAgICAoZGlzcGxheSAid3JvbmcgbnVtYmVyIG9mIGFyZ3VtZW50cyIpCiAgICAgICAgKG5ld2xpbmUpKQogICAgKGxhbWJkYSAoKQogICAgICAoZm9ybWF0ICN0ICJOID0gfmF+JSIoYXBwbHkgRnVuYyAobWFwIHN0cmluZy0+bnVtYmVyIChjZHIgYXJncykpKSkpKSkKCg==