/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.text.DecimalFormat;


/* Name of the class has to be "Main" only if the class is public. */
public class Main
 
 
{
    static Scanner in = new Scanner(System.in);
   
    public static void solve()
    {
        DecimalFormat df = new DecimalFormat("#.####################");
        double a=in.nextDouble(),b=in.nextDouble();
        double h=in.nextDouble(),m=in.nextDouble();
        
        
        double angle=Math.abs(30*h - 11*m/2.0);
        
       double ans=Math.toRadians(angle);
      // System.out.println(ans);
        
        double c= Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans));
        
        System.out.println(df.format(c));
        
    }
    

    
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int t=1;
		//in.nextLine();
		
		while(t>0)
		{
		    
		    solve();
		    t--;
		}
		
		
	
	//	System.out.println(x);
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java import java.text.DecimalFormat; DecimalFormat java.text public class Main
 
 
{
    static Scanner in = new Scanner(System.in);
   
    public static void solve()
    {
        DecimalFormat df = new DecimalFormat("#.####################");
        double a=in.nextDouble(),b=in.nextDouble();
        double h=in.nextDouble(),m=in.nextDouble();
        
        
        double angle=Math.abs(30*h - 11*m/2.0);
        
       double ans=Math.toRadians(angle);
      // System.out.println(ans);
        
        double c= Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans));
        
        System.out.println(df.format(c));
        
    }
    

    
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int t=1;
		//in.nextLine();
		
		while(t>0)
		{
		    
		    solve();
		    t--;
		}
		
		
	
	//	System.out.println(x);
	}
} Main static Scanner in = new Scanner(System.in); in new Scanner(System.in) public static void solve()
    {
        DecimalFormat df = new DecimalFormat("#.####################");
        double a=in.nextDouble(),b=in.nextDouble();
        double h=in.nextDouble(),m=in.nextDouble();
        
        
        double angle=Math.abs(30*h - 11*m/2.0);
        
       double ans=Math.toRadians(angle);
      // System.out.println(ans);
        
        double c= Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans));
        
        System.out.println(df.format(c));
        
    } solve {
        DecimalFormat df = new DecimalFormat("#.####################");
        double a=in.nextDouble(),b=in.nextDouble();
        double h=in.nextDouble(),m=in.nextDouble();
        
        
        double angle=Math.abs(30*h - 11*m/2.0);
        
       double ans=Math.toRadians(angle);
      // System.out.println(ans);
        
        double c= Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans));
        
        System.out.println(df.format(c));
        
    } DecimalFormat df = new DecimalFormat("#.####################"); df new DecimalFormat("#.####################") double a=in.nextDouble() a in.nextDouble() in.nextDouble in b=in.nextDouble(); b in.nextDouble() in.nextDouble in double h=in.nextDouble() h in.nextDouble() in.nextDouble in m=in.nextDouble(); m in.nextDouble() in.nextDouble in double angle=Math.abs(30*h - 11*m/2.0); angle Math.abs(30*h - 11*m/2.0) Math.abs Math 30*h - 11*m/2.0 30*h 30 h 11*m/2.0 11*m 11 m 2.0 double ans=Math.toRadians(angle); ans Math.toRadians(angle) Math.toRadians Math angle double c= Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans)); c Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans)) Math.sqrt Math a*a + b*b - 2.0*a*b*Math.cos(ans) a*a + b*b a*a a a b*b b b 2.0*a*b*Math.cos(ans) b 2.0*a*b*Math.cos(ans) 2.0 a b Math.cos(ans) Math.cos Math ans System.out.println(df.format(c)) System.out.println System.out System System.out df.format(c) df.format df c public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int t=1;
		//in.nextLine();
		
		while(t>0)
		{
		    
		    solve();
		    t--;
		}
		
		
	
	//	System.out.println(x);
	} main {
		// your code goes here
		
		int t=1;
		//in.nextLine();
		
		while(t>0)
		{
		    
		    solve();
		    t--;
		}
		
		
	
	//	System.out.println(x);
	} int t=1; t 1 while(t>0)
		{
		    
		    solve();
		    t--;
		} t>0 t 0 {
		    
		    solve();
		    t--;
		} solve() solve t-- t String[] args args public class Main
 
 
{
    static Scanner in = new Scanner(System.in);
   
    public static void solve()
    {
        DecimalFormat df = new DecimalFormat("#.####################");
        double a=in.nextDouble(),b=in.nextDouble();
        double h=in.nextDouble(),m=in.nextDouble();
        
        
        double angle=Math.abs(30*h - 11*m/2.0);
        
       double ans=Math.toRadians(angle);
      // System.out.println(ans);
        
        double c= Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans));
        
        System.out.println(df.format(c));
        
    }
    

    
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int t=1;
		//in.nextLine();
		
		while(t>0)
		{
		    
		    solve();
		    t--;
		}
		
		
	
	//	System.out.println(x);
	}
} public class Main
 
 
{
    static Scanner in = new Scanner(System.in);
   
    public static void solve()
    {
        DecimalFormat df = new DecimalFormat("#.####################");
        double a=in.nextDouble(),b=in.nextDouble();
        double h=in.nextDouble(),m=in.nextDouble();
        
        
        double angle=Math.abs(30*h - 11*m/2.0);
        
       double ans=Math.toRadians(angle);
      // System.out.println(ans);
        
        double c= Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans));
        
        System.out.println(df.format(c));
        
    }
    

    
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int t=1;
		//in.nextLine();
		
		while(t>0)
		{
		    
		    solve();
		    t--;
		}
		
		
	
	//	System.out.println(x);
	}
} Main
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.text.DecimalFormat;


/* Name of the class has to be "Main" only if the class is public. */
public class Main
 
 
{
    static Scanner in = new Scanner(System.in);
   
    public static void solve()
    {
        DecimalFormat df = new DecimalFormat("#.####################");
        double a=in.nextDouble(),b=in.nextDouble();
        double h=in.nextDouble(),m=in.nextDouble();
        
        
        double angle=Math.abs(30*h - 11*m/2.0);
        
       double ans=Math.toRadians(angle);
      // System.out.println(ans);
        
        double c= Math.sqrt(a*a + b*b - 2.0*a*b*Math.cos(ans));
        
        System.out.println(df.format(c));
        
    }
    

    
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int t=1;
		//in.nextLine();
		
		while(t>0)
		{
		    
		    solve();
		    t--;
		}
		
		
	
	//	System.out.println(x);
	}
}
