       IDENTIFICATION DIVISION.
       PROGRAM-ID. test1.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 N PICTURE 99999.
       01 K PICTURE 99999.
       01 X PICTURE 99999.
       01 Y picture 99999.
       01 REN PICTURE 9(20).
       01 RE PIC Z(20).
       PROCEDURE DIVISION.
       MAIN.
        ACCEPT N.
        ACCEPT K.
        ACCEPT X.
        ACCEPT Y.
        IF N<=K THEN
         COMPUTE REN=X*N
        ELSE 
         COMPUTE REN=X*K
         COMPUTE N=N-K
         COMPUTE REN=REN+N*Y
        END-IF.
        MOVE REN TO RE.
        DISPLAY RE.
      	STOP RUN.