IDENTIFICATION DIVISION.
PROGRAM-ID. A-KthTerm.
 
DATA DIVISION.
WORKING-STORAGE SECTION.
01 K   PIC 9(2).
01 TBL.
   03  FILLER PIC X(32) VALUE '01010102010201050202010501020114'.
   03  FILLER PIC X(32) VALUE '01050105020201150202050401040151'.
01 TBL-R      REDEFINES TBL.
   03  T-R    PIC 9(02) OCCURS 32.
01 OUT        PIC Z9.
PROCEDURE DIVISION.
MAIN-001.
  ACCEPT K.
  MOVE T-R(K) TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
*>
  STOP RUN.
