jiahuimbzuai/CoQuIR huggingface dataset:
//  [python]
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))
//  [python]
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))
//  [java]
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());}
	}
}
//  [java]
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;
	}
}
//  [java]
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));
  }
}
//  [java]
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));
  }
}
//  [java]
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));
  }
}
//  [cpp]
#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;
}
//  [cpp]
#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)));
}
//  [cpp]
#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;
}
//  [cpp]
#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;
}
//  [cpp]
#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;
}
//  [cpp]
#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;
  
}
//  [c]
#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;
  }
//  [c]
#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;
}
//  [c]
#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;
}
//  [c]
#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;
}
//  [c]
#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;
}
//  [c]
#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);
}
//  [javascript]
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);
}
//  [javascript]
'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"));
//  [javascript]
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'));
//  [javascript]
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"));
//  [javascript]
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");
//  [javascript]
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"));
//  [go]
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))
}
//  [go]
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))
}
//  [go]
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)
}
//  [go]
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)
}
//  [ruby]
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)
//  [ruby]
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
//  [ruby]
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)))
//  [ruby]
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))
//  [ruby]
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)
//  [ruby]
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)
//  [rust]
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());
}
//  [rust]
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);
}
//  [rust]
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());
}
//  [rust]
// -*- 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));
}
//  [rust]
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());
}
//  [swift]
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
            }
        }
    }
}
//  [swift]
import Foundation

let info = readLine()!.split(separator: " ").map{Double($0)!}
let A = info[0]
let B = info[1]
let H = info[2]
let M = info[3]

let rad = (H * 60  + M) * 5.5 / 180.0 * Double.pi
let C = A * A + B * B - (2 * A * B * cos(rad))
print(sqrt(C))
//  [swift]
// : (Colon) 

import Foundation

func main() {
    let i = readLine()!.split(separator: " ").map{Double($0)!}
        
    let (a,b,h,m) = (i[0], i[1], i[2], i[3])
    let pi = Double.pi
    // それぞれの針の角度
    let x = 2 * pi * (h * 60 + m) / (60 * 12)
    let y = 2 * pi * (m) / (60)

    let (ax, ay) = (a * cos(x), a * sin(x))
    let (bx, by) = (b * cos(y), a * sin(y))
    
    let distance = pow(pow(ax - bx, 2) + pow(ay - by, 2), 0.5)
    print(distance)
}

main()
//  [swift]
import Foundation

func readFourInts(separator: String.Element = " ") -> (a: Int, b: Int, c: Int, d: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1], c: ints[2], d: ints[3])
}

func mainC() {
    let (A, B, H, M) = readFourInts()

    let times = H * 60 + M
    let Adgree = (Double(times) * 0.5).truncatingRemainder(dividingBy: 360)
    let Bdgree = (Double(times) * 6).truncatingRemainder(dividingBy: 360)

    let diff = abs(Adgree - Bdgree) > 180 ? abs(Adgree - Bdgree) - 180 : abs(Adgree - Bdgree)

    let result = Double(A * A + B * B) - 2 * Double(A * B) * cos(diff * Double.pi / 180)
    print(result.squareRoot())
}
mainC()
//  [swift]
import Foundation

struct Vec2 {
    var x:Double;
    var y:Double;
}

func Distance(a:Vec2, b:Vec2)->Double {
    let v = Vec2(x:a.x - b.x, y:a.y - b.y)
    return sqrt(v.x * v.x + v.y * v.y)
}

func CalcHVec(h:Double, m:Double, length:Double) -> Vec2 {
    let pi2 = Double.pi * 2.0
    let hrad = pi2 * h / 12.0
    let mrad = (pi2 / 12.0) * m / 60.0

    return Vec2(x:cos(hrad + mrad) * length, y:sin(hrad + mrad) * length)
}

func CalcMVec(m:Double, length:Double) -> Vec2 {
    let pi2 = Double.pi * 2.0
    let mrad = pi2 * m / 60.0

    return Vec2(x:cos(mrad) * length, y:sin(mrad) * length)
}

let args = readLine()?.split(separator: " ") ?? []

let a = Double(args[0]) ?? 0  // 時針長さ
let b = Double(args[1]) ?? 0  // 分針長さ
let h = Double(args[2]) ?? 0
let m = Double(args[3]) ?? 0

let hvec = CalcHVec(h: h, m: m, length: a)
let mvec = CalcMVec(m: m, length: b)
let result = Distance(a: hvec, b: mvec)

print(SIMD2<Double>(hvec.x, hvec.y))

print(result)
//  [typescript]
import * as fs from 'fs';

export function Main(input: string) {
    const [a, b, h, m] = input.split(' ').map(int => parseInt(int));    // ?

    const angleH = 2 * Math.PI * (h + m / 60) / 12;   // ?
    const angleM = 2 * Math.PI * m / 60;  // ?

    const Xh = Math.cos(angleH) * a;    // ?
    const Yh = Math.sin(angleH) * a;    // ?

    const Xm = Math.cos(angleM) * b;    // ?
    const Ym = Math.sin(angleM) * b;    // ?

    let result: any = Math.sqrt((Xh - Xm) ** 2 + (Yh - Ym) ** 2);
    // result = result.toFixed(9);

    //output

    console.log(result);
    return result;
}

// Don't edit this line!
Main(fs.readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [A, B, H, M] = input[0].map(Number);

  const alpha = ((60 * H + M) / (60 * 12)) * 2 * Math.PI;
  const beta = (M / 60) * 2 * Math.PI;

  return Math.sqrt(A ** 2 + B ** 2 - 2 * A * B * Math.cos(alpha - beta));
};

console.log(main(read()));
//  [typescript]
import * as fs from 'fs';

const readString = (() => {
  const input = fs.readFileSync(0).toString();
  const words = input.split(/[ \n]/);
  let i = 0;
  return () => words[i++] || '';
})();
const readInt = () => parseInt(readString(), 10);

(function main() {
  const A = readInt();
  const B = readInt();
  const H = readInt();
  const M = readInt();

  const hx = A * Math.sin((H + M/60) / 12 * Math.PI * 2);
  const hy = A * Math.cos((H + M/60) / 12 * Math.PI * 2);

  const mx = B * Math.sin(M / 60 * Math.PI * 2);
  const my = B * Math.cos(M / 60 * Math.PI * 2);

  console.log(Math.sqrt((hx - mx) ** 2 + (hy - my) ** 2));
})();
//  [typescript]
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const rule = lines.shift().split(" ").map(Number);
  const long = rule[0];
  const short = rule[1];
  const h = rule[2];
  const m = rule[3];

  let angle = 30 * h - 6 * m;
  if (angle >= 180) angle = 360 - angle;

  let res =
    Math.pow(long, 2) +
    Math.pow(short, 2) -
    2 * long * short * Math.cos(angle * (Math.PI / 180));

  res = Math.sqrt(res);

  console.log(res);
});
//  [python]
n = input()
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] or (len(set(n))==1):
  print("Yes")
else:
  print("No")
//  [python]
n = str(input())
lst = ['000','111','222','333','444','555','666','777','888','999']
answer = 'No'
if n[:3] in lst:
	answer = 'Yes'
if n[1:] in lst:
	answer = 'Yes'
print(answer)
//  [python]
A=input()
if A[0]==A[1]==A[2] or A[1]==A[2]==A[3]:
  print('Yes')
else:
  print('No')
//  [python]
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    # 1 line 1 int
    return int(sys.stdin.readline().rstrip())
def LI():
    # 1 line n ints
    return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    # 1 line 1 string
    return sys.stdin.readline().rstrip()
def LS():
    # 1 line n strings
    return list(sys.stdin.readline().rstrip().split())

A = S()

if A[0] == A[1] == A[2] or A[1] == A[2] == A[3]:
   print("Yes")
else
   print("No")
//  [python]
import bisect,collections,copy,heapq,itertools,math,string
import sys
def I():
    # 1 line 1 int
    return int(sys.stdin.readline().rstrip())
def LI():
    # 1 line n ints
    return list(map(int,sys.stdin.readline().rstrip().split()))
def S():
    # 1 line 1 string
    return sys.stdin.readline().rstrip()
def LS():
    # 1 line n strings
    return list(sys.stdin.readline().rstrip().split())

A = S()

if A[0] == A[1] == A[2] or
   A[1] == A[2] == A[3]:
   print("Yes")
else
   print("No")
//  [python]
a=set(input())
if len(a)<=2:
  print('Yes')
else:
  print('No')
//  [java]

    import javax.xml.crypto.Data;
    import java.math.BigDecimal;
    import java.util.*;
    import java.io.*;

    public class Main {

        public static void main(String[] args) throws IOException {

            //入力
            //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            FastScanner sc = new FastScanner();
            int n = sc.nextInt();

            //出力
            int[] a = new int[4];
            for (int i = 3; i >= 0 ; i--) {
                a[i] = n % 10;
                n /= 10;
            }
            if ((a[0] == a[1] && a[1] == a[2])
                    || (a[1] == a[2] && a[2] == a[3])) System.out.println("Yes");
            else System.out.println("No");
        }

    }


    class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
//  [java]
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        char[] ch = sc.next().toCharArray();
        final int N = ch.length;
        String ans = "No";
        
        for (int i = 0; i < N - 2; i++) {
            if (ch[i] == ch[i + 1] && ch[i + 1] == ch[i + 2]) {
                ans = "Yes";
            }
        }
        
        out.println(ans);

        out.flush();
    }
}
// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {

    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }

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

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }

    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}
//  [java]
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String N = in.readLine();
		String subA = N.substring(0, 3);
		String subB = N.substring(1, 4);
		boolean condA = true;
		boolean condB = true;
		for (int i = 1; i < subA.length(); ++i) {
			if (subA.charAt(i - 1) != subA.charAt(i)) {
				condA = false;
				break;
			}
		}
		for (int i = 1; i < subB.length(); ++i) {
			if (subB.charAt(i - 1) != subB.charAt(i)) {
				condB = false;
				break;
			}
		}
		if (condA || condB) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		String X = stdIn.next();
		String Y = stdIn.next();
		
		if(X.charAt(0) > Y.charAt(0))
		{
			System.out.println(">");
		}
		else if(X.charAt(0) < Y.charAt(0))
		{
			System.out.println("<");
		}
		else
		{
			System.out.println("=");
		}
		
		

	}

}
//  [java]
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int[] c = new int[256];
		boolean ok = false;
		for (char ch : sc.next().toCharArray()) if (++c[ch]>=3) ok=true;
		System.out.println(ok ? "Yes" : "No");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}
//  [java]
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int[] c = new int[256];
		boolean ok = false;
		for (char ch : sc.next().toCharArray()) if (++c[ch]==3) ok=true;
		System.out.println(ok ? "Yes" : "No");
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}
//  [cpp]
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
using namespace std;
int n;
char a[10];


int main(){
	scanf("%s", a);
	bool flag = false;
	if(a[0] == a[1] && a[1] == a[2]) flag = true;
	if(a[1] == a[2] && a[2] == a[3]) flag = true;
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}
//  [cpp]
#include <stdio.h>
int main()
{
	int n,a,b,c,d;
	scanf("%d",&n);
	a=n/1000;
	b=n%1000/100;
	c=n%100/10;
	d=n%10;
	if((a==b&&b==c)||(b==c&&c==d))
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}
//  [cpp]
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int a, b, c, d, e;
	while(~scanf("%d",&e))
		{
		a = e/1000;
		b = (e - a*1000)/100;
		c = (e - a*1000 - b*100)/10;
		d = (e - a*1000 - b*100 - c*10);
		if((a == b && b == c) || (b == c && c == d))
			printf("Yes\n");
	    else
	    	printf("No\n");
		}
}
//  [cpp]
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
double pi=acos(-1);
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
// #define mp make_pair
#define pq priority_queue
const ll mod=1000000007;
#define f first
#define s second
#define pii pair< ll, ll >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace boost::multiprecision;
using namespace std;
void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}


const int N=1000005;
ll fact[N],invfact[N];
ll power(ll x,ll y){
  if(y<=0) return 1LL;
  ll z=power(x,y/2);
  if(y%2) return (((z*z)%mod)*x)%mod;
  return (z*z)%mod;
}

void pre(){
  fact[0]=invfact[0]=invfact[1]=fact[1]=1;
  rep(i,2,N) fact[i]=(i*fact[i-1])%mod;
  rep(i,2,N) invfact[i]=(invfact[i-1]*power(i,mod-2))%mod;
}
ll nCr(ll n,ll k){ return (((fact[n]*invfact[n-k])%mod)*invfact[k])%mod; }



const int N1=1e6+1;
vector<int> isprime(N1,1),prime;
void seive(){
  rep(i,2,sqrt(N1)+1){
      if(isprime[i]){
        for(int j=i*i;j<N1;j+=i) isprime[j]=0;
        prime.pb(i);
      }
  }
  rep(i,sqrt(N1)+1,N1) if(isprime[i]) prime.pb(i);
}



struct dsu {
    vector<int> par, rank;
    dsu(int n): par(n+1), rank(n+1) {
        for (int i = 0; i <= n; i++) {
            par[i] = i;
            rank[i]= 1;
        }
    }
    int root(int a) {
        if (a == par[a]) return a;
        return par[a] = root(par[a]);
    }
    void merge(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (rank[a] > rank[b]) swap(a, b);
        par[b] = a;
    }
    set<int> parent(int n){
        set<int> s;
        for(int i=1;i<=n;i++){
            s.insert(root(i));
        }
        return s;
    }
};

void solve(){
  string s;
  cin>>s;
  if((s[0]==s[1] && s[1]==s[2]) ||(s[1]==s[2] && s[2]==s[3])) cout<<"Yes";
  else cout<<"NO";
}

int main(){
    optimizeIO();
    int r=1;
    {solve();}
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() { string d;
  cin >> d;
  if(d.at(0)==d.at(1) && d.at(1)==d.at(2)){
    cout << "Yes" << endl;
  } else if (d.at(0)==d.at(1) && d.at(1)==d.at(3)){
    cout << "Yes" << endl;
  } else if (d.at(0)==d.at(2) && d.at(2)==d.at(3)){
    cout << "Yes" << endl;
  } else if (d.at(1)==d.at(2) && d.at(2)==d.at(3)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() { string d;
  cin >> d;
  if(d.at(1)==d.at(2) && d.at(2)==d.at(3)){
    cout << "Yes" << endl;
  } else if (d.at(1)==d.at(2) && d.at(2)==d.at(4)){
    cout << "Yes" << endl;
  } else if (d.at(1)==d.at(3) && d.at(3)==d.at(4)){
    cout << "Yes" << endl;
  } else if (d.at(2)==d.at(3) && d.at(3)==d.at(4)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
//  [c]
#include <stdio.h>

int main() {
	char n[256];
	scanf("%s", &n);
	if ((n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3])) printf("Yes");
	else printf("No");
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

int main(void){
  int a, i;
  int b[4] = {0};
  scanf("%d",&a);
  for(i=0;i<4;i++){
    b[i] = a % 10;
    a /= 10;
  }
  for(i=0;i<3;i++){
    if(b[i] == b[i+1] && b[i] == b[i+2]){
      printf("Yes\n");
      return 0;
    }
  }

  printf("No\n");
  return 0;
}
//  [c]
#include<stdio.h>
int main()
{
	int i,a,b,c,n,nmax;
	scanf("%d",&a);
	n=1;
	nmax=1;	
	b=a/1000;
	a=a%1000;
	for(i=100;i>0;i/=10){
		c=a/i;
		a=a%i;
		if(b==c){
			n++;
		}else{
			if(n<3){
				n=1;
			}
		}
		b=c;
	}
	if(n>=3){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}
//  [c]
#include <stdio.h>

int main() {
	int number, one, two, three, four;

	scanf("%d", &number);

	one = number % 10;
	two = number % 100 - one;
	three = number % 1000 - one - two;
	four = number - one - two - three;
	
	two /= 10;
	three /= 100;
	four /= 1000;

	if (one == two) {
		if (one == three)
			printf("Yes");
	}
	if (two == three) {
		if (two == four)
			printf("Yes");
	}
	else
		printf("No");

	return 0;
}
//  [c]
#include <stdio.h>

int main() {
	int number, one, two, three, four;

	//scanf("%d", &number);
	number = 2122;

	one = number % 10;
	two = number % 100 - one;
	three = number % 1000 - one - two;
	four = number - one - two - three;
	
	two /= 10;
	three /= 100;
	four /= 1000;

	if (one == two) {
		if (one == three)
			printf("Yes");
	}
	if (two == three) {
		if (two == four)
			printf("Yes");
	}
	else
		printf("No");

	return 0;
}
//  [javascript]
function Main(input) {
  input = input.trim()
  input = input.split("").map(Number);
  if(input[1]==input[2]&&(input[0]==input[1]||input[2]==input[3])) console.log("Yes")
  else console.log("No")
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  var N = input[0];
  console.log(N.match(/([0-9])\1\1/)?"Yes":"No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
//  [javascript]
function Main(input) {
	input = input.split("\n");
	var n = input[0];
	var s = "No";
	if(n[1]==n[2]){
	    if(n[0]==n[1]||n[2]==n[3])s = "Yes";
	}
	console.log('%s',s);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
  input = input.trim();
  const a = input.split('');
  
  console.log((Array.from(new Set(a)).length)==2?'Yes':'No');
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input) {
  //input = input.trim();
  const a = input.split('');
  
  console.log((Array.from(new Set(a)).length)==2?'Yes':'No');
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input) {
  input = input.trim();
  const a = input.split(",");
  console.log((Array.from(new Set(a)).length)==2?'Yes':'No');
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	if s[0] == s[1] && s[1] == s[2] && s[0] == s[2] || s[1] == s[2] && s[2] == s[3] && s[1] == s[3] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import "fmt"

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

	cnt := 0
	gd := false
	for i := range n[:len(n)-1] {
		if n[i] == n[i+1] {
			cnt++
			if cnt >= 2 {
				gd = true
			}
		} else {
			cnt = 0
		}
	}
	if gd {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import "fmt"

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

	if N[0] == N[1] {
		if N[1] == N[2] {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	} else {
		if N[1] == N[2] {
			if N[2] == N[3] {
				fmt.Println("Yes")
			} else {
				fmt.Println("No")
			}
		} else {
			fmt.Println("No")
		}
	}
}
//  [go]
package main

import "fmt"

func main() {
	// Code for A - Good Integer
	var S string
	fmt.Scanf("%s", &S)

	if (S[0] == S[1] && S[1] == S[2]) || (S[2] == S[3] && S[3] == S[4]) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main
 
import (
	"fmt"
)
 
func main() {
	var a, b, c, d int
	fmt.Scanf("%d%d%d%d", &a, &b, &c, &d)
	if (a == b && b == c) || (b == c && c == d) {
		fmt.Printf("%s", "Yes")
	} else {
		fmt.Printf("%d", "No")
	}
}
//  [ruby]
puts /(\d)\1\1/ =~ gets ? "Yes" : "No"
//  [ruby]
n =  gets.to_s
puts ((n[0] == n[1] && n[1] == n[2] )||( n[1] == n[2] && n[2] == n[3])) ? "Yes" : "No"
//  [ruby]
n = readline.split("").map(&:to_i)
puts (n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3]) ? "Yes" : "No"
//  [ruby]
puts /[0-9]{3}/.match(gets) ? :Yes: :No
//  [ruby]
n = gets().chomp.split('')

cnt = 1
n.each_with_index do |chr, i|
  next if i == 0
  if chr == n[i - 1]
    cnt += 1
    break if cnt >= 3
  else
    cnt = 0
  end
end

puts cnt >= 3 ? 'Yes' : 'No'
//  [ruby]
n = gets().chomp.split('')

cnt = 1
n.each_with_index do |chr, i|
  next if i == 0
  if chr == n[i - 1]
    cnt += 1 
  else
    cnt = 0
  end
end

puts cnt >= 3 ? 'Yes' : 'No'
//  [rust]
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n = v[0];
	let s:Vec<char> = n.to_string().chars().collect();
	if s[0] == s[1] && s[1] == s[2] {
		println!("Yes");
	}else if s[1] == s[2] && s[1] == s[3] {
		println!("Yes");
	}else{
		println!("No");
	}
}
//  [rust]
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 mut n: Vec<char> = read_as_string().chars().collect::<Vec<char>>();
    //n.dedup();
    if (n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3]){
        println!("Yes");
    }else{
        println!("No");
    }
    /*
    if n.len() < 3{
        println!("Yes");
    }else{
        println!("No");
    }
    */
}
//  [rust]
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    if  s.chars().nth(0) == s.chars().nth(1) && s.chars().nth(1) == s.chars().nth(2) ||
        s.chars().nth(1) == s.chars().nth(2) && s.chars().nth(2) == s.chars().nth(3) {
        println!("Yes");
    }
    else {
        println!("No");
    }

}
//  [rust]
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

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

#[fastout]
fn main() {
    input!{
        n: Chars,
    }

    if n[0]==n[1] || n[1]==n[2] || n[2]==n[3] {
        println!("Yes");
    } else {
        println!("No");
    }

}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: String};
    let n: String = n;

    let n1 = &n[0..2].parse().unwrap();
    let n2 = &n[1..3].parse().unwrap();

    if n1 % 111 == 0 || n2 % 111 == 0 {
        println!("Yes")
    } else {
        println!("No")
    }
}
//  [swift]
import Glibc
extension String: CollectionType {}

//var abc = readLine()!.split(" ").map { Int($0)! }
var n = Int(readLine()!)!
var a = n / 1000
var b = (n % 1000) / 100
var c = (n % 100) / 10
var d = n % 10
if (a == b && b == c) || (b == c && c == d) {
  print("Yes")
} else {
  print("No")
}
//  [swift]
let i=readLine()!.characters.map{$0};print((i[0]==i[1]||i[2]==i[3])&&i[1]==i[2] ?"Yes":"No")