       IDENTIFICATION DIVISION.
       PROGRAM-ID. A
       DATA DIVISION.
       FILE SECTION.
       WORKING-STORAGE SECTION.
       01 N PIC 9(5).
       01 K PIC 9(5).
       01 X PIC 9(5).
       01 Y PIC 9(5).
       01 ANS PIC 9(9).
       01 ANSS PIC Z(9).
 
       PROCEDURE DIVISION.
       MAIN-PROCEDURE.
               ACCEPT N .
               ACCEPT K .
               ACCEPT X .
               ACCEPT Y .
               IF K < N THEN
                   COMPUTE ANS = K * X + (N - K) * Y
               ELSE
                   COMPUTE ANS = N * X
               END-IF.
               MOVE ANS TO ANSS.
               DISPLAY ANSS.
               STOP RUN.
       END PROGRAM A .
