IN A
IN B
IN C
IN D
IN E
MOV H 1
CMP C H
JZ 20
IN G
MOV F D
LOAD F D
MOV RES G
ADD D RES
STORE F D
ADD F H
MOV H 1
CMP F E
JNZ 11
JZ 29
MOV RES 0
MOV F D
LOAD F D
ADD RES D
ADD F H
MOV H 1
CMP F E
JNZ 21
OUT RES
SUB B H
MOV H 1
MOV G 0
CMP B G
JZ 3
RETURN