read a b h m
d0=$((h*60+m))
d1=$((m*12))
d=$((d1>d0?d1-d0:d0-d1))
if((d>360))
then
    d=$((720-d))
fi
pi=`echo "scale=12;a(1)*4" | bc -l`
v="scale=12;sqrt(${a}*${a}+${b}*${b}-2*${a}*${b}*c(${d}/2/180*${pi}))"
echo $v | bc -l
