IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_076_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 i      PIC 9(2).

    01 board  PIC 9(11) VALUE 1.

    01 N      PIC 9(2).
    01 K      PIC 9(2).

    01 ans    PIC X(11).

    01 ZS     PIC Z(12)9.
    01 DUMMY  PIC X(1).

PROCEDURE                        DIVISION.
MAIN.
    ACCEPT N.
    ACCEPT K.

    PERFORM VARYING i FROM 1 BY 1 UNTIL N < i
        COMPUTE board = FUNCTION MIN (board * 2, board + K)
    END-PERFORM.

    MOVE board TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.
