        PROGRAM Zadatak
        integer D(30), M(30), k, l, suma
        open (5, file = 'ulaz.txt')
        open (6, file = 'izlaz.txt')
        read (5,*) k
        read (5,*) (D(i), i=1,k)
        j = 1
        DO 10 i = 1,k
        IF ÿ(D(i)/3*3 .EQ. D(i)) THEN
		M(j) = D(i)
		j = j + 1
        ENDIF
        l = j
10      CONTINUE
        write (6, 101)
        write (6, 100) (M(j),j=1,l)
        suma = 0
        DO 11 j = 1,l
        suma = suma + M(j)
11      CONTINUE
        write (6,102) suma
100     format (20 (I4,1X))
101     format ( / , 'Polje M:' , / )
102     format ( / , 'Suma', f12.2)
        close(5)
        close(6)
        end
