       IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 A PIC 99.
       01 B PIC 99.
       01 C PIC 99.
       01 X PIC 99999.
       01 RE PIC 99999.
       01 REN PIC ZZZZ9.
       01 temp1 PIC 99999.
       01 S PIC 99.
       01 T PIC 99.
       01 U PIC 99.
       PROCEDURE DIVISION.
       MAIN.
      	ACCEPT A.
      	ACCEPT B.
      	ACCEPT C.
      	ACCEPT X.
      	ADD 1 TO A.
      	ADD 1 TO B.
     	ADD 1 TO C.
      	MOVE 0 TO RE.
      	PERFORM VARYING S FROM 0 BY 1 UNTIL S = A
      		PERFORM VARYING T FROM 0 BY 1 UNTIL T = B
      			PERFORM VARYING U FROM 0 BY 1 UNTIL U = C
      				COMPUTE temp1 = S * 500
      				COMPUTE temp1 = temp1 + T * 100
      				COMPUTE temp1 = temp1 + U * 50
      				IF temp1 = X THEN
      					ADD 1 TO RE
      				END-IF
      			END-PERFORM
      		END-PERFORM
      	END-PERFORM.
      	MOVE RE TO REN.
      	DISPLAY REN.
        STOP RUN.



