jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
import fs = require('fs');
if(process.argv[1].match(/Main.js$/)) { console.log(main(fs.readFileSync('/dev/stdin', 'utf8').split(/[\r\n\t ]/))); }

export function main(strings: string[]): string {
	const ret: any[] = [];
	const str = strings[1];

	let n = 0;
	for(let i=1, i2=2 ** str.length; i<i2; i++) {
		let s = i.toString(2);
		s = '0'.repeat(str.length - s.length) + s;

		let sub = '';
		let ok = true;
		for(let j=0; j<s.length && ok; j++) {
			if(s[j] === '1') {
				if(sub.indexOf(str[j]) !== -1) {
					ok = false;
				} else {
					sub += str[j];
				}
			}
		}

		if(ok) {
			n++;
		}
	}
	ret.push(n % (10**9+7))

	return ret.join('\n') + '\n';
}
//  [typescript]
import fs = require('fs');
if(process.argv[1].match(/Main.js$/)) { console.log(main(fs.readFileSync('/dev/stdin', 'utf8').split(/[\r\n\t ]/))); }

export function main(strings: string[]): string {
	const ret: any[] = [];
	const str = strings[1];

	let n = 0;
	for(let i=1, i2=2 ** str.length; i<i2; i++) {
		let s = i.toString(2);
		s = '0'.repeat(str.length - s.length) + s;

		let sub = '';
		let ok = true;
		for(let j=0; j<s.length; j++) {
			if(s[j] === '1') {
				if(sub.indexOf(str[j]) !== -1) {
					ok = false;
				} else {
					sub += str[j];
				}
			}
		}

		if(ok) {
			n++;
		}
	}
	ret.push(n % (10**9+7))

	return ret.join('\n') + '\n';
}
//  [python]
a,b,c,d = (int(i) for i in input().split())
if (abs(a-b)<=d and abs(b-c)<=d) or abs(a-c)<=d: print("Yes")
else: print("No")
//  [python]
def main():
    a,b,c,d = map(int, input().split())
    if abs(a-c)<=d:
        return "Yes"
    elif abs(a-b)<=d and abs(b-c)<=d:
        return "Yes"
    else:
        return "No"

if __name__ == '__main__':
    print(main())
//  [python]
a,b,c,d=map(int,input().split())
print('Yes' if abs(a-b)<=d and abs(b-c)<=d or abs(c-a)<=d else 'No')
//  [python]
a,b,c,d=map(int,input().split())

if abs(a-c)<=d or abs(a-b)+abs(b-c)<=2*d:
    ans="Yes"
else:
    ans="No"
print(ans)
//  [python]
a,b,c,d = map(int,input().split())

if (a-b) <= d and (b-c) <= d:
    print('Yes')
elif (a-c) <= d:
    print('Yes')
else:
    print('No')
//  [python]
a,b,c,d = map(int,input().split())

if (b-a) <= d and (c-b) <= d:
    print('Yes')
    exit()
elif (c-a) <= d:
    print('Yes')
    exit()

print('No')
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int a, b, c, d;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        a = sc.nextInt();
        b = sc.nextInt();
        c = sc.nextInt();
        d = sc.nextInt();
        solve();
    }

    void solve() {
        if (Math.abs(a - c) <= d || (Math.abs(a - b) <= d && Math.abs(b - c) <= d)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
    // template start ---8<-----------8<---
	FastScanner sc = new FastScanner(System.in);
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	// template end ---8<-----------8<---

	void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		if (Math.abs(a-b)<=d && Math.abs(c-b)<=d || Math.abs(a-c)<=d) {
			out.println("Yes");
		} else {
			out.println("No");
		}

	}

    // template start ---8<-----------8<---
	class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		FastScanner(InputStream in) {
			this.in = in;
		}

		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 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());
		}
	}

	class Random {
		private long seed;
		private final long multiplier = 0x5DEECE66DL, addend = 0xBL, mask = (1L << 48) - 1;
		int bits, val;

		Random(long seed) {
			this.seed = seed;
		}

		int nextInt(int n) {
			do {
				bits = (int) ((seed = (seed * multiplier + addend) & mask) >>> 17);
				val = bits % n;
			} while (bits - val + (n - 1) < 0);
			return val;
		}

		double nextDouble() {
			return nextInt(10000000) / 10000000.0;
		}
	}

	final double TEMP = 10;
	static final long TL = 5850;
	static boolean submit = true;
    // template end ---8<-----------8<---

}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      int C = sc.nextInt();
      int D = sc.nextInt();
      
      if((Math.abs(A-B)<=D|| Math.abs(B-C)<=D) && (Math.abs(A-C)<=D)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      int C = sc.nextInt();
      int D = sc.nextInt();
      
      if((Math.abs(A-B)<=D)|| (Math.abs(B-C)<=D) && (Math.abs(A-C)<=D)){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      int C = sc.nextInt();
      int D = sc.nextInt();
      int[] E = new int[]{A,B,C};
      Arrays.sort(E);
      
      if(E[2]-E[1]<=D||E[1]-E[0]<=D||E[2]-E[0]<=D){
        System.out.println("Yes");
      }else if(E[2]-E[1]>D&&E[1]-E[0]>D&&E[2]-E[0]>D){
        System.out.println("No");
      }
    }
}
//  [cpp]
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a, b, c, d;

scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
scanf("%d", &d);

if((abs(b - a) <= d)&&(abs(c - b) <= d) || (abs(a - c) <= d))
    printf("Yes\n");
else
    printf("No\n");
}
//  [cpp]
#include <cstdio>
#include <cmath>
using namespace std;

int main() {
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    bool ok = abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d);
    printf("%s\n", ok ? "Yes" : "No");
}
//  [cpp]
#include <stdio.h>

int abs(int a) {
  return a < 0 ? -a : a;
}

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

  if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }

  return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
if(abs(a-b)<=d||abs(a-c)<=d||abs(b-c)<=d)
    cout<<"Yes";
else cout<<"No";
       return 0;
}
//  [cpp]
#include <iostream>

using namespace std ;
#define ref(i,n) for(int i =0;i<n;i++)
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ab,ac,bc;
    ab = abs(a-b);
    ac = abs(a-c);
    bc = abs(b-c);
    if(ab > d && ac >d)
    	cout<<"No\n";
    else cout<<"Yes\n";
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {

  int a, b, c, d;
  cin >> a >> b >> c >>d;
  
  if(c-a<=d || (b-a<=d && c-b<=d)) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
int main(void){
  int a,b,c,d;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);

if(abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)){
 printf("Yes");
} else {
 printf("No");
}

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

int main(void)
{
  int a, b, c, d;
  int ab, bc, ac;
  
  scanf("%d %d %d %d", &a, &b, &c, &d);
  ac = abs(c - a);
  ab = abs(b - a);
  bc = abs(c - b);
  if(ac <= d || (ab <= d && bc <=d)) printf("Yes\n");
  else printf("No\n");
  
  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>

int main(void){
    int a,b,c,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    if(abs(a-c)<=d)printf("Yes\n");
    else if(abs(a-b)<=d && abs(b-c)<=d)printf("Yes\n");
    else printf("No\n");
    return 0;
}
//  [c]
#include <stdio.h>

int main() {
  int i,j,k,a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  while((1>a)&&(a>100)&&(1>b)&&(b>100)&&(1>c)&&(c>100)&&(1>d)&&(d>100)){
    scanf("%d %d %d %d",&a,&b,&c,&d);
  }
  i=a-b;
  if(i<0)i=i*(-1);
  j=b-c;
  if(j<0)j=j*(-1);
  k=c-a;
  if(k<0)k=k*(-1);
  if(((i<=d)&&(j<=d))||((i<=d)&&(k<=d))||((j<=d)&&(k<=d))){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main() {
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if (abs(a - b) <= d || abs(a - c) <= d || abs(b - c) <= d) {
		printf("Yes\n");
	} else {
	printf("No\n");
	}
}
//  [c]
#include <stdio.h>

int main() {
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if (a - b <= d) {
		if (b - c <=d)
		{
			printf("Yes\n");
		} else
		{
			printf("No\n");
		}
	} else
	{
		printf("No\n");
	}
}
//  [javascript]
function main(input) {
	const args = input.split(' ');
	const a = parseInt(args[0], 10);
	const b = parseInt(args[1], 10);
	const c = parseInt(args[2], 10);
	const d = parseInt(args[3], 10);
	var t = 0;
	if(Math.abs(a-c)<=d){
		t = 1;
	} else if(Math.abs(a-b)<=d && Math.abs(b-c)<=d){
		t = 1;
	}
	if(t == 1){
		console.log('Yes');
	} else {
		console.log('No');
	}
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main (input) {
  const a = parseInt(input.split(' ')[0],10);
  const b = parseInt(input.split(' ')[1],10);
  const c = parseInt(input.split(' ')[2],10);
  const d = parseInt(input.split(' ')[3],10);

  if (d >= Math.abs(a-c)) {
    console.log('Yes');
  } else {
    if (d >= Math.abs(b-c)) {
      if (d >= Math.abs(a-b)) {
        console.log('Yes');
      } else {
        console.log('No');
      }
    } else {
      console.log('No');
    }
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);
	var c = parseInt(tmp[2], 10);
	var d = parseInt(tmp[3], 10);
	//出力
	if( (Math.abs(a-c)<=d) || ( (Math.abs(a-b) <= d)&&(Math.abs(b-c)<=d) ) )
	  console.log('Yes');
	else
	  console.log('No');
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
    var a = input[1].split(" ").map(v=>v-0);
    var ans = false;
    if(Math.abs(a[0]-a[1]) <= a[3] && Math.abs(a[1]-a[2]) <= a[3]) ans = true;
    if(Math.abs(a[0]-a[2]) <= a[3] ) ans = true;
    console.log(ans?"Yes":"No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"))
//  [javascript]
function Main(input){
	input1 = input.trim().split(' ').map(v=>parseInt(v,10));
    a = input1[0];
    b = input1[1];
    c = input1[2];
    d = input1[3];
    
    if((Math.abs(a-c) <=d) || (Math.abs(a-b) <=d) && Math.abs(b-c) <=d)){
    console.log('Yes');
    }else{
    console.log('No');
    }
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));
//  [go]
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	if abs(a-b) <= d && abs(b-c) <= d || abs(a-c) <= d {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

func abs(x int) int {
	if x <0 {
		x = -x
	}
	return x
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, d float64
	fmt.Scan(&a, &b, &c, &d)
	if math.Abs(a - c) <= d {
		fmt.Println("Yes")
		return
	} else if math.Abs(a - b) <= d && math.Abs(b - c) <= d {
		fmt.Println("Yes")
		return
	} else {
		fmt.Println("No")
		return
	}
}
//  [go]
package main

import (
    . "fmt"
    "math"
)

func main() {
    var a, b, c, d float64
    Scanf("%f %f %f %f", &a, &b, &c, &d)

    if math.Abs(c - a) <= d || math.Abs(b - a) <= d && math.Abs(c - b) <= d {
        Println("Yes")
    } else {
        Println("No")
    }
 }
//  [go]
package main

import (
	"fmt"
)

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

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	if abs(a-b) <= d && abs(b-c) <= d {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import (
	"fmt"
)

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

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)

	if abs(a-b) >= 0 && abs(b-c) >= 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	if b - a >= d && c - b >= d {
	fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [ruby]
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

a,b,c,d=get_i
if (a-c).abs<=d
    puts "Yes"
elsif (a-b).abs<=d and (b-c).abs<=d
    puts "Yes"
else
    puts "No"
end
//  [ruby]
a, b, c, d = gets.chomp.split.map(&:to_i)

if (a - b).abs <= d && (b - c).abs <= d
  puts "Yes"
elsif (a - c).abs <= d
  puts "Yes"
else
  puts "No"
end
//  [ruby]
a,b,c,d = gets.to_s.split.map{|t|t.to_i}

if (a-c).abs <= d || ((a-b).abs <= d && (b-c).abs <= d )
  puts "Yes"
else
  puts "No"
end
//  [ruby]
*a,d=gets.split.map(&:to_i)
a,b,c=a.sort
puts (a-c).abs>d&&((b-c).abs>d||(a-b).abs>d) ?"No":"Yes"
//  [ruby]
*a,d=gets.split.map(&:to_i)
a,b,c=a.sort
puts (a-b).abs>d&&(b-c).abs>d ?"No":"Yes"
//  [ruby]
a,b,c,d=gets.split.map(&:to_i)
puts (a-b).abs>d&&(b-c).abs>d ?"No":"Yes"
//  [rust]
use std::io::*;
use std::str::FromStr;
 
/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn abs(x:i64)->i64{
    if x<0{
	-1*x
    }else {
	x
    }
}

//main function
fn main() {
    let a:i64 = read();
    let b:i64 = read();
    let c:i64 = read();
    let d:i64 = read();
    if (abs(a-c) <= d) || (abs(a-b) <= d && abs(b-c) <= d) {
	println!("Yes");
    }else{
	println!("No");
    }
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let 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! {
        a: i32,
        b: i32,
        c: i32,
        d: i32,
    }
    if (a - c).abs() <= d ||
       ((a - b).abs() <= d && (b - c).abs() <= d) {
        println!("Yes");
    } else {
        println!("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 a = v[0];
	let b = v[1];
	let c = v[2];
	let d = v[3];
	if (c - a).abs() <= d || ((b - a).abs() <= d && (c - b).abs() <= d) {
		println!("Yes");
	}else{
		println!("No");
	}
}
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<t: FromStr>() -> t {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: i64 = read();
    let b: i64 = read();
    let c: i64 = read();
    let d: i64 = read();

    if (a - c).abs() > d && (a - b).abs() > d && (b - c).abs() > d {
        println!("No");
    } else {
        println!("Yes")
    }
}
//  [rust]
use std::io;
use std::io::*;
 
fn read_input() -> String {
  let mut buffer = String::new();
  let stdin = io::stdin();
  let mut handle = stdin.lock();
  let _ = handle.read_to_string(&mut buffer);
  buffer.clone()
}
 
fn main() {
    let buffer = read_input();
    let mut iter = buffer.split_whitespace();
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    let c: i32 = iter.next().unwrap().parse().unwrap();
    let d: i32 = iter.next().unwrap().parse().unwrap();
    if (a - b).abs() <= d {
      println!("Yes");
    } else if (c - a).abs() <= d && (c - b).abs() <= d {
      println!("Yes");
    } else {
      println!("No");
    }
}
//  [rust]
use std::io;
use std::io::*;
 
fn read_input() -> String {
  let mut buffer = String::new();
  let stdin = io::stdin();
  let mut handle = stdin.lock();
  let _ = handle.read_to_string(&mut buffer);
  buffer.clone()
}
 
fn main() {
    let buffer = read_input();
    let mut iter = buffer.split(' ');
    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();
    let c: i32 = iter.next().unwrap().parse().unwrap();
    let d: i32 = iter.next().unwrap().parse().unwrap();
    if (a - b).abs() <= d {
      println!("Yes");
    } else if (c - a).abs() <= d && (c - b).abs() <= d {
      println!("Yes");
    } else {
      println!("No");
    }
}
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!};print(abs(i[0]-i[2])>i[3]&&(abs(i[0]-i[1])>i[3]||abs(i[1]-i[2])>i[3]) ?"No":"Yes")
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!};print(abs(i[0]-i[2])>i[3]||(abs(i[0]-i[1])>i[3]&&abs(i[1]-i[2])>i[3]) ?"No":"Yes")
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!};print((abs(i[0]-i[2])>i[3])||abs(i[0]-i[1])>i[3]&&abs(i[1]-i[2])>i[3] ?"No":"Yes")
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String())!};print((abs(i[0]-i[2])>i[3])||abs(i[0]-i[1])>i[3]&&abs(i[1]-i[2])>i[3] ?"No":"Yes")
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const a = parseInt(input[0], 10);
  const b = parseInt(input[1], 10);
  const c = parseInt(input[2], 10);
  const d = parseInt(input[3], 10);
  
  const resultA = Math.abs(a-b);
  const resultB = Math.abs(a-c);
  const resultC = Math.abs(b-c);
  
  if (resultB<=d|| resultA<=d&&resultC<=d) {
    console.log("Yes");
  }else{
    console.log("No");
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [a, b, c, d] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

let is = false
if (Math.abs(a - b) <= d && Math.abs(b - c) <= d) is = true
if (Math.abs(a - c) <= d) is = true

console.log(is ? 'Yes' : 'No')
//  [typescript]
import * as fs from 'fs'
const inputs = fs.readFileSync('/dev/stdin', 'utf8').split(/\r?\n/)
const [a, b, c, d] = inputs.shift()!.split(' ').map(s => parseInt(s, 10))

const can = (x: number, y: number) => Math.abs(x - y) <= d;
console.log((can(a, c) || (can(a, b) && can(b, c))) ? 'Yes' : 'No')
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let [a,b,c,d]=nrin(4)
  out(abs(a-c<=d)+0||(abs(a-b<=d)+0&&abs(b-c<=d)+0)?'Yes':'No')
}
main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let [a,b,c,d]=nrin(4)
  out(abs(a-c<=d)||(abs(a-b<=d)&&abs(b-c<=d))?'Yes':'No')
}
main()
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let [a,m]=[desc(nrin(3)),nin()]
  out(a[0]-a[1]<=m&&a[1]-a[2]<=m?'Yes':'No')
}
main()
//  [python]
n,k00 = list(map(int, input().split()))

ks = [k00]
ns = [0]
k0 = k00+0
n0 = 0
while k0 >1:
    k0 = ((k0*-1)//2)*-1
    n0 += 1
    ks.append(k0)
    ns.append(n0)

for i,j in enumerate(ks):
    if n == j:
        ks1 = [1]
        for k,l in enumerate(ks[i:][:-1]):
            ks1.append(ks[i:][k] - ks[i:][k+1])
        ns1 = ns[i:]
        break
    elif n > j:
        ks1 = [n-j+1]
        for k,l in enumerate(ks[i:][:-1]):
            ks1.append(ks[i:][k] - ks[i:][k+1])
        ns1 = ns[i:]
        break

ans = 0
b1 = 1/n
for i,j in enumerate(ks1):
        ans += (ks1[i])*((1/2)**ns1[i])*(1/n)

print(ans)
//  [python]
from math import ceil
n,k=map(int,input().split())
b=k
p=0
pp=1
nn=n
while b>0:
    c = max(nn-b+1,0)
    z = c/(n*pp)
    p += z
    pp *= 2
    nn = min(b-1, nn)
    if b == 1:
        b = 0
    else:
        b = ceil(b/2)
print(p)
//  [python]
import math
n,k=map(int,input().split())
now=k
cnt=0 #割った回数
ans=max(0,n-k+1)
while now>=1:
    a=now/2
    b=math.ceil(a) #最小値
    if now!=int(now):
        c=int(now) #最大値
    else:
        c=int(now)-1
    cnt+=1
    if b>min(k-1,n): #調べる最大値(K-1かNの小さいほう)が最小値より大きいとき
        now=a
        continue
    elif c>min(k-1,n): #最大値より小さいとき
        c=min(k-1,n) #最大値を補正
    ans+=1/(2**cnt)*(c-b+1)
    now=a
    if now==1:
        break
print(ans/n)
//  [python]
n,k=map(int,input().split())

ans = 0

for i in range(1,n-1):
  p = i
  r = 1
  while < k:
    p*=2
    r/=2
  ans+=r

ans/=n

print(ans)
//  [python]


def main():
    n, k = map(int, input().split())
    ans = 0.0
    for t in range(1, n + 1):
        cnt = 0
        now = t
        per = 1.0
        while now < k - 1:
            per /= 2
            now *= 2
        ans += per / n
    print('{:.20}'.format(ans))
    pass


if __name__ == '__main__':
    main()
//  [python]


def main():
    n, k = map(int, input().split())
    ans = 0.0
    for t in range(1, n + 1):
        cnt = 0
        now = t
        per = 1.0
        while now < k - 1:
            per /= 2
            now *= 2
        ans += per / n
    print(ans)
    pass


if __name__ == '__main__':
    main()
//  [java]
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        try (CustomReader in = new CustomReader()) {
            new Main().execute(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void execute(CustomReader in) throws IOException {
        int[] nk = in.readLineAsIntArray();
        final int N = nk[0];
        final int K = nk[1];

        double p = 0.0;

        double mul = 1.0;

        int high = N;
        int k = K;
        while (high > 0) {
            if (high >= k) {
                p += (Math.max(high - k + 1, 0) * mul) / N;
                high = k - 1;
            } else {
            }
            if(k%2==0){
                k = k / 2;
            }else{
                k = k / 2 + 1;
            }
            mul *= 0.5;
        }
        System.out.println(p);

    }


    static class CustomReader extends BufferedReader {

        public CustomReader() throws IOException {
            super(new InputStreamReader(System.in));
        }

        public int[] readLineAsIntArray() throws IOException {
            String[] strArray = this.readLine().split(" ");
            int[] intArray = new int[strArray.length];
            for (int i = 0, n = strArray.length; i < n; i++) {
                intArray[i] = Integer.parseInt(strArray[i]);
            }
            return intArray;
        }

        public int[][] readAsIntMatrix(int rows, int columns) throws IOException {
            int[][] matrix = new int[rows][columns];
            for (int i = 0; i < rows; i++) {
                String[] r = this.readLine().split(" ");
                for (int j = 0; j < columns; j++) {
                    matrix[i][j] = Integer.parseInt(r[j]);
                }
            }
            return matrix;
        }

    }
}
//  [java]
import java.io.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();
        int N, K;
        {int[] a = r.ii(); N = a[0]; K = a[1];}
        double ans = 0;
        if(K <= N)
            ans += N-K+1;
        for(int i = 1; i <= Math.min(K-1, N); i++){
            int n = 0;
            int score = i;
            while(score < K){
                n++;
                score *= 2;
            }            
            ans += Math.pow(0.5, n);
        }
        ans /= N;
        print(ans);        
    }
    static void print(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int Int(String s){
            return Integer.parseInt(s);
        }
        int i() throws IOException{
        return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        double ans = 0.0;
        double tmp1 = 1.0 / n;
        for (int i = 1; i <= n; i++) {
            int tmp2 = i;
            int j = 0;
            for (; ; j++) {
                if(tmp2 > k) {
                    break;
                }
                tmp2 *= 2;
            }

            ans += Math.pow(0.5, j) * tmp1;
        }
        System.out.println(ans);
    }
}
//  [java]

import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Main2 {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();

		double all = 0; 
		for( int i = 1 ; i <= n ; i++ ) {
			int now = i;
			int p_all = 1;
			while( now < k ) {
				now *= 2;
				p_all *= 2;
			}
			all += 1.0/n/p_all;
		}
		
		System.out.println( (double)all );
		

	}
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt(), k = sc.nextInt();
		int t = 0;
		long bottom = 1, up = 1;
		BigDecimal p = BigDecimal.ZERO;
		for(long i = 1; i <= n; i++) {
			if(i >= k) {
				up += bottom;
			}else if(i == 1){
				bottom = min(i);
			}else {
				long x = min(i);
				up += bottom / x;
			}
		}
		BigDecimal b = BigDecimal.valueOf(n*bottom);
		BigDecimal u = BigDecimal.valueOf(up);
		System.out.println(u.divide(b, 12, BigDecimal.ROUND_HALF_UP));
	}

	static long min(long i) {
		long x = 0;
		double r = 0;
		r = (Math.log(10) - Math.log(i)) / Math.log(2);
		x = (long)r;
		if(r-x != 0) {
			x++;
		}
		long big = (long)Math.pow(2, x);
		return big;
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

int main() {

    int n,k;
    cin >> n >> k;

    double ans = 0;
    for (int i = 1; i <= n; ++i) {
        long long cur = i;
        int cnt = 0;
        while(cur < k) cnt++, cur += cur;
        double m = 1;
        while(cnt--) m *= 0.5;
        ans += (m * (1. / n));
    }

    printf("%.10lf\n", ans);
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  cout <<fixed <<setprecision(15);
  double n,k; cin >>n >>k;
  double ans;
  for (int i=1; i<=min(n,k-1); i++){
    int buf = i;
    double p = 1;
    while(buf<k){ buf *= 2; p /= 2;}
    ans += p;
  }
  for (int i=k; i<=n; i++){
    ans++;
  }
  ans /= n;
  cout <<ans;
  cout <<endl;
}
//  [cpp]
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <set>
#include <map>
using namespace std;


int main()
{
	int32_t N, K;
	cin >> N >> K;

	double res = 0;
	for (int32_t i = 1; i <= N; i++) {
		double prob = 1.0;
		int32_t value = i;
		while (value < K) {
			value *= 2;
			prob /= 2.0;
		}
		res += prob;
	}
	res /= N;

	cout << fixed << std::setprecision(std::numeric_limits<double>::max_digits10) << res << endl;

	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = long long;

int main()
{
    int N, K;
    cin >> N >> K;

    double ans = 0.0;

    rep(i, 0, N)
    {
        int n = i + 1;

        int s = n;
        int t = n;
        int sk = K - 1;
        int c = 1;

        while (s < sk)
        {
            t *= 2;
            s += t;
            c++;
        }
        ans += static_cast<double>(1 / static_cast<double>(N)) * static_cast<double>(pow(0.5, c));
    }

    cout << ans;

    return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define MOD (long long)(1E9+7)
#define rep(i, n) for(int i = 0; i < n; i++)

using namespace std;

int main(){
	int n,k;
  	double ans = 0.0;
	cin >> n >> k;
  	if(n>=k) {
    	ans += (double)(n-k+1)/n;
    }
	rep(i, min(n, k-1)){
      	int kk = max((log((double)k/(i+1))/log(2)), 0.0)+1;
      	ans += pow(0.5, kk)/ n;
	}
	printf("%.9lf\n", ans);
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;int main(){int a,b;scanf("%d%d",&a,&b);double ans=0;for(int i=1;i<=a;i++){double pos=1.0/a;int now=i;while(now<b){now*=2;pos/=2;}ans+=pos;}printf("%.12llf\n",ans);return 0;}
//  [c]
#include <stdio.h>
int main(void){
    int n,k,cnt,i,j;
    double ans=0;
    scanf("%d%d",&n,&k);
    for(i=1;i<=n;i++){
        j=i;
        double p=1;
        while(j<k){
            j*=2;
            p*=0.5;
        }
        ans += p/n;
    }
    printf("%.10f\n",ans);
}
//  [c]
#include <stdio.h>
int main(void){
    int n,k,cnt,i,j;
    double ans=0;
    scanf("%d%d",&n,&k);
    for(i=1;i<n+1;i++){
        j=i;
        cnt=0;
        while(j<k){
            j*=2;
            cnt++;
        }
        ans += (double)1/(1<<cnt);
    }
    printf("%.10f",ans/n);
}
//  [c]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int(void) {
  int num;
  scanf("%d", &num);
  return num;
}

int get_int2(int *a1, int *a2) {
  scanf("%d %d", a1, a2);
  return 0;
}

#define POWER_MAX 20

int main(void) {
    int num, llimit;
    get_int2(&num, &llimit);

    static int power2[POWER_MAX];
    power2[0] = 1;
    int i = 0;
    for(i = 1; i < POWER_MAX; i++) {
        power2[i] = power2[i-1] * 2;
    }

    static int map[POWER_MAX];
    for(i = 1; i <= num; i++) {
        int point = i;
        int cnt = 0;
        while(point < llimit) {
            cnt++;
            point *= 2;
        }
        map[cnt]++;
#ifdef DEBUG
        printf("%d -> %d\n", i, cnt);
#endif
    }

    double ans = 0;
    for(i = 0; i < POWER_MAX; i++) {
        ans += 1.0 / num * (1.0/power2[i]) * map[i];
    }
    printf("%.10lf\n", ans);
    return 0;
}
//  [c]
#include <stdio.h>
#define _CRT_SECURE_NO_WARNINGS

int main() {
	double N = 0;	//input:サイコロの面数
	double K = 0;	//input:勝利に必要な点数
	int count = 0;
	double victory_probability = 0;
	int i = 0;

	do {
		scanf("%lf %lf", &N, &K);
	} while ((N < 1 && 100000 < N) && (K < 1 && 100000 < K));

	while (N <= K) {
		K = K / 2;
		count++;
	}
	for (i = 1; i <= N; i++) {
		victory_probability += (1 / N) * ((1 / 2) ^ count);
		count--;
	}
	return 0;
}
//  [c]
#include <stdio.h>
#define _CRT_SECURE_NO_WARNINGS

int main() {
	int N = 0;	//input:サイコロの面数
	int K = 0;	//input:勝利に必要な点数
	int count = 0;
	double victory_probability = 0;
	int i = 0;

	do {
		scanf("%d %d", &N, &K);
	} while ((N < 1 && 100000 < N) && (K < 1 && 100000 < K));

	while (N <= K) {
		K = K / 2;
		count++;
	}
	for (i = 1; i <= N; i++) {
		victory_probability += (1 / N) * ((1 / 2) ^ count);
		count--;
	}
	return 0;
}
//  [c]
#include <stdio.h>
#define _CRT_SECURE_NO_WARNINGS

int main() {
	int N = 0;	//input:サイコロの面数
	int K = 0;	//input:勝利に必要な点数
	int count = 0;
	double victory_probability = 0;
	int i = 0;

	do {
		scanf("%d %d", &N, &K);
	} while ((1 <= N && N <= 100000) && (1 <= K && K <= 100000));

	while (N <= K) {
		K = K / 2;
		count++;
	}
	for (i = 1; i <= N; i++) {
		victory_probability += (1 / N) * ((1 / 2) ^ count);
		count--;
	}
	return 0;
}
//  [javascript]
function main(input){
  input = input.split(' ').map(Number);
  const N = input[0];
  const K = input[1];
  
  var result = 0;
  
  for(i = 1;i <= N;i++){
    var tmp = 1/N;
  	var now = i;
  	while(now < K){
      now *= 2;
      tmp /= 2;
    }
    result += tmp;
  }
  
  console.log(result.toString().slice(0,14));
}
main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [javascript]
var input=require('fs').readFileSync('/dev/stdin', 'utf8');
  var inputs=input.split(' ');
  var n=Number(inputs[0]),k=Number(inputs[1]);
  var rate=0;
  for(var i=1; i<=n; i++){
    var rate2=1,n2=i;
    while(n2<k){
      rate2/=2;
      n2*=2;
    }
    rate+=rate2;
  }
  console.log(rate/n);
//  [javascript]
"use strict";
function Main(input) {
  const args = input.split(' ').map(m => parseInt(m));
  const N = args.shift();
  const K = args.shift()
  let aN = N;
  let rK = K;
  let counter = 1;
  let rate = 0;
  while (true) {
    if (aN >= rK) {
      const win = aN - rK + 1;
      rate += (win / (counter * N));
      aN = rK - 1;
    }
    if (rK === 1) {
      break;
    }
    rK = Math.ceil(rK / 2);
    counter = counter * 2;
  }

  console.log(rate);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"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 calc = (n, k) =>{
    let cnt = 0
    while(n>k){
        n *= 2
        cnt++
    }
    return cnt
}
const Main = () => {
    const [N, K] = nextIntArray()
    let ans = 0
    for(let i = 1; i<=N; i++){
        const cnt = calc(i, K)
        ans += 1/N*(0.5**cnt)
    }
    console.log(ans)
}
Main()
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const K = parseInt(arg[0].split(" ")[1]);
    
    let answer = [];
    
    for(let i=1; i<=N; i++) {
        let now = i;
        let cnt = 1;
        
        while(true) {
            if(now > K) break;
            now *= 2;
            cnt++;
            // console.log("now:" + now);
            // console.log("cnt:" + cnt);
        }
        
        // console.log(cnt - 1);
        
        let temp = (1 / N) * Math.pow(0.5, cnt - 1)
        
        answer.push(temp);
    }
    
    console.log(answer.reduce((m,n)=>m+n));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function main(input) {
        const line = input.split(' ');
        const n = line[0];
        const k = line[1];

        let result = 0;
        for (let i = 1; i <= n; ++i) {
                let j = i;
                let toss = 0;
                for (let j = i; j < k; j*=2, ++toss) ;

                result += Math.pow(0.5, toss) * (1 / n);
        }
        console.log(`${result}`);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import "fmt"

var n, k int
var ans float64

func main() {
  fmt.Scanf("%d%d", &n, &k)
  
  for i := 1; i <= n; i++ {
    p := 1/float64(n)
    if i >= k {
      ans += p
      continue
    }
    now := i
    for now < k {
      p /= 2
      now *= 2
    }
    ans += p
  }
  fmt.Println(ans)
}
//  [go]
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

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 yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var n, k int
	fmt.Fscan(read, &n, &k)

	ans := 0.0
	p0 := 1.0 / float64(n)
	p := 0.0
	for i := 1; i <= n; i++ {
		p = p0
		for j := i; j < k; j *= 2 {
			p /= 2.0
		}
		ans += p
	}
	fmt.Fprintln(write, ans)
}
//  [go]
package main

import "fmt"

func main() {
	var (
		N, K int
		ans  float64
	)
	fmt.Scan(&N, &K)

	for i := 1; i <= N; i++ {
		rate := 1 / float64(N)
		point := i
		for point < K {
			point *= 2
			rate /= 2
		}
		ans += rate
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func cnt(a, b int) int {
	var cnt int = 0
	if a == 1 {
		a = 2
		cnt += 1
	}
	for b > 0 {
		b = b / a
		cnt++
	}
	return cnt - 1
}

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	var ans float64
	for i := 1; i <= n; i++ {
		if i >= k {
			ans += 1.0 / float64(n)
			continue
		}

		win := cnt(i, k)
		ans += math.Pow(1.0/2.0, float64(win)) * (1.0 / float64(n))
	}

	fmt.Printf("%.10f\n", ans)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func b2i(b bool) int {
	if b {
		return 1
	}
	return 0
}

func cnt(a, b int) int {
	var cnt int = 0
	if a == 1 {
		a = 2
		cnt += 1
	}
	for b > 0 {
		b = b / a
		cnt++
	}
	return cnt - 1
}

func main() {
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	var ans float64
	for i := 1; i <= n; i++ {
		if i >= k {
			ans += 1.0 / float64(n)
			continue
		}

		win := cnt(i, k)
		ans += math.Pow(0.5, float64(win)) * (1.0 / float64(n))
	}

	fmt.Println(ans)
}