       IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 INP PIC X(20).
       01 N PIC 9999.
       01 Y PIC 99999999.
       01 temp1 PIC 99.
       01 S PIC 9999.
       01 T PIC 9999.
       01 temp2 PIC 9999.
       01 temp3 PIC 9999.
       01 RE1 PIC ZZZ9.
       01 RE2 PIC ZZZ9.
       01 RE3 PIC ZZZ9.
       PROCEDURE DIVISION.
       MAIN.
      	ACCEPT INP.
      	PERFORM VARYING S FROM 1 BY 1 UNTIL INP(S:1)=SPACE
      	END-PERFORM.
      	SUBTRACT 1 FROM S.
      	MOVE INP(1:S) TO N.
      	ADD 2 TO S.
      	PERFORM VARYING temp1 FROM S BY 1 UNTIL INP(temp1:1)=SPACE
      	END-PERFORM.
      	COMPUTE temp1 = temp1 - S.
      	MOVE INP(S:temp1) TO Y.
      	COMPUTE Y = Y / 1000 .
      	PERFORM VARYING S FROM 0 BY 1 UNTIL S > N
      		COMPUTE temp1 = N - S
      		PERFORM VARYING T FROM 0 BY 1 UNTIL T > temp1
      			COMPUTE temp2 = temp1 - T
      			COMPUTE temp3 = S * 10 + T * 5
      			COMPUTE temp3 = temp3 + temp2
      			IF temp3 = Y THEN
      				MOVE S TO RE1
      				MOVE T TO RE2
      				MOVE temp2 TO RE3
      				DISPLAY RE1 " " RE2 " " RE3
      				STOP RUN
      			END-IF
      		END-PERFORM
      	END-PERFORM.
      	DISPLAY "-1 -1 -1".
      	STOP RUN.


