PROGRAM trigmin
  IMPLICIT NONE

  INTEGER, PARAMETER :: unitnumber = 32
  INTEGER :: n, i
  DOUBLE PRECISION :: theta, sine, cosine, minv, v, thc

  OPEN (unit = unitnumber, file="trig.dat", status = "old", action = "read")
  
  READ (unitnumber, *) n

  minv = 3d0 ! megalytero apo kathe sine+cosine

  DO i=1,n
     READ (unitnumber, *) theta, sine, cosine 
     ! den xreiazetai metablhth gia to tan

     v = sine + cosine
     IF (minv > v) THEN 
        minv = v
        thc = theta
     END IF

  ENDDO

  CLOSE(unitnumber)

  WRITE(*,*) "To elaxisto sine+cosine einai ", minv, " se gwnia ", thc

END PROGRAM trigmin
