   program abc168c
      implicit none
      double precision::a,b,h,m
      double precision::si,t_time,xa,xb,ya,yb
      double precision,parameter::pi=acos(-1d0)

         read *, a,b,h,m

         t_time=60d0*h+m
         xa=a*cos(pi*t_time/360d0)
         ya=a*sin(pi*t_time/360d0)
         xb=b*cos(pi*m/30d0)
         yb=b*sin(pi*m/30d0)

         print *, sqrt( (xa-xb)**2 + (ya-yb)**2 )

   end program abc168c