program sample
    implicit none
    
    real(16)::A, B, H, M, c, d
    real(16), parameter::pi = 3.1415926535897932384626433_16
    read(*,*) A, B, H, M

    d = (30.0_16*H - 5.5_16*M)
    c = sqrt(A*A + B*B - 2*A*B*cos(d/180.0_16*pi))

    write(*,*) c

    stop
end program sample