#include<stdio.h>
#include<string.h>
int main()
{
	char s[101];
	int len=0,i,c=0,f1=0,f2=0;
	scanf("%s",s);
	len=strlen(s);
	for(i=1;i<=len;i++){
		if(i%2!=0){
			if(s[i]=='R'){
				f1=1;
			}
		}
		if(i%2==0){
			if(s[i]=='L'){
				f2=1;
			}
		}
	}
	//printf("%d %d\n",f1,f2);
	if(f1==1||f2==1){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}


#include<stdio.h>
#include<string.h>

int main(void){

int oddcheck=0,evencheck=0;

char s[101];

scanf("%s",&s);

if(strlen(s)==1){
  if(s[0]=='R'||s[0]=='U'||s[0]=='D'){
    printf("Yes");
  }else{
    printf("No");
  }
}

if(strlen(s)>=2){
for(int i=0;i<strlen(s);i=i+2){
if(s[i]=='R'){oddcheck=0;}
else if(s[i]=='U'){oddcheck=0;}
else if(s[i]=='D'){oddcheck=0;}
else{oddcheck=1;}
}

for(int i=1;i<strlen(s);i=i+2){
if(s[i]=='L'){evencheck=0;}
else if(s[i]=='U'){evencheck=0;}
else if(s[i]=='D'){evencheck=0;}
else{evencheck=1;}
}

if(oddcheck==0&&evencheck==0){printf("Yes");}
if(oddcheck==1||evencheck==1){printf("No");}
}

return 0;
}


#include<stdio.h>
#include<string.h>

int main(void){

int oddcheck=0,evencheck=0;

char s[101];

scanf("%s",&s);

if(strlen(s)==1){
  if(s[0]=='R'||s[0]=='U'||s[0]=='D'){
    printf("Yes");
  }else{
    printf("No");
  }
}

if(strlen(s)>=2){
for(int i=0;i<strlen(s);i=i+2){
if(s[i]=='R'){oddcheck=0;}
else if(s[i]=='U'){oddcheck=0;}
else if(s[i]=='D'){oddcheck=0;}
else{oddcheck=1;}
}

for(int i=1;i<strlen(s);i=i+2){
if(s[i]=='L'){evencheck=0;}
else if(s[i]=='U'){evencheck=0;}
else if(s[i]=='D'){evencheck=0;}
else{oddcheck=1;}
}

if(oddcheck==0&&evencheck==0){printf("Yes");}
if(oddcheck==1||evencheck==1){printf("No");}
}

return 0;
}


Main = input => {
  s = input.trim();

  for (var i = 0; i < s.length; i++) {
    if (i % 2 === 0 && s[i] === "L") {
      console.log("No");
      return;
    }

    if (i % 2 && s[i] === "R") {
      console.log("No");
      return;
    }
  }

  console.log("Yes");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main (S) {
  S = S.split("\n")[0].split("");
  var ans = "Yes";
  S.forEach((element, index) => {
    switch ((index+1)%2) {
      case 0:
        switch (element) {
          case "L":
          case "U":
          case "D":
            break;
          default:
            ans = "No";
            break;
                       }
        break;
      case 1:
        switch (element) {
          case "R":
          case "U":
          case "D":
            break;
          default:
            ans = "No"
            break;
         }
                       }
    });
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
  input = input.trim().slice('');
  var flag = 'Yes';
  for(var i = 0, len = input.length; i < len; i++) {
    if(i % 2 == 0) {
      if(input[i] == 'L') flag = 'No';
    } else {
      if(input[i] == 'R') flag = 'No';
    }
    if(flag == 'No') {
      break;
    }
  }
  console.log(flag);
}
Main(require('fs').readFileSync('/dev/stdin', 'utf-8'));


"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let s = next()
    for(let i = 0; i<s.length; i++){
        if(i+1 % 2 == 0){
            if(!"LUD".includes(s[i])){
                console.log("No")
                return
            }
        } else{
            if(!"RUD".includes(s[i])){
                console.log("No")
                return
            }
        }
    }
    console.log("Yes")
}
Main()


'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = arr[0];
  let isStep = true;

  for (let i = 0; i < a.length; i ++) {
    if (a % 2 === 0 && a[i] === 'R') {
      isStep = false;
    } else if (a % 2 !== 0 && a[i] === 'L'){
      isStep = false;
    }
  }

  console.log(isStep ? 'Yes' : 'No');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = arr[0];
  let isStep = true;

  for (let i = 0; i < a.length; i ++) {
    if (a % 2 === 0 && a[i] === 'L') {
      isStep = false;
    } else if (a % 2 !== 0 && a[i] === 'R'){
      isStep = false;
    }
  }

  console.log(isStep ? 'Yes' : 'No');
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


package main

import (
	"bufio"
	"fmt"
	"os"
)

var mod = 1000000007

func main() {
	r := bufio.NewReader(os.Stdin)
	var s string
	fmt.Fscan(r, &s)

	ans := "Yes"
	for i := 0; i < len(s); i++ {
		if (i+1)%2 != 0 && s[i] == 'L' {
			ans = "No"
			break
		}
		if (i+1)%2 == 0 && s[i] == 'R' {
			ans = "No"
			break
		}
	}
	fmt.Println(ans)
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modinv(n, mod int) int {
	return modpow(n, mod-2, mod)
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Combination ...
type Combination struct {
	facts, invs []int
	mod         int
}

// NewCombination ...
func NewCombination(n, mod int) Combination {
	return Combination{
		facts: make([]int, n+1),
		invs:  make([]int, n+1),
		mod:   mod,
	}
}

func (cmb *Combination) calc(n, k int) int {
	ret := cmb.facts[n] * cmb.invs[k]
	ret %= cmb.mod
	ret = ret * cmb.invs[n-k]
	ret %= cmb.mod
	return ret
}

func (cmb *Combination) init(n int) {
	cmb.facts[0] = 1
	// 階乗を算出
	for i := 1; i <= n; i++ {
		cmb.facts[i] = cmb.facts[i-1] * i % cmb.mod
	}
	// 逆元を算出
	cmb.invs[n] = modinv(cmb.facts[n], cmb.mod)
	for i := n - 1; i >= 0; i-- {
		cmb.invs[i] = cmb.invs[i+1] * (i + 1) % cmb.mod
	}
}

// Utility
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func reverseString(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

// Queue ...
type Queue []int

// pop ...
func (q *Queue) empty() bool {
	return len(*q) == 0
}

// push ...
func (q *Queue) push(i int) {
	*q = append(*q, i)
}

// pop ...
func (q *Queue) pop() (int, bool) {
	if q.empty() {
		return 0, false
	} else {
		res := (*q)[0]
		*q = (*q)[1:]
		return res, true
	}
}

// Stack ...
type Stack []int

// pop ...
func (s *Stack) empty() bool {
	return len(*s) == 0
}

// push ...
func (s *Stack) push(i int) {
	*s = append(*s, i)
}

// pop ...
func (s *Stack) pop() (int, bool) {
	if s.empty() {
		return 0, false
	} else {
		index := len(*s) - 1
		res := (*s)[index]
		*s = (*s)[:index]
		return res, true
	}
}

// priority_queue
type intHeap []int

func (h intHeap) Len() int           { return len(h) }
func (h intHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h intHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }
func (h *intHeap) Push(x interface{}) {
	*h = append(*h, x.(int))
}
func (h *intHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

// sortable points
type point struct {
	x int
	y int
}

type points []point

func (p points) Len() int {
	return len(p)
}

func (p points) Less(i, j int) bool {
	return p[i].x < p[j].x
}

func (p points) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	defaultBufferSize = 1024
	maxBufferSize     = 1e6
	Mod               = 1e9 + 7
)

var sc = bufio.NewScanner(os.Stdin)

// sc.Buffer(make([]byte, defaultBufferSize), maxBufferSize)

func readInt() int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt64() int64 {
	sc.Scan()
	i, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return int64(i)
}

func readfloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func gcd(x, y int) int {
	if y == 0 {
		return x
	}
	return gcd(y, x%y)
}

func ModComb(n, k int) int {
	if k == 0 {
		return 1
	}
	x, y := n, k
	for i := 1; i < k; i++ {
		x = x * (n - i) % Mod
		y = y * (k - i) % Mod
	}
	inv := ModInv(y)
	return x * inv % Mod
}

func ModFact(x int) int {
	fact := 1
	for i := 1; i <= x; i++ {
		fact = fact * i % Mod
	}
	return fact
}

func ModInv(x int) int {
	return ModPow(x, Mod-2)
}

func ModPow(a, n int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % Mod
		}
		a = a * a % Mod
		n /= 2
	}
	return res
}

func pow(a, n int) int {
	if n == 0 {
		return 1
	}

	ans := 0
	if n%2 == 0 {
		ans = pow(a*a, n/2)
	} else {
		ans = a * pow(a*a, (n-1)/2)
	}
	return ans
}

func intSliceReverse(slice []int) []int {
	for i, j := 0, len(slice)-1; i < j; i, j = i+1, j-1 {
		slice[i], slice[j] = slice[j], slice[i]
	}
	return slice
}

func stringReverse(str string) string {
	runes := []rune(str)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func primeFactorization(x int) map[int]int {
	result := make(map[int]int, 0)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			result[i]++
			x /= i
		}
	}
	if x != 1 {
		result[x]++
	}
	return result
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	for i := 2; i*i <= x; i++ {
		if i == x {
			continue
		}
		if x%i == 0 {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	s := readString()

	check := true
	for i, v := range s {
		if i%2 == 0 {
			if v == 'R' || v == 'U' || v == 'D' {
				continue
			}
		} else {
			if v == 'L' || v == 'U' || v == 'D' {
				continue
			}
		}
		check = false
	}
	if check {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	s := next()
	ok := true
	for i := range s {
		if i%2 == 0 && s[i] == 'L' {
			ok = false
			break
		} else if i%2 == 1 && s[i] == 'R' {
			ok = false
			break
		}
	}
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	S := getStdin()
	for i := 0; i < len(S); i++ {
		if i%2 == 0 && (S[i] == 'R') {
			fmt.Printf("No\n")
			return
		}
		if i%2 == 1 && (S[i] == 'L') {
			fmt.Printf("No\n")
			return
		}
	}
	fmt.Printf("Yes\n")
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinInt3() (int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2]
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinIntU64() uint64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return uint64(rtn)
}
func getStdinInt64_2() (int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1]
}
func getStdinInt64_3() (int64, int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1], list[2]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func getStdinIntArrU64() []uint64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]uint64, len(list))
	for idx, val := range list {
		r, _ := strconv.ParseInt(val, 10, 64)
		rtn[idx] = uint64(r)
	}
	return rtn
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}
func abs64(n int64) int64 {
	if n < 0 {
		return -n
	}
	return n
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	S := sc.next()
	SArr := strings.Split(S, "")
	var ng bool
	for i := 0; i < len(SArr); i++ {
		if (i+1)%2 == 0 {
			if SArr[i] == "R" {
				ng = true
				fmt.Println(i, SArr[i])
			}
		}
		if (i+1)%2 != 0 {
			if SArr[i] == "L" {
				ng = true
				fmt.Println(i, SArr[i])
			}
		}
	}
	if ng {
		no()
	} else {
		yes()
	}
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	ans := "YES"
	for i := 0; i < len(s); i++ {
		if (i+1)%2 == 0 {
			if s[i:i+1] == "R" {
				ans = "NO"
				break
			}
		} else {
			if s[i:i+1] == "L" {
				ans = "NO"
				break
			}
		}
	}
	fmt.Println(ans)
}


ary = gets.chomp.chars
x = ary.each_slice(2).map { |a, b| [a, b] }.transpose
puts x[0].include?("L") || x[1].include?("R") ? "No" : "Yes"


S = gets.chomp.split('')
flag = true
S.each_with_index do |s,i|
    if i%2==0 then
        # 奇数
        flag = false if s == 'L'
    else
        flag = false if s == 'R'
    end
    break unless flag
end
puts flag ? "Yes" : "No"


s = gets.chomp

s.split("").each.with_index do |ss, i|
  ng = if i % 2 == 0
    "L"
  else
    "R"
  end
  if ss == ng
    print "No\n"
    exit
  end
end
print "Yes\n"


gets.chomp.each_char.with_index do |s,i|
  if i%2==0
    unless [?R,?U,?D].include? s
      p [s,i]
      puts 'No'
      exit
    end
  else
    unless [?L,?U,?D].include? s
      p [s,i]
      puts 'No'
      exit
    end
  end
end
puts 'Yes'


gets.each_char.with_index do |s,i|
  if i%2==0
    unless [?R,?U,?D].include? s
      puts 'No'
      exit
    end
  else
    unless [?L,?U,?D].include? s
      puts 'No'
      exit
    end
  end
end
puts 'Yes'


s=gets
p (0...s.size).any?{s[_1]=="LR"[_1%2]} ? :No : :Yes


#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;

fn main() {
    input! {
        s:chars
    }

    let mut ans = true;
    for i in 0..s.len() {
        if i % 2 == 0 {
            if s[i] == 'L' {
                ans = false;
                break;
            }
        } else if i % 2 == 1 {
            if s[i] == 'R' {
                ans = false;
                break;
            }
        }

    }
    println!("{}", if ans { "Yes" } else { "No" });

}


#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars,
    }
    for i in 0..s.len() {
        if (i % 2 == 0 && s[i] == 'L') || (i % 2 == 1 && s[i] == 'R'){
            println!("No");
            return;
        }
    }
    println!("Yes");
}


use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let s = stdin.lock().lines().next().unwrap().unwrap();
    let ans = if s
        .chars()
        .enumerate()
        .all(|(i, c)| (i + 1) % 2 == 1 && c != 'L' || (i + 1) % 2 == 0 && c != 'R')
    {
        "Yes"
    } else {
        "No"
    };
    println!("{}", ans);
}


fn main() {
    use std::collections::HashSet;

    let s: String = read_line_as_value();
    let mut odd_chars = HashSet::new();
    odd_chars.insert('R');
    odd_chars.insert('U');
    odd_chars.insert('D');
    let mut even_chars = HashSet::new();
    even_chars.insert('L');
    even_chars.insert('U');
    even_chars.insert('D');

    let mut ans = true;
    for (i, c) in s.chars().enumerate() {
        if (i+1) % 2 == 0 && even_chars.contains(&c) {
            continue
        } else if (i+1) % 2 == 1 && odd_chars.contains(&c) {
            continue
        } else {
            ans = false;
            break
        }
    }
    match ans {
        true => println!("Yes"),
        false => println!("No"),
    }
}


use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let s = read_as_string().chars().collect::<Vec<char>>();

    for i in 0..s.len(){
        if (i%2 == 0 && s[i] == 'R') || (i%2 == 1 && s[i] == 'L'){
            println!("No");
        }
    }
    println!("Yes");

}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: chars
    }
    let ok: bool = true;

    for i in 0..s.len() {
        let t: char = s[i];
        if i % 2 == 0 {
            //　奇数
            if t == 'L' {
                ok = false;
            }
        } else {
            // 偶数
            if t == 'R' {
                ok = false;
            }
        }
    }

    if ok {
        println!("Yes");
    }else {
        println!("No");
    }
}


let s=readLine()!
var S=Array(s)
var count=1
var k=0
for x in S{
  if count%2==1{
    if x == "L"{
      k=1
    }
  }else{
    if x == "R"{
      k=1
    }
  }
  count+=1
}
if k==1{
  print("No")
}else{
  print("Yes")
}


import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

let str=readLine()!
var flag=0

var i=0
for j in str{
  if i%2==1&&(j == "R"){flag-=1
                      break}
  if i%2==0&&(j == "L"){flag-=1
                      break}
  i+=1
}
if flag == -1 {print("No")}else{print("Yes")}


//https://atcoder.jp/contests/abc141/submissions/7559296

var ans = "Yes"
for(i, c)in readLine()!.characters.enumerate() {
  if i % 2 == 0 && c == "L" || i % 2 > 0 && c == "R" {
    ans = "No"
  }
}
print(ans)


print(readLine()!.characters.enumerate().reduce("Yes"){$1.0%2==0&&$1.1=="L"||$1.0%2>0&&$1.1=="R" ?"No":$0})


var ans="Yes"
for(i,c)in readLine()!.characters.enumerate(){
  if i%2==0&&c=="L"||i%2>0&&c=="R"{
    ans="No"
  }
}
print("No")


var ans="No"
for(i,c)in readLine()!.characters.enumerate(){
  if i%2==0&&c=="L"||i%2>0&&c=="R"{
    ans="No"
  }
}
print("No")


import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const s: string[] = input[0].split('');
let ans: string = 'Yes';
const len: number = s.length;
for(let i = 0; i < len; i++){
    if (i % 2 === 0){
        if(s[i] === 'L'){
            ans = 'No';
        }
    }else{
        if(s[i] === 'R'){
            ans = 'No';
        }
    }
}
console.log(ans);


const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let s=t.s().split('');
  let ans='Yes'
  for(let i=0;i<s.length; i++){
    if(i%2==0&&s[i]=='L'){
      ans='No'
      break;
    }else if(i%2!=0&&s[i]=='R'){
      ans='No'
      break;
    }
  }
  t.o(ans)
}
main()


const main = lines => {
  const strArr = lines.split("");
  let result = "Yes";

  strArr.forEach((str, index) => {
    index += 1;
    if (index % 2 === 1) {
      if (str === "L") {
        result = "No";
      }
    } else {
      if (str === "R") {
        result = "No";
      }
    }
  });

  console.log(result);
};

main(require("fs").readFileSync("/dev/stdin", "utf8"));


import { readFileSync } from 'fs'
function main() {
  const input = readFileSync('/dev/stdin', 'utf8')
  const s = input.trim().split('')
  const oddArray = ['R', 'U', 'D']
  const evenArray = ['L', 'U', 'D']
  let judge = 'Yes'
  for (let i = 0; i < s.length; i++) {
    if ((i + 1) % 2 === 0 && !evenArray.includes(s[i])) {
      judge = 'No'
      break
    } else if ((i + 2) % 2 === 0 && !oddArray.includes(s[i])) {
      judge = 'No'
      break
    }
  }
  console.log(judge)
}
main()


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin >> s;

  string ans = "Yes";
  for (int i = 0; i < s.size(); i++) {
    char c = s.at(i);

    if ((i + 1) % 2 == 0) {
      if (c == 'R') ans = "No";
    } else {
      if (c == 'L') ans = "No";
    }
  }

  cout << ans << endl;

  return 0;
}


import math

A,B,H,M=map(int, input().split())

sh=math.pi*(H+M/60)/6
sm=math.pi*M/30

s=abs(sh-sm)

C=math.sqrt(A**2+B**2-2*A*B*math.cos(s))

print(C)


import math
A, B, H, M = map(int, input().split())
h = H / 12 * 360 + 0.5 * M
m = M / 60 * 360
Ax = A * math.sin(math.radians(h))
Ay = A * math.cos(math.radians(h))
Bx = B * math.sin(math.radians(m))
By = B * math.cos(math.radians(m))
print(((Ax - Bx) ** 2 + (Ay - By) ** 2) ** 0.5)


import math
a,b,h,m = map(int,input().split())
ans = 0
ang = 0
tan = 30*h+0.5*m
cho = 6*m
ang = abs(cho-tan)
#print(tan,cho,ang)

ans = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(ang)))
print(ans)


import math
A,B,H,M = map(int, input().split())
H = 60*H + M
pi = (math.pi/180)
HP = [A*math.cos(0.5*H*pi), A*math.sin(0.5*H*pi)]
MP = [B*math.cos(6*M*pi), B*math.sin(6*M*pi)]
print(HP, MP)
print(math.sqrt((HP[0]-MP[0])**2 + (HP[1]-MP[1])**2))


import math
A,B,H,M = map(int, input().split())
pi = (math.pi/180)
HP = [A*math.cos(30*H*pi), A*math.sin(30*H*pi)]
MP = [B*math.cos(6*M*pi), B*math.sin(6*M*pi)]
print(math.sqrt((HP[0]-MP[0])**2 + (HP[1]-MP[1])**2))


import math
A,B,H,M = map(int, input().split())
pi = (math.pi/180)
HP = [A*math.cos(30*H*pi), A*math.sin(30*H*pi)]
MP = [B*math.cos(6*M*pi), B*math.sin(6*M*pi)]

print(math.sqrt((HP[0]-MP[0])**2 + (HP[1]-MP[1])**2))


import java.io.*;
import java.util.*;

public class Main {
	static void solve() {
		double a = ni(), b = ni(), h = ni(), m = ni();
		double t1 = (h + m / 60)* (pi / 6.0);
		double t2 = m * (pi / 30.0);
		double t = t1 - t2;
		t = min(t, 2*pi - t);
		double k = Math.cos(t);
		double ans = a * a + b * b - 2 * a * b * k;
		ans = Math.sqrt(ans);
		out.println(ans);
	}

	//constant
	static final long mod = (long) 1e9 + 7;
	static final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 };
	static final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
	static final int inf = Integer.MAX_VALUE / 2;
	static final long linf = Long.MAX_VALUE / 3;
	static final double dinf = Double.MAX_VALUE / 3;
	static final double eps = 1e-10;
	static final double pi = Math.PI;
	static StringBuilder sb = new StringBuilder();
	static InputStream is;
	static PrintWriter out;
	static String INPUT = "";

	//libraries
	static void reverse(int ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			int t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static void reverse(long ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			long t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static void reverse(double ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			double t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static void reverse(char ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			char t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static String getReverse(String s) {
		char c[] = s.toCharArray();
		reverse(c);
		s = String.valueOf(c);
		return s;
	}

	static <T> void reverse(List<T> ls) {
		int sz = ls.size();
		for (int i = 0; i < sz / 2; i++) {
			T t = ls.get(i);
			ls.set(i, ls.get(sz - 1 - i));
			ls.set(sz - 1 - i, t);
		}
	}

	static <T> void reverse(T[] ar) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			T t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}

	static void sbnl() {//StringBuilderに改行文字をappendする
		sb.append("\n");
	}

	static int lowerBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int upperBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rlowerBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rupperBound(int[] a, int x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int lowerBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int upperBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rlowerBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rupperBound(long[] a, long x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int lowerBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int upperBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rlowerBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rupperBound(double[] a, double x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int lowerBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] < x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int upperBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] <= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rlowerBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] > x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static int rupperBound(char[] a, char x) {
		int l = -1, r = a.length;
		while (r - l > 1) {
			int c = (l + r) / 2;
			if (a[c] >= x) {
				l = c;
			} else {
				r = c;
			}
		}
		return r;
	}

	static <T> int lowerBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) >= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) >= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) >= 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}

	static <T> int upperBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) > 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) > 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) > 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}

	static <T> int rupperBound(List<T> ls, T x) throws RuntimeException {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) < 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) < 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) < 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}

	static <T> int rlowerBound(List<T> ls, T x) {
		if (ls.size() == 0)
			return -1;
		if (ls.get(0) instanceof Integer) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Integer) t1).compareTo((Integer) t2) <= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Long) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Long) t1).compareTo((Long) t2) <= 0 ? 1 : -1);
		} else if (ls.get(0) instanceof Double) {
			return ~Collections.binarySearch(ls, x, (t1, t2) -> ((Double) t1).compareTo((Double) t2) <= 0 ? 1 : -1);
		} else {
			System.err.println(
					String.format("%s:数値でないリストを二分探索しています。", Thread.currentThread().getStackTrace()[1].getMethodName()));
			throw new RuntimeException();
		}
	}

	static int[] concat(int x, int arr[]) {
		int ret[] = new int[arr.length + 1];
		System.arraycopy(arr, 0, ret, 1, ret.length - 1);
		ret[0] = x;
		return ret;
	}

	static int[] concat(int arr[], int x) {
		int ret[] = new int[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}

	static long[] concat(long x, long arr[]) {
		long ret[] = new long[arr.length + 1];
		System.arraycopy(arr, 0, ret, 1, ret.length - 1);
		ret[0] = x;
		return ret;
	}

	static long[] concat(long arr[], long x) {
		long ret[] = new long[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}

	static int max(int x, int y) {
		return Math.max(x, y);
	}

	static int min(int x, int y) {
		return Math.min(x, y);
	}

	static int max(int x, int y, int z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}

	static int min(int x, int y, int z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}

	static long max(long x, long y) {
		return Math.max(x, y);
	}

	static long min(long x, long y) {
		return Math.min(x, y);
	}

	static long max(long x, long y, long z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}

	static long min(long x, long y, long z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}

	static double max(double x, double y) {
		return Math.max(x, y);
	}

	static double min(double x, double y) {
		return Math.min(x, y);
	}

	static double max(double x, double y, double z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}

	static double min(double x, double y, double z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}

	static void sort(int[] ar) {
		Arrays.sort(ar);
	}

	static void sort(long[] ar) {
		Arrays.sort(ar);
	}

	static void sort(double[] ar) {
		Arrays.sort(ar);
	}

	static void sort(char[] ar) {
		Arrays.sort(ar);
	}

	static void rsort(int[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			int tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}

	static void rsort(long[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			long tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}

	static void rsort(double[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			double tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}

	static void rsort(char[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			char tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}

	static void fill(int arr[], int x) {
		Arrays.fill(arr, x);
	}

	static void fill(long arr[], long x) {
		Arrays.fill(arr, x);
	}

	static void fill(boolean arr[], boolean x) {
		Arrays.fill(arr, x);
	}

	static void fill(double arr[], double x) {
		Arrays.fill(arr, x);
	}

	static void fill(int arr[][], int x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}

	static void fill(long arr[][], long x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}

	static void fill(double arr[][], double x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}

	static void fill(boolean arr[][], boolean x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}

	//MOD culc
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}

	public static void main(String[] args) throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	//input
	private static byte[] inbuf = new byte[1024];
	static int lenbuf = 0, ptrbuf = 0;

	private static int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private static boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private static int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	@SuppressWarnings("unused")
	private static double nd() {
		return Double.parseDouble(ns());
	}

	@SuppressWarnings("unused")
	private static char nc() {
		return (char) skip();
	}

	private static String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private static char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	@SuppressWarnings("unused")
	private static char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	@SuppressWarnings("unused")
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	@SuppressWarnings("unused")
	private static long[] nla(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}

	private static int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	@SuppressWarnings("unused")
	private static long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);

		// 入力
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		double h = sc.nextDouble();
		double m = sc.nextDouble();

		// 計算
		double result = 0;
		double theta = (PI/180) * (h*360/12 + m*30/60 - m*360/60);
		//double theta = PI * (h/6 - m/30);
		result = a*a + b*b - 2*a*b*cos(theta);
		result = sqrt(result);

		// 出力
		System.out.println(result);
	}

	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		double A = nd();
		double B = nd();
		double H = nd();
		double M = nd();
		double ang = 30D * H + 0.5D * M - 6D * M;
		double asin = A * Math.sin(Math.toRadians(ang));
		double acos = A * Math.cos(Math.toRadians(ang));

		double height = asin;
		double width = B - acos;

		System.out.println(Math.sqrt(height * height + width * width));

	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}


import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double short_line = sc.nextInt();
    double long_line = sc.nextInt();
    int hour = sc.nextInt();
    int min = sc.nextInt();
    double short_rad = 360 * hour / 12 + 30 * min / 60;
    double long_rad = 6 * min;
    double rad = 0;
    if(short_rad < long_rad){
      rad = long_rad - short_rad;
    }
    else{
      rad = short_rad - long_rad;
    }
    double cos = Math.cos(Math.toRadians(rad));
    double len = (short_line * short_line) + (long_line * long_line) - (2 * short_line * long_line * cos);
    System.out.println(Math.sqrt(len));
  }
}


import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double short_line = sc.nextInt();
    double long_line = sc.nextInt();
    int hour = sc.nextInt();
    int min = sc.nextInt();
    int short_rad = 360 * hour / 12 + 30 * min / 60;
    int long_rad = 6 * min;
    int rad = 0;
    if(short_rad < long_rad){
      rad = long_rad - short_rad;
    }
    else{
      rad = short_rad - long_rad;
    }
    double cos = Math.cos(Math.toRadians(rad));
    double len = (short_line * short_line) + (long_line * long_line) - (2 * short_line * long_line * cos);
    System.out.println(Math.sqrt(len));
  }
}


import java.util.*;
import java.math.BigInteger;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double pai = Math.PI;
    double a = sc.nextDouble();
    double b = sc.nextDouble();
    double h = sc.nextDouble();
    double m = sc.nextDouble();
    double cosC = Math.cos(Math.abs(30*h - 6*m) / 180 * pai);
    double ansPow = b*b + a*a - 2*a*b*cosC;
    System.out.println(Math.pow(ansPow, 0.5));
  }
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(){
    int a,b,h,m;
    double c;
    scanf("%d %d %d %d",&a,&b,&h,&m);

    double hourangle = 2*M_PI/12*h+2*M_PI/720*m;
    double minangle = 2*M_PI/60*m;
    double angle = abs(hourangle - minangle);

    //余剰定理　c^2 = a^2+b^2-2abcosC
    c=a*a+b*b-2*a*b*cos(angle);
    c=sqrt(c);

    printf("%.10lf",c);

    return 0;
}


#include <stdio.h>
#include <math.h>
#define PI 3.1415926535

int a,b,h,m;

int main()
{
    scanf("%d%d%d%d",&a,&b,&h,&m);
    int minuts=h*60+m;
    double hangle=2*PI*minuts/(12*60.0);
    double mangle=2*PI*m/60.0;

    printf("%.15lf\n",sqrt(pow(b-a*cos(hangle-mangle),2)+pow(a*sin(hangle-mangle),2)));
}


#include<stdio.h>
#include<math.h>
int main()
{double jiao,jiao1,jiao2,Pi,L;
int A,B,H,M;
	Pi=acos(-1);
	scanf("%d%d%d%d",&A,&B,&H,&M);
	jiao1=(H+M/60.0)/12.0*2*Pi;
	jiao2=M/60.0*2*Pi;
	jiao=fabs(jiao1-jiao2);
	L=sqrt(A*A+B*B-2*A*B*cos(jiao));
	printf("%.20f",L);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;

int main() {
    int A,B,H,M; cin >> A >> B >> H >> M;
    static const double pi = 3.141592653589793;
    double degree = 30*H + M*0.5 - 6*M;
    double ans = pow(A, 2) + pow(B, 2) - 2*A*B*cos(degree*pi/180);
    cout << sqrt(ans) << endl;
}


#include<stdio.h>
#include<math.h>

int powerOf(int b,int e)
{
    int power=1;
    while(e>0)
    {
        power=power*b;
        e--;
    }
    return power;
}
int main()
{

    int A,B,H,M;
    double Angle,L,radian;
    scanf("%d%d%d%d",&A,&B,&H,&M);
    Angle=(double)0.5*((60*H)-(11*M));
    if (Angle<0)
    {
        Angle=-Angle;
    }
    if (Angle>180)
    {
        Angle=360-Angle;
    }
    radian = Angle*(M_PI/180.0 );
    L=sqrt(powerOf(A,2)+powerOf(B,2)-(2*A*B*cosf(radian)));
    printf("%lf",L);
    return 0;
}


#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <cmath>
namespace mp = boost::multiprecision;

using cpp_dec_float = mp::number<mp::cpp_dec_float<20>>;

using namespace std;

int main() {
  static const double pi = 3.141592653589793;
  int A,B,H,M;
  cin>>A>>B>>H>>M;
  cpp_dec_float ans=sqrt(A*A+B*B-2*A*B*(cpp_dec_float)cos((cpp_dec_float)((((60*H+M)*11)%720)/360.00000)*pi));
  if (H==6&&M==0)
    cout << A+B << endl;
  else
    cout << ans << endl;

}


#include <stdio.h>
#include <math.h>

int main()
{
  double A, B, H, M, min, time, dif;
  double ans2, ans;
  scanf("%lf", &A);
  scanf("%lf", &B);
  scanf("%lf", &H);
  scanf("%lf", &M);

  min = 360.0 * M / 60.0;
  time = 360.0 * (H / 12.0 + M / (60.0 * 12.0));

  dif = fabs(min - time);

  if(dif > 180.0){
    dif = 360.0 - dif;
  }

  ans2 = A*A + B*B - 2.0*A*B*cos(dif/180.0*M_PI);
  ans = sqrt(ans2);

  printf("%.10f\n", ans);

  return 0;
  }


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

int main()
{
    const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286l;
    int a, b, h, m;

    scanf("%d %d %d %d", &a, &b, &h, &m);
    double deg = fabs(30.0l * h - 5.5l * m);

    double power = a * a + b * b - 2.0l * a * b * cos(pi * deg / 180.0l);
    // printf("deg: %.17lf\n", deg);
    printf("%.17lf", sqrt(power));

    return 0;
}


#include <stdio.h>
#include <math.h>

int main(void) {
  int a, b, h, m;
  float deg;

  scanf("%d %d %d %d", &a, &b, &h, &m);
  deg = 6 * m - (30 * h + 0.5 * m);
  if (deg < 0) {
    deg = -deg;
  }
  while (deg >= 360) {
    deg = deg - 360;
  }

  printf ("%.10f\n", sqrt(a*a + b*b - 2*a*b*cos(deg * 2 * M_PI / 360)));
  return 0;
}


#include <stdio.h>
#include <math.h>

int main(void)
{
    int A, B, H, M;

    scanf("%d %d %d %d", &A, &B, &H, &M);

    double H_x, H_y;
    double M_x, M_y;
    double length;

    H_x = A * cos((H*360/12.0) * (2*M_PI/360.0)) + A * cos((1*(M/60.0)*360/12.0) * (2*M_PI/360.0));
    H_y = A * sin((H*360/12.0) * (2*M_PI/360.0)) + A * sin((1*(M/60.0)*360/12.0) * (2*M_PI/360.0));

    M_x = B * cos((M*360/60.0) * (2*M_PI/360.0));
    M_y = B * sin((M*360/60.0) * (2*M_PI/360.0));

    length = sqrt((M_x - H_x)*(M_x - H_x) + (M_y - H_y)*(M_y - H_y));

    printf("%.10f\n", length);

    return 0;
}


#include <stdio.h>
#include <math.h>
int main(void)
{
    int A, B, H, M;

    scanf("%d %d %d %d", &A, &B, &H, &M);

    double H_x, H_y;
    double M_x, M_y;
    double length;

    H_x = A * cos((H*360/12.0) * (2*M_PI/360));
    H_y = A * sin((H*360/12.0) * (2*M_PI/360));

    M_x = B * cos((M*360/60.0) * (2*M_PI/360));
    M_y = B * sin((M*360/60.0) * (2*M_PI/360));

    length = sqrt((M_x - H_x)*(M_x - H_x) + (M_y - H_y)*(M_y - H_y));

    printf("%.9f\n", length);

    return 0;
}


#include <stdio.h>
#include <math.h>

#define diff(a, b) ((a > b) ? (a - b) : (b - a))

double	minute_hand_degree(int m)
{
	return ((double)m * 6);
}

double	hour_hand_degree(int h, int m)
{
	return ((double)h * 30 + (double)m / 2);
}

double	triangle_len(double a, double b, double degree)
{
	return (sqrt(a * a + b * b - 2 * a * b * cos(degree * M_PI / 180)));
}

int		main(void)
{
	int			A, B, H, M;
	double	deg, len;

	scanf("%d %d %d %d", &A, &B, &H, &M);
	deg = diff(hour_hand_degree((double)H, (double)M), minute_hand_degree((double)M));
	len = triangle_len((double)A, (double)B, deg);
	printf("%20.20Lf\n", len);
	return (0);
}


function main(lines) {
  const [A, B, H, M] = splitN(lines[0]);

  const
    hR =( H / 12 + M / 60 / 12) * 2 * Math.PI,
    mR = M / 60 * 2 * Math.PI,
    r = Math.max(hR, mR) - Math.min(hR, mR),
    res = Math.sqrt( (A ** 2) + (B ** 2) - (2*A*B*Math.cos(r)) );

  console.log(res);
}

main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );

function splitN(s) {
  return s.split(' ').map(Number);
}


'use strict';
const p = s => console.log(s);
// let a,b,c,d;
// [a,b,c,d] = input[0].trim().split(" ").map(i => parseInt(i));

function main(input) {

  let a,b,h,m;
  [a,b,h,m] = input[0].trim().split(" ").map(i => parseInt(i));

  let ans = Math.sqrt(a*a + b*b - 2*a*b*Math.cos(2*Math.PI*(h/12 + (m/60)/12 - (m/60))));

  p(ans);

}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));


function main(input){
    var A = parseInt(input.split(" ")[0], 10);
    var B = parseInt(input.split(" ")[1], 10);
    var H = parseInt(input.split(" ")[2], 10);
    var M = parseInt(input.split(" ")[3], 10);

	// 時針のrad
	rad_H = ((360/12) * H + ((360/12)/60)*M) * (Math.PI/180);
	// 分針のrad
	rad_M = (360/60)*M*(Math.PI/180);

	// 針間の距離
	console.log(Math.sqrt( (A*A)+(B*B)-2*A*B*Math.cos(rad_H-rad_M)) );
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function Main(input) {
    input = input.split(" ");
    const a = parseInt(input[0],10);
    const b = parseInt(input[1],10);
    const h = parseInt(input[2],10);
    const m = parseInt(input[3],10);

    const rad = Math.abs( 360 * (h / 12) - 360 * (m / 60) ) * ( Math.PI / 180 );

    console.log(Math.sqrt(  a*a + b*b - a*b* Math.cos(rad) ));
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function main(arg) {
  const array = arg.trim().split(" ");
  const A = parseInt(array[0]);
  const B = parseInt(array[1]);
  const H = parseInt(array[2]);
  const M = parseInt(array[3]);
  const PI = Math.PI;

  const th = ((H * 60 + M) / 720) * 2 * PI;
  const tm = (M / 60) * 2 * PI;

  console.log(th);
  console.log(tm);
  console.log(PI);

  let xh = A * Math.cos(th);
  let yh = A * Math.sin(th);
  let xm = B * Math.cos(tm);
  let ym = B * Math.sin(tm);
  let dx = xh - xm;
  let dy = yh - ym;

  let result = Math.sqrt(dx * dx + dy * dy);

  console.log(result);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
// main("3 4 10 40");


function main(input){
	input = input.trim();
	var list = input.split(" ");
	var jHari = parseInt(list[0]);
	var fHari = parseInt(list[1]);
	var ji = parseInt(list[2]);
	var fun = parseInt(list[3]);

	function deg(deg){
		return(deg*Math.PI/180);
	}
	var posJ = [Math.cos(deg(ji*30+fun*0.5))*jHari, Math.sin(deg(ji*30+fun*0.5))*jHari];
	var posF = [Math.cos(deg(fun*6))*fHari, Math.sin(deg(fun*6))*fHari];
	function kyori(ax,ay,bx,by){
		return(Math.sqrt((ax-bx)**2+(ay-by)**2));
	}
	console.log([posJ,posF]);
	var answer = kyori(posJ[0],posJ[1],posF[0],posF[1]);
	console.log(answer.toString());
}
main(require("fs").readFileSync("/dev/stdin","utf8"));


package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, h, m float64
	fmt.Scan(&a, &b, &h, &m)

	c := a*a + b*b - 2*a*b*math.Cos((math.Pi/6.0)*h-(math.Pi/30.0)*m+(math.Pi/360.0)*m)
	fmt.Println(math.Sqrt(c))
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, h, m float64
	fmt.Scan(&a, &b, &h, &m)

	hourDeg := (h*60 + m) / 2
	minDeg := m * 6

	deg := minDeg - hourDeg
	if deg < 0 {
		deg = -deg
	}
	if deg >= 180 {
		deg = 360 - deg
	}

	rad := (math.Pi / 180) * deg
	cc := (a * a) + (b * b) - 2*a*b*math.Cos(rad)
	fmt.Println(math.Sqrt(cc))
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var A, B, H, M int
	fmt.Scanf("%d %d %d %d", &A, &B, &H, &M)

	PI := 3.14159265358979323846
	var angA, angB float64
	angA = float64(2) * PI / 12 * (float64(H) + float64(M)/60)
	angB = 2 * PI / 60 * float64(M)

	ax := float64(A) * math.Sin(angA)
	ay := float64(A) * math.Cos(angA)
	bx := float64(B) * math.Sin(angB)
	by := float64(B) * math.Cos(angB)
	dist := math.Sqrt((ax-bx)*(ax-bx) + (ay-by)*(ay-by))
	fmt.Println(dist)
}


package main

import (
	"fmt"
	"math"
)

func main() {

	var A, B, H, M int
	fmt.Scanf("%d %d %d %d", &A, &B, &H, &M)

	var angle float64
	var result float64
	angle = math.Abs(30*float64(H)-6*float64(M)) * math.Pi / 180

	result = math.Sqrt(float64(A)*float64(A) +
		float64(B)*float64(B) -
		2*float64(A)*float64(B)*math.Cos(angle))

	fmt.Println(result)
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"reflect"
	"sort"
	"strconv"
	"strings"
	// "regexp"
)

/* sort */
type pair struct {
	index  int64
	p1, p2 interface{}
}
type pairs []pair

func (slice pairs) Len() int {
	return len(slice)
}

func (slice pairs) Less(i, j int) bool {
	return slice[i].index < slice[j].index
}

func (slice pairs) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}

/* sort */
type Int64Slice []int64

func (slice Int64Slice) Len() int {
	return len(slice)
}

func (slice Int64Slice) Less(i, j int) bool {
	return slice[i] < slice[j]
}

func (slice Int64Slice) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}
func Int64s(a []int64)                    { sort.Sort(Int64Slice(a)) }
func Int64sSliceAreSorted(a []int64) bool { return sort.IsSorted(Int64Slice(a)) }

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
	INF            = 1e8
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
	di      = []int64{-1, 0, 1, 0}
	dj      = []int64{0, -1, 0, 1}
	di8     = []int64{-1, -1, 0, 1, 1, 1, 0, -1}
	dj8     = []int64{0, -1, -1, -1, 0, 1, 1, 1}
)

func main() {
	buf := make([]byte, initialBufSize)
	scanner.Buffer(buf, maxBufSize)
	scanner.Split(bufio.ScanWords)
	A, B, H, M := readInt(), readInt(), readInt(), readInt()
	hrad := H*30 + int64(0.5*float64(M))
	mrad := M * 6
	var kakudo float64
	var rad float64
	if abs(int64(hrad-mrad)) > 180 {
		kakudo = float64(360 - abs(hrad-mrad))
	} else {
		kakudo = float64(abs(hrad - mrad))
	}
	rad = kakudo * math.Pi / 180
	s := fmt.Sprintf("%.12f", math.Sqrt(float64(A*A+B*B)-float64(2.0*A*B)*math.Cos(rad)))
	fmt.Println(s)
}

/*==========================================
 *             Library
 *==========================================*/
func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}
func doubleAry(h int64, w int64, init int64) (res [][]int64) {
	res = make([][]int64, h)
	for i := int64(0); i < h; i++ {
		res[i] = make([]int64, w)
		for j := int64(0); j < w; j++ {
			res[i][j] = init
		}
	}
	return
}

func aryEq(a []int64, b []int64) bool {
	return reflect.DeepEqual(a, b)
}

func clone(n []int64) (r []int64) {
	r = make([]int64, len(n))
	for i := 0; i < len(n); i++ {
		r[i] = n[i]
	}
	return
}
func write(s string) {
	writer.WriteString(s)
}

func print() {
	writer.Flush()
}

// scanner.Split(bufio.ScanWords) をコメントアウトしないと使用不可
func readLine() (s string) {
	if scanner.Scan() {
		s = scanner.Text()
	}
	return s
}

func readInt() (read int64) {
	scanner.Scan()
	read, err := strconv.ParseInt(scanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return
}

func readFloat() (read float64) {
	scanner.Scan()
	read, err := strconv.ParseFloat(scanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return
}

func readRunes() (read []rune) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, v)
	}
	return
}

func readString() (read string) {
	scanner.Scan()
	read = scanner.Text()
	return
}

func readStrings() (read []string) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, string(v))
	}
	return
}

func s2i(s string) int64 {
	var intVal, e = strconv.ParseInt(s, 10, 64)
	if e != nil {
		panic(e)
	}
	return intVal
}

func i2s(i int64) string {
	var strVal = strconv.FormatInt(i, 10)
	return strVal
}

func s2f(s string) float64 {
	var floatVal, e = strconv.ParseFloat(s, 64)
	if e != nil {
		panic(e)
	}
	return floatVal
}

func abs(i int64) int64 {
	return int64(math.Abs(float64(i)))
}

func max(a ...int64) int64 {
	ans := int64(0)
	for i, v := range a {
		if i == 0 {
			ans = v
		}
		if ans < v {
			ans = v
		}
	}
	return ans
}
func min(a ...int64) int64 {
	ans := int64(0)
	for i, v := range a {
		if i == 0 {
			ans = v
		}
		if ans > v {
			ans = v
		}
	}
	return ans
}

func sum(i []int64) int64 {
	sum := int64(0)
	for _, val := range i {
		sum += val
	}
	return sum
}

func split(s string) []string {
	return strings.Fields(s)
}

func strAry2intAry(strs []string) []int64 {
	var ret = make([]int64, 0, len(strs))
	for _, str := range strs {
		var intVal = s2i(str)
		ret = append(ret, intVal)
	}
	return ret
}

func intAry2strAry(nums []int64) []string {
	var ret = make([]string, 0, len(nums))
	for _, num := range nums {
		var strVal = i2s(num)
		ret = append(ret, strVal)
	}
	return ret
}

func ary2str(strs []string) string {
	return strings.Join(strs, " ")
}

func reverse(res []int64) []int64 {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}
func reverseStr(res []string) []string {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}

func ini(res []int, init int) {
	if len(res) == 0 {
		return
	}
	res[0] = init
	for i := 0; i < len(res); i++ {
		copy(res[i:], res[:i])
	}
}

//
// func regexpExample() {
//     // Your code here!
//     var str = "13:20"
//     r := regexp.MustCompile(`(\d+):(\d+)`)
//     fmt.Println(r.FindStringSubmatch(str))
// }

// type Country struct {
//     gold int
//     silver int
//     blonze int
// }

// // 複数ソートのサンプル
// func stableSortExample() []Country{
//     var country = []Country {
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:3, blonze:2},
//         {gold:1, silver:3, blonze:3},
//     }
//     sort.SliceStable(country, func(i, j int) bool { return country[i].blonze > country[j].blonze })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].silver > country[j].silver })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].gold > country[j].gold })
//     return country
// }


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"reflect"
	"sort"
	"strconv"
	"strings"
	// "regexp"
)

/* sort */
type pair struct {
	index  int64
	p1, p2 interface{}
}
type pairs []pair

func (slice pairs) Len() int {
	return len(slice)
}

func (slice pairs) Less(i, j int) bool {
	return slice[i].index < slice[j].index
}

func (slice pairs) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}

/* sort */
type Int64Slice []int64

func (slice Int64Slice) Len() int {
	return len(slice)
}

func (slice Int64Slice) Less(i, j int) bool {
	return slice[i] < slice[j]
}

func (slice Int64Slice) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}
func Int64s(a []int64)                    { sort.Sort(Int64Slice(a)) }
func Int64sSliceAreSorted(a []int64) bool { return sort.IsSorted(Int64Slice(a)) }

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
	INF            = 1e8
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriter(os.Stdout)
	di      = []int64{-1, 0, 1, 0}
	dj      = []int64{0, -1, 0, 1}
	di8     = []int64{-1, -1, 0, 1, 1, 1, 0, -1}
	dj8     = []int64{0, -1, -1, -1, 0, 1, 1, 1}
)

func main() {
	buf := make([]byte, initialBufSize)
	scanner.Buffer(buf, maxBufSize)
	scanner.Split(bufio.ScanWords)
	A, B, H, M := readFloat(), readFloat(), readFloat(), readFloat()
	hrad := int64(H*30 + 0.5*M)
	mrad := int64(M * 6)
	var kakudo float64
	var rad float64
	if abs(int64(hrad-mrad)) > 180 {
		kakudo = float64(360 - abs(hrad-mrad))
	} else {
		kakudo = float64(abs(hrad - mrad))
	}
	rad = kakudo * math.Pi / 180
	s := fmt.Sprintf("%.12f", math.Sqrt(A*A+B*B-2.0*A*B*math.Cos(rad)))
	fmt.Println(s)
}

/*==========================================
 *             Library
 *==========================================*/
func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}
func doubleAry(h int64, w int64, init int64) (res [][]int64) {
	res = make([][]int64, h)
	for i := int64(0); i < h; i++ {
		res[i] = make([]int64, w)
		for j := int64(0); j < w; j++ {
			res[i][j] = init
		}
	}
	return
}

func aryEq(a []int64, b []int64) bool {
	return reflect.DeepEqual(a, b)
}

func clone(n []int64) (r []int64) {
	r = make([]int64, len(n))
	for i := 0; i < len(n); i++ {
		r[i] = n[i]
	}
	return
}
func write(s string) {
	writer.WriteString(s)
}

func print() {
	writer.Flush()
}

// scanner.Split(bufio.ScanWords) をコメントアウトしないと使用不可
func readLine() (s string) {
	if scanner.Scan() {
		s = scanner.Text()
	}
	return s
}

func readInt() (read int64) {
	scanner.Scan()
	read, err := strconv.ParseInt(scanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return
}

func readFloat() (read float64) {
	scanner.Scan()
	read, err := strconv.ParseFloat(scanner.Text(), 64)
	if err != nil {
		panic(err)
	}
	return
}

func readRunes() (read []rune) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, v)
	}
	return
}

func readString() (read string) {
	scanner.Scan()
	read = scanner.Text()
	return
}

func readStrings() (read []string) {
	scanner.Scan()
	for _, v := range scanner.Text() {
		read = append(read, string(v))
	}
	return
}

func s2i(s string) int64 {
	var intVal, e = strconv.ParseInt(s, 10, 64)
	if e != nil {
		panic(e)
	}
	return intVal
}

func i2s(i int64) string {
	var strVal = strconv.FormatInt(i, 10)
	return strVal
}

func s2f(s string) float64 {
	var floatVal, e = strconv.ParseFloat(s, 64)
	if e != nil {
		panic(e)
	}
	return floatVal
}

func abs(i int64) int64 {
	return int64(math.Abs(float64(i)))
}

func max(a ...int64) int64 {
	ans := int64(0)
	for i, v := range a {
		if i == 0 {
			ans = v
		}
		if ans < v {
			ans = v
		}
	}
	return ans
}
func min(a ...int64) int64 {
	ans := int64(0)
	for i, v := range a {
		if i == 0 {
			ans = v
		}
		if ans > v {
			ans = v
		}
	}
	return ans
}

func sum(i []int64) int64 {
	sum := int64(0)
	for _, val := range i {
		sum += val
	}
	return sum
}

func split(s string) []string {
	return strings.Fields(s)
}

func strAry2intAry(strs []string) []int64 {
	var ret = make([]int64, 0, len(strs))
	for _, str := range strs {
		var intVal = s2i(str)
		ret = append(ret, intVal)
	}
	return ret
}

func intAry2strAry(nums []int64) []string {
	var ret = make([]string, 0, len(nums))
	for _, num := range nums {
		var strVal = i2s(num)
		ret = append(ret, strVal)
	}
	return ret
}

func ary2str(strs []string) string {
	return strings.Join(strs, " ")
}

func reverse(res []int64) []int64 {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}
func reverseStr(res []string) []string {
	for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
		res[i], res[j] = res[j], res[i]
	}
	return res
}

func ini(res []int, init int) {
	if len(res) == 0 {
		return
	}
	res[0] = init
	for i := 0; i < len(res); i++ {
		copy(res[i:], res[:i])
	}
}

//
// func regexpExample() {
//     // Your code here!
//     var str = "13:20"
//     r := regexp.MustCompile(`(\d+):(\d+)`)
//     fmt.Println(r.FindStringSubmatch(str))
// }

// type Country struct {
//     gold int
//     silver int
//     blonze int
// }

// // 複数ソートのサンプル
// func stableSortExample() []Country{
//     var country = []Country {
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:2, blonze:3},
//         {gold:1, silver:3, blonze:2},
//         {gold:1, silver:3, blonze:3},
//     }
//     sort.SliceStable(country, func(i, j int) bool { return country[i].blonze > country[j].blonze })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].silver > country[j].silver })
//     sort.SliceStable(country, func(i, j int) bool { return country[i].gold > country[j].gold })
//     return country
// }


include Math
a,b,h,m=gets.split.map &:to_f
p sqrt a*a+b*b-2*a*b*cos((h*60-m*11)*PI/360)


A, B, H, M = gets.chomp.split.map(&:to_i)

minutes = H * 60 + M

aAngle = 0.5 * minutes
bAngle = 6.0 * M
theta = [(aAngle - bAngle).abs, 360 - (aAngle - bAngle).abs].min

# p aAngle, bAngle, theta

ans = Math.sqrt(A ** 2 + B ** 2 - 2 * A * B * Math.cos(theta * Math::PI / 180))

puts ans.to_s


a, b, h, m = gets.chomp.split(' ').map(&:to_f)
time_angle = (h * 60 + m) * 0.5
minute_angle = m * 6.0
angle = [(time_angle - minute_angle).abs, 360 - (time_angle - minute_angle).abs].min
puts Math.sqrt((a ** 2) + (b ** 2) - (2 * a * b * Math.cos(angle * Math::PI / 180)))


a, b, h, m = gets.split.map(&:to_i)

theta = 1.0 * (60 * h - 11 * m).abs / 360
theta -= 1 if theta > 1
puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos(Math::PI * theta))


include Math

a, b, h, m = gets.split.map(&:to_i)

cos = cos(2*PI * ((h/12.0) + (m/60.0)/12.0) - (m/60.0))

puts sqrt(a**2 + b**2 - 2*a*b*cos)


include Math

a, b, h, m = gets.split.map(&:to_i)

cos = cos(2*PI * ((h/12.0) + (m/60.0)/12.0) - (m/60.0))
p cos
puts sqrt(a**2 + b**2 - 2*a*b*cos)


#[allow(unused_imports)]
use std::cmp;
use std::f64;

fn run1() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let a: f64 = sc.read();
    let b: f64 = sc.read();
    let h: f64 = sc.read();
    let m: f64 = sc.read();

    let rad_h = 360.0 * (h + m / 60.0) / 12.0 * f64::consts::PI / 180.0;
    let rad_m = 360.0 * m / 60.0 * f64::consts::PI / 180.0;

    let ax = a * rad_h.cos();
    let ay = a * rad_h.sin();
    let bx = b * rad_m.cos();
    let by = b * rad_m.sin();

    let dx = ax - bx;
    let dy = ay - by;
    let ans = (dx * dx + dy * dy).sqrt();
    println!("{}", ans);
}

fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let a: f64 = sc.read();
    let b: f64 = sc.read();
    let h: f64 = sc.read();
    let m: f64 = sc.read();

    let rad_h = 360.0 * (h + m / 60.0) / 12.0 * f64::consts::PI / 180.0;
    let rad_m = 360.0 * m / 60.0 * f64::consts::PI / 180.0;

    let ans = (a * a + b * b - 2.0 * a * b * (rad_h - rad_m).cos()).sqrt();
    println!("{}", ans);
}
fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}

#[allow(dead_code)]
fn yn(flag: bool) {
    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
}

use std::ops::{Add, Div};

/// Generic binary search
///
/// # Arguments
///
/// * `l` - the value assumes to `pred(l) = true`
/// * `r` - the value assumes to `pred(r) = false`
/// * `pred` - predicate for binary search
///
/// # Returns
///
/// * `ret` where `pred(ret) = true` && `pred(ret + delta) = false`
///
/// # Note
///
/// `pred(l)` and `pred(r)` are not called. `pred` is called only values in the range `(l, r)`.
///
pub fn binary_search<T: Add<Output = T> + Div<Output = T> + PartialEq + From<u8> + Copy>(
    l: T,
    r: T,
    pred: impl Fn(T) -> bool,
) -> T {
    let mut l = l;
    let mut r = r;
    let two = T::from(2_u8);
    loop {
        let m = (l + r) / two;
        if l == m || r == m {
            break l;
        }
        if pred(m) {
            l = m;
        } else {
            r = m;
        }
    }
}

#[test]
fn binary_search_test() {
    let v = [1, 2, 3, 4, 5];
    assert_eq!(3, binary_search(v.len() as _, -1, |i| v[i as usize] > 3));
    assert_eq!(5, binary_search(v.len() as _, -1, |i| v[i as usize] > 100));
    assert_eq!(0, binary_search(v.len() as _, -1, |i| v[i as usize] > 0));
}

/// Returns index to the first element in `v` which does not compare less than `val`.
pub fn lower_bound<T: PartialOrd>(v: &[T], val: &T) -> usize {
    (binary_search(-1, v.len() as i64, |i: i64| v[i as usize] < *val) + 1) as usize
}

#[test]
fn lower_bound_test() {
    let v = vec![1, 3, 3, 4, 5];
    assert_eq!(lower_bound(&v, &0), 0);
    assert_eq!(lower_bound(&v, &1), 0);
    assert_eq!(lower_bound(&v, &2), 1);
    assert_eq!(lower_bound(&v, &3), 1);
    assert_eq!(lower_bound(&v, &4), 3);
    assert_eq!(lower_bound(&v, &5), 4);
    assert_eq!(lower_bound(&v, &999), 5);
}

/// Returns index to the first element in `v` which compares greater than `val`.
pub fn upper_bound<T: PartialOrd>(v: &[T], val: &T) -> usize {
    (binary_search(-1, v.len() as i64, |i: i64| v[i as usize] <= *val) + 1) as usize
}

#[test]
fn upper_bound_test() {
    let v: &[i32] = &[1, 3, 3, 4, 5];
    assert_eq!(upper_bound(v, &0), 0);
    assert_eq!(upper_bound(v, &1), 1);
    assert_eq!(upper_bound(v, &2), 1);
    assert_eq!(upper_bound(v, &3), 3);
    assert_eq!(upper_bound(v, &4), 4);
    assert_eq!(upper_bound(v, &5), 5);
    assert_eq!(upper_bound(v, &999), 5);
}

/// Returns `(lower_bound(v, val), upper_bound(v, val))`
pub fn equal_range<T: PartialOrd>(v: &[T], val: &T) -> (usize, usize) {
    (lower_bound(v, val), upper_bound(v, val))
}

pub fn gcd(a: usize, b: usize) -> usize {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}


use proconio::input;

fn main() {
    input! {
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    }

    let rad = std::f64::consts::PI * 2.0
         * ((h / 12.0) + m / 60.0 / 12.0 - m / 60.0);

    let ans2 = a*a + b*b - 2.0 * a * b * rad.cos();

    println!("{:.20}", ans2.sqrt());
}


use proconio::input;

fn main() {
    input! {
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    };
    let th = (h * 60_f64 + m) / (60_f64 * 12_f64) * 2_f64 * std::f64::consts::PI;
    let tm = m / 60_f64 * 2_f64 * std::f64::consts::PI;
    let dx = th.cos() * a - tm.cos() * b;
    let dy = th.sin() * a - tm.sin() * b;
    let ans = (dx * dx + dy * dy).sqrt();
    println!("{}", ans);
}


use proconio::input;
use std::f64::consts::PI;

fn main() {
    input! {
        a: f64,
        b: f64,
        h: f64,
        m: f64,
    }

    solve(a, b, h, m);
}

fn solve(a: f64, b: f64, h: f64, m: f64) {
    let theta = (5.0 * h - m) / 30.0 * PI;
    let cc = a * a + b * b - 2.0 * a * b * theta.cos();
    println!("{}", cc.sqrt());
}


// -*- coding:utf-8-unix -*-

use proconio::input;

fn to_rad(f: f64) -> f64 {
    println!("f: {}", f);
    f * std::f64::consts::PI / 180.0
}

fn calcHAngle(h: f64, m: f64) -> f64 {
    let hm = h * 60.0 + m;
    let theta = 0.5 * hm;
    if theta > 90.0 {
        to_rad(450.0 - theta)
    } else {
        to_rad(90.0 - theta)
    }
}

fn calcMAngle(m: f64) -> f64 {
    let theta = 6.0 * m;
    if theta > 90.0 {
        to_rad(450.0 - theta)
    } else {
        to_rad(90.0 - theta)
    }
}

fn calcPoint(l: f64, rad: f64) -> (f64, f64) {
    let x = l * rad.cos();
    let y = l * rad.sin();
    (x, y)
}

fn calcDistance(a: (f64, f64), b: (f64, f64)) -> f64 {
    let x = (b.0 - a.0) * (b.0 - a.0);
    let y = (b.1 - a.1) * (b.1 - a.1);
    let r = x + y;
    r.sqrt()
}

fn main() {
    input! {
        abhm: (f64, f64, f64, f64),
    }
    let a = abhm.0;
    let b = abhm.1;
    let h = abhm.2;
    let m = abhm.3;

    let a_angle = calcHAngle(h, m);
    let b_angle = calcMAngle(m);

    let a_p = calcPoint(a, a_angle);
    let b_p = calcPoint(b, b_angle);

    println!("{}", calcDistance(a_p, b_p));
}


fn main() {
    let mut buf = String::new();

    std::io::stdin().read_line(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();

    let a: f64 = iter.next().unwrap().parse().unwrap();
    let b: f64 = iter.next().unwrap().parse().unwrap();
    let h: f64 = iter.next().unwrap().parse().unwrap();
    let m: f64 = iter.next().unwrap().parse().unwrap();

    let h_degree = h / 12.0 * 360.0 + m / 60.0 * 30.0;
    let m_degree = m / 60.0 * 360.0;

    let degree: f64 = if h_degree > m_degree {
        h_degree - m_degree
    } else {
        m_degree - h_degree
    };

    let cos: f64 = if degree > 180.0 {
        ((degree - 180.0) / 180.0 * std::f64::consts::PI).cos()
    } else {
        (degree / 180.0 * std::f64::consts::PI).cos()
    };

    let c2 = a * a + b * b - 2.0 * a * b * cos;

    println!("{}", c2.sqrt());
}


import Foundation

let (A, B, H, M) = readLine()!
    .split(separator: " ")
    .map { Double($0)! }
    .mapToTuple()
var diff = (H * 30 + M / 2) - (M * 6)

//print(diff)

let x = B - A * cos(diff / 180 * .pi)
let y = A * sin(diff / 180 * .pi)

//print(x, y)

print(sqrt(x*x + y*y))

// MARK: -----------------------------------------------------------------------

func readInts() -> [Int] {
    readLine()!.split(separator: " ").map { Int($0)! }
}

extension Collection {
    func mapToTuple() -> (Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!)
    }
    func mapToTuple() -> (Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!)
    }
    func mapToTuple() -> (Element, Element, Element, Element) {
        var i = makeIterator()
        return (i.next()!, i.next()!, i.next()!, i.next()!)
    }
}

struct DP<Argument: Hashable, Element> {
    var dictionary = [Argument: Element]()

    var expression: (Argument, (Argument) -> Element) -> Element

    init(expression: @escaping (_ argument: Argument, _ note: (Argument) -> Element) -> Element) {
        self.expression = expression
    }

    subscript(_ argument: Argument) -> Element {
        mutating get {
            if let note = dictionary[argument] {
                return note
            } else {
                let result = expression(argument) { self[$0] }
                dictionary[argument] = result
                return result
            }
        }
    }
}