IDENTIFICATION DIVISION.
PROGRAM-ID. 138B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP    PIC X(500).
01 N      PIC 9(3).
01 TBL.
   03 A   PIC 9(4) OCCURS 100. 
01 I      PIC 9(2).
01 P1     PIC 9(3).
01 P2     PIC 9(3).
01 WA     PIC 9(4)V9(10).
01 OUT    PIC Z(4).9(10).
01 OUT-R  REDEFINES OUT.
   03 ANS PIC Z(4).9(5).
   03 F1  PIC X(5).
*>  
PROCEDURE DIVISION.
  ACCEPT N.
*>
  ACCEPT INP.
  MOVE 1 TO P1.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
    PERFORM VARYING P2 FROM P1 BY 1 UNTIL INP(P2:1) = ' '
    END-PERFORM
    MOVE INP(P1:P2 - P1) TO A(I)
    COMPUTE P1 = P2 + 1
  END-PERFORM.
*>
  MOVE 0 TO WA.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
    COMPUTE WA = WA + 1 / A(I)
  END-PERFORM.
*>
  COMPUTE OUT = 1 / WA.
  PERFORM VARYING I FROM 10 BY -1 UNTIL OUT(I:1) <> '0'
    MOVE ' ' TO OUT(I:1)
  END-PERFORM.
  IF (I = 5) 
    MOVE ' ' TO OUT(I:1)
  END-IF.
*>
  DISPLAY FUNCTION TRIM(ANS).
*>
  STOP RUN.
