jiahuimbzuai/CoQuIR huggingface dataset:
//  [javascript]
"use strict";
(function(input){
  input=input.trim();
  input=input.split(/\n+/);
  const N=input[0]-0,
        A=input[1].split(/\s+/).map(x=>x-0);
  let last=A[N-1];
  for(let i=0;i<(N-1)/2;i++){
    last-=A[2*i];
    last+=A[2*i+1];
  }
  const ansReversed=[last];
  for(let i=N-2;i>=0;i--){
    ansReversed.push(2*A[i]-ansReversed[ansReversed.length-1]);
  }
  const ans=ansReversed.reverse();
  console.log(ans.join(" "));
})(require("fs").readFileSync("/dev/stdin","utf8"));
//  [go]
package main

import (
	"fmt"
)

const MOD = 1000000007

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	idx, value int
	a, b       int
	index      int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int) int {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int) int {
	return a * b / GCD(a, b)
}

func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	sum := 0
	odd := 0
	even := 0
	A := make([]int, N)
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		A[i] = a
		sum += a
		if (i+1)%2 == 0 {
			even += a
		} else {
			odd += a
		}
	}
	for i := 0; i < N; i++ {
		idx := i + 1
		if idx%2 == 0 {
			fmt.Print(sum - 2*odd)
			odd += A[i]
			even -= A[i]
		} else {
			fmt.Print(sum - 2*even)
			odd -= A[i]
			even += A[i]
		}
		fmt.Print(" ")
	}
	fmt.Println(" ")

}

func Reverse(runes []rune) []rune {
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return runes
}
//  [go]
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}

	d := make([]int, n)
	sum := 0
	for i := range a {
		sum += a[i]
	}
	sum2 := 0
	for i := 1; i <= n-1; i += 2 {
		sum2 += a[i]
	}
	d[0] = sum - 2*sum2
	for i := 1; i < n; i++ {
		d[i] = 2*a[i-1] - d[i-1]
	}

	for i := range d {
		fmt.Print(d[i])
		if i != n-1 {
			fmt.Print(" ")
		} else {
			fmt.Println()
		}
	}
}
//  [go]
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Sat Jul 13 12:57:12 2019
//
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	arr := make([]int, n)

	s := 0
	for i := range arr {
		fmt.Scan(&arr[i])
		s += arr[i]
	}

	ans := []int{}
	sum := 0
	for i := 1; i < len(arr); i += 2 {
		sum += arr[i]
	}
	ans = append(ans, s-2*sum)

	for i := 1; i < len(arr); i++ {
		ans = append(ans, 2*arr[i-1]-ans[i-1])
	}

	for i := range ans {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(ans[i])
	}
	fmt.Println()
}
//  [ruby]
N = gets.to_i
DAMS = gets.split.map(&:to_i)

def mountains(first_mountain)
  mountains = [first_mountain]
  (1...N).each do |i|
    next_mountain = (DAMS[i - 1] - mountains.last / 2) * 2
    mountains << next_mountain
  end
  mountains
end

from = (0..DAMS[0] * 2).bsearch { |first_mountain|
  mountains = mountains(first_mountain)
  (mountains.first + mountains.last) / 2 >= DAMS.last
}

puts mountains(from).join(" ")
//  [ruby]
n = gets.to_i
$dams = gets.split.map(&:to_i)

def mountains(start)
  mountains = [start]
  $dams.each do |dam|
    next_mountain = (dam - mountains.last / 2) * 2
    # return true if next_mountain < 0
    mountains << next_mountain
  end
  return false if mountains.first < mountains.last
  return true if mountains.first > mountains.last
  mountains
end

def b_search (min, max)
  mid = (min + max) / 2
  mid += 1 if mid.odd?
  if mid == max
    res = mountains(max)
    if res == true || res == false
      return mountains(min)
    else
      return res
    end
  end
  res = mountains(mid)
  if res == false
    min = mid
  elsif res == true
    max = mid
  else
    return res
  end
  b_search(min, max)
end

res = b_search(0, $dams.first * 2)
res.pop
puts res.join(" ")
//  [ruby]
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)

sum = a.inject(:+)
kisu = 0
gusu = 0
for i in 0..n-1
  kisu += a[i%n] if i%2 == 0
  kisu -= a[i%n] if i%2 != 0
  gusu += a[(i+1)%n] if i%2 == 0
  gusu -= a[(i+1)%n] if i%2 != 0
end
ans = [kisu,gusu]
for i in 0..n-1
  if i % 2 == 0
    puts ans[0]
    ans[0] = ans[0] - 2*a[i%n] + 2 * a[(1+i)%n]
  else
    puts ans[1]
    ans[1] = ans[1] - 2*a[i%n] + 2 * a[(1+i)%n]
  end
end
//  [rust]
use std::io::prelude::*;

fn input<T>() -> T
    where T: std::str::FromStr {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let a: Vec<i64> =
        (0..n).map(|_| input::<i64>() * 2).collect();
    let mut a2 = 0;
    for i in 0..n {
        if i%2==0 {
            a2+=a[i];
        } else{
            a2-=a[i];
        }
    }
    println!("{}", a2/2);
    let mut t = a2/2;
    for i in 0..n-1{
        t = a[i] - t;
        println!("{}", t);
    }
}
//  [rust]
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports)]

use std::cmp::*;
use std::collections::*;

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        N : usize,
        A : [usize; N]
    }
    let a2 = {
        let mut a2 = Vec::new();
        for a in A {
            a2.push(a * 2);
        }
        a2
    };
    let x = {
        let mut offset = 0usize;
        for a in &a2 {
            offset = a - offset;
        }
        offset / 2
    };

    let mut current = x;
    for a in a2 {
        println!("{}", current);
        current = a - current;
    }
}
//  [python]
from collections import defaultdict

if __name__ == '__main__':
    mod = 10**9 +7
    N = int(input())
    S = str(input())

    letter = defaultdict(int)
    letter_count = defaultdict(int)
    count = 0
    for i in range(N):
        new_count = count + 1
        new_count -= letter[S[i]] #今まで追加文字が使われている組み合わせはNG
        count += new_count
        letter[S[i]] += new_count #追加文字が追加されたことによる組み合わせ増分を増やす
        #追加文字による、他のある文字が使われる組み合わせの増加は
        #今まである文字が使われていた組み合わせの数-ある数が使われていてかつ追加文字が含まれている組み合わせ
        for key in letter:
            if key != S[i]:
                letter[key] += letter[key]//(1 + letter_count[S[i]])
        letter_count[S[i]] += 1
    print(count%mod)
//  [python]
import collections

n = int(input())
s = input()
cnt = 0
dictionary = {}

for i in range(n)[::-1]:
  if s[i] in dictionary.keys():
    dictionary[s[i]] += 1
  else:
    dictionary[s[i]] = 1
  ch = s[i:]
  tmp_cnt = 1
  for k,v in dictionary.items():
    if k != s[i]:
      tmp_cnt *= (v+1)
  cnt += tmp_cnt % (10**9+7)
print(cnt % (10**9+7))
//  [python]
from collections import defaultdict
import bisect as bs
MOD = 10**9 + 7
L = int(input())
S = input()
dic, l_dic = defaultdict(list), {}
for i in range(L):
    dic[S[i]].append(i)
ans = 0
for key in dic:
    l_dic[key] = len(dic[key])
for i in range(L):
    sub = 1
    for key in dic:
        if key == S[i]:
            continue
        sub = sub * (l_dic[key] - bs.bisect_right(dic[key], i) + 1) % MOD
    ans = (ans + sub) % MOD
print(int(ans))
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	static String S;

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

		solve();
	}

	static void solve() {
		char[] c_array = S.toCharArray();
		
		int[] sum = new int['z'- 'a' + 1];
		for(int idx = 0; idx < c_array.length; idx++) {
			sum[c_array[idx] - 'a']++;
		}
		
		long ans = 0;
		
		long[] conv = new long[1 << 26];
		Arrays.fill(conv, -1);
		conv[0] = 1;
		
		int max = 1 << 26;
		
		for(int bit = 1; bit < max; bit++) {
			conv[bit] = 0;
			
			for(int idx = 0; idx < 26; idx++) {
				int b_idx = 1 << idx;
				if((bit & b_idx) > 0) {
					conv[bit] = (conv[bit - b_idx] * sum[idx]) % 1000000007;
					break;
				}
			}
			
			ans = (ans + conv[bit]) % 1000000007;
		}
		
		System.out.println(ans);
	}
	

	static void readInput() {
		try (Scanner sc = new Scanner(System.in)) {
			sc.nextLine();
			S = sc.nextLine();
		}
	}
}
//  [java]
import java.util.*;
import java.io.*;

class Mod{
    static final int MOD = 1000_000_007;
    static final long[] fact = makeFactorialArray(1000000);
    static final long[] factInv = makeInversedArray(fact);

    public static long add(long a, long b){
        long tmp = (a+b)%MOD;
        return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long sub(long a, long b){
        return add(a,-b);
    }
    public static long mult(long a, long b){
        long tmp = (a*b)%MOD;
        return tmp>=0 ? tmp : tmp+MOD;
    }
    public static long power(long a, long x){ //calculate a^x
        if(x<0)return 0;
        if(x==0)return 1;
        if(x%2==0) {
            long half = power(a,x/2);
            return mult(half,half);
        }
        return (a*power(a,x-1)) % MOD;
    }
    public static long inverse(long a){
        return power(a,MOD-2);
    }
    public static long div(long a, long b){
        return mult(a, inverse(b));
    }
    public static long[] makeFactorialArray(int size){
        long[] array = new long[size];
        array[0]=1;
        for(int i=1;i<size;i++){
            array[i]=mult(array[i-1],i);
        }
        return array;
    }
    public static long[] makeInversedArray(long[] original){
        long[] array = new long[original.length];
        for(int i=0;i<original.length;i++){
            array[i] = inverse(original[i]);
        }
        return array;
    }
    public static long combination(int n, int r){
        if(n<0 || r<0 || n<r) return 0;
        return mult(fact[n], mult(factInv[r],factInv[n-r]));
    }
    public static long gcd(long a, long b){
        if(a<b) return gcd(b,a);
        if(b==0) return a;
        if(a%b==0) return b;
        return gcd(b,a%b);
    }
    public static long lcm(long a, long b){
        return (a/gcd(a,b))*b;
    }

}

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();

        int[] charCount = new int[26];
        for(int n=0; n<N; n++) charCount[S.charAt(n)-'a']++;

        long ans = 1;
        for(int i=0; i<26; i++) ans = Mod.mult(ans, 1+charCount[i]);
        System.out.println(Mod.sub(ans, 1));
    }
}
//  [java]
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

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

	public void run() {
		final Scanner scanner = new Scanner(System.in);
		final int counter = scanner.nextInt();
		scanner.nextLine();
		final char[] charSequence = scanner.nextLine().toCharArray();

		final Map<Integer, MyLong> wordCount = new HashMap<>();
		for (int index = 0; index < counter; index++) {
			wordCount.computeIfAbsent(Integer.valueOf(charSequence[index]) % 26, e -> new MyLong()).increment();
		}

		final List<MyLong> longs = new ArrayList<>(wordCount.values());

		long answer = 1;
		for (MyLong value : longs) {
			answer *= value.getValue() + 1;
			answer %= 1000000007;
		}

		--answer;
		System.out.println(answer);

		scanner.close();

	}

	class MyLong {
		private long value;

		public MyLong() {
			this.value = 0;
		}

		public void increment() {
			this.value++;
		}

		public long getValue() {
			return this.value;
		}
	}

}
//  [cpp]
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

void OutputError(std::string s) {
  cerr << "\033[93m" << s << "\033[m" << endl;
  return;
}

struct State {
  int considered = 0;
  int64_t amount = 0;
};

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  const int64_t MOD = std::pow(10, 9) + 7;
  std::string s;
  cin >> n >> s;
  int64_t count[26] = {};
  int64_t result    = 0;
  for (auto c : s) {
    count[c - 'a']++;
  }

  for (int begin = 0; begin < 26; begin++) {
    std::queue<State> q;
    State origin;
    origin.considered = begin;
    origin.amount     = count[begin];
    q.push(origin);
    while (!q.empty()) {
      State target = q.front();
      q.pop();
      if (target.considered == 25) {
        result = (result + target.amount) % MOD;
      } else {
        State added = target;
        added.considered++;
        added.amount *= count[added.considered];
        added.amount = added.amount % MOD;
        q.push(added);
        State not_added = target;
        not_added.considered++;
        q.push(not_added);
      }
    }
  }

  cout << result << endl;

  return 0;
}
//  [cpp]
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;
#define MOD 1000000007

int main(void){
 int N;
 long long int ans=1;
 long long int cnt[100050];
 char s[100050];

 cin>>N;
 cin>>s;
 for(int i=0;i<=100040; i++)cnt[i]=0;
 for(int i=0; i<strlen(s);i++)cnt[s[i]-'a']++;
 
 for(int i=0; i<26; i++)ans=(ans*(cnt[i]+1))% MOD;
 cout<<(ans-1)%MOD<<endl;

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

#define P 1000000007


int ctr[26], index[26], index_num = 0;

long long int accum = 0;


void trace(long long int product, int level, int level_num, int pos)
{
    int i;
    
    
    if(level == level_num)
    {
        accum += product;
        accum %= P;
    }
    else
    {
        for(i=pos; i<index_num && level_num-level<=index_num-i; i++)
        {
            trace((product*ctr[index[i]])%P, level+1, level_num, i+1);
        }
    }
}

int main(void)
{
    int N;
    char *S;
    int i;
    
    
    scanf("%d", &N);
    
    S = (char*)malloc(sizeof(char)*(N+1));
    
    scanf("%s", S);
    
    
    for(i=0; i<26; i++)
    {
        ctr[i] = 0;
    }
    
    for(i=0; i<N; i++)
    {
        switch(S[i])
        {
            case 'a':
                ctr[0]++;
                break;
            case 'b':
                ctr[1]++;
                break;
            case 'c':
                ctr[2]++;
                break;
            case 'd':
                ctr[3]++;
                break;
            case 'e':
                ctr[4]++;
                break;
            case 'f':
                ctr[5]++;
                break;
            case 'g':
                ctr[6]++;
                break;
            case 'h':
                ctr[7]++;
                break;
            case 'i':
                ctr[8]++;
                break;
            case 'j':
                ctr[9]++;
                break;
            case 'k':
                ctr[10]++;
                break;
            case 'l':
                ctr[11]++;
                break;
            case 'm':
                ctr[12]++;
                break;
            case 'n':
                ctr[13]++;
                break;
            case 'o':
                ctr[14]++;
                break;
            case 'p':
                ctr[15]++;
                break;
            case 'q':
                ctr[16]++;
                break;
            case 'r':
                ctr[17]++;
                break;
            case 's':
                ctr[18]++;
                break;
            case 't':
                ctr[19]++;
                break;
            case 'u':
                ctr[20]++;
                break;
            case 'v':
                ctr[21]++;
                break;
            case 'w':
                ctr[22]++;
                break;
            case 'x':
                ctr[23]++;
                break;
            case 'y':
                ctr[24]++;
                break;
            case 'z':
                ctr[25]++;
                break;
        }
    }
    
    for(i=0; i<26; i++)
    {
        if(ctr[i] > 0)
        {
            index[index_num++] = i;
        }
    }
    
    
    for(i=1; i<=index_num; i++)
    {
        trace(1, 0, i, 0);
    }
    
    
    printf("%lld\n", accum);
        
        
    free(S);

    //system("pause");
    
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define DEBUG 0
#define NINF -1
#define PINF 1E9+7

#define MAX_INPUT 100000
#define ATOZ 26

int n,count[ATOZ]={},species=0;
char *s;

int main()
{
	int i,j;
	long ans=0,tmp;

	scanf("%d",&n);
	s = (char *)malloc(sizeof(char) * (n+1));
	scanf("%s",s);

	for (i=0;i<n;i++) {
		if (count[s[i]-'a']==0) species++;
		count[s[i]-'a']++;
		
		tmp = 1;
		for (j=0;j<ATOZ;j++) {
			if (count[j]==0) continue;
			if (j==s[i]-'a') continue;

			tmp *= count[j]+1;
			tmp = fmod(tmp,PINF);
		}
		if (DEBUG) printf("tmp = %ld\n",tmp);
		ans = fmod(ans + tmp , PINF);
	}


	printf("%ld\n",ans);
	free(s);
	return 0;
}
//  [c]
#include<stdio.h>

#define mod 1000000007

int main(){
	int n,i,j;
	char s[100000];
	long long ko[2][27]={0};
	long long ans=0;
	scanf("%d%s",&n,s);
	for(i=n-1;i>=0;i--){
		long long tmp=1;
		for(j=0;j<27;j++)ko[i%2][j]=0;
		ko[i%2][s[i]-'a']++;
		for(j=0;j<27;j++){
			ko[i%2][j]+=ko[(i+1)%2][j];
			if(s[i]-j!='a')tmp*=ko[i%2][j]+1;
			tmp=tmp%mod;
		}
		ans+=tmp;
		ans=ans%mod;
	}
	printf("%lld\n",ans);
	return 0;
}
//  [javascript]
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
var mod = 1e9+7;
//"a".charCodeAt()//97

console.log(main());
function main(){
  var n = o.a();
  var s = o.a(1);
  var ans = 1;
  var a = Array(26).fill(0);
  for(var i = 0; i < n; i++){
    var t = s[i].charCodeAt()-97;
    a[t]++;
  }
  for(i = 0; i < 26; i++){
    ans *= a[i] + 1;
    ans %= mod;
  }
  return ans-1;
}
//  [javascript]
Array.prototype.aggregate = function(){
  	return this.reduce((a,b)=>(a[b]=(a[b]||0)+1)&&a,{});
 }
 
 
function Main(input){
var mod = 1000000007;


	input = input.split("\n");
  var N = ~~input[0];
  var S = input[1];
  
  S = S.split("").aggregate();
  
  var num = 1;
  
  for (var p in S) {
  	num *= (S[p] + 1);
    num %= mod;
  }
  
  return num - 1;
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
3
baa
`);
//  [go]
package main

import (
  "fmt"
  "strings"
)



func main() {
  var n int
  var s string
  fmt.Scanf("%v", &n)
  fmt.Scanf("%s", &s)
  ss := strings.Split(s, "")

  var count_ [26]int
  for _, v := range ss {
    i := v[0] - 'a'
    count_[i] += 1
  }

  sum := 1
  for _, v := range count_ {
    sum = sum * (1+v)
    if sum > 1000000007 {sum = sum%1000000007}
  }
  sum -= 1
  fmt.Print(sum)
}
//  [go]
package main

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

const mod = 1000000007

func solve() {
	_ = getInt()
	s := []rune(getString())

	m := make(map[rune]int, 26)
	for _, r := range s {
		m[r]++
	}

	ans := 0
	for _, r := range s {
		cnt := 1
		for k, v := range m {
			if r == k {
				continue
			}

			cnt = (cnt * (v + 1)) % mod
		}

		m[r]--
		ans = (ans + cnt) % mod
	}

	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	buf := 200001
	sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

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

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}
//  [ruby]
N = gets.to_i
S = gets.chomp
MOD = 10 ** 9 + 7

counter = Hash.new(0)

ans = 0

S.each_char do |s|
  c = 1

  counter.each do |key, v|
    next if key == s

    t = v + 1

    c = (c * t) % MOD
  end

  ans = (ans + c) % MOD
  counter[s] += 1
end

puts ans
//  [ruby]
n = gets.to_i
s = gets.chomp!
ans = 1
prime = 1000000007
array = []
("a".."z").each { |c|
  array.push([c,0])
}
s.chars { |c|
  array.each { |a|
    if a[0] == c
      a[1] += 1
    end
  }
}

# p array

array.each { |a|
  ans *= (a[1]+1)
  ans = ans % prime
}
puts ans-1
//  [ruby]
n = gets.to_i
s = gets.split("").map(&:to_s)
alphabets = "abcdefghijklmnopqrstuvwxyz"
alphabets_ary = alphabets.split("").map(&:to_s)
alphabets_counts = []
alphabets_ary.each do |alphabet|
  alphabets_counts.push(s.count(alphabet))
end
options = 1
alphabets_counts.each do |alphabets_count|
  options *= (alphabets_count + 1)
end
options -= 1
puts options % (10 ** 9 + 7)
//  [rust]
use std::collections::HashMap;
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
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 m = 1000_000_000 + 7;
    let n: usize = read();
    let s: Vec<char> = read::<String>().chars().collect();
    let mut map = HashMap::new();
    let mut ret: u64 = 1;
    for c in s.iter() {
        let count = map.entry(c).or_insert(0);
        *count += 1;
    }
    for (_, value) in map {
        ret *= value + 1;
        ret %= m;
    }
    println!("{}", (ret + m - 1) % m);
}
//  [rust]
use std::char::from_u32;
use std::collections::HashMap;
fn main() {
    let MOD: u128 = 10u128.pow(9) + 7;
    let n = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let n: u32 = buf
            .trim_end()
            .to_owned()
            .split_whitespace()
            .next()
            .unwrap()
            .parse()
            .unwrap();
        n
    };
    let s = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let s = buf.trim_end().to_owned();
        s
    };

    let mut map: HashMap<char, u128> = HashMap::new();
    for i in 0..26 {
        let c = from_u32('a' as u32 + i).unwrap();
        map.insert(c, 0);
    }

    for c in s.chars() {
        map.insert(c, map.get(&c).unwrap() + 1);
    }
    let mut ans: u128 = 1;
    for v in map.values() {
        ans *= *v + 1;
        ans %= MOD;
    }
    println!("{}", (ans - 1) % MOD)
}
//  [rust]
use proconio::{input, marker::Chars};
use std::collections::HashMap;

const MOD: usize = 1_000_000_007;

fn main() {
    input! {
        _n: usize,
        s: Chars,
    }

    let mut ans = 1;

    let mut map = HashMap::new();
    for c in s {
        *map.entry(c).or_insert(0) += 1;
    }

    for (_, val) in map {
        
        ans *= val+1;
        ans %= MOD;
    }

    ans += MOD;
    ans -= 1;
    ans %= MOD;

    println!("{}", ans);
}
//  [python]
# -*- coding: utf-8 -*-
# kakomon toku
import math
import sys
import itertools
import numpy as np

a,b,c,d = map(int, input().split())

if abs(a-c)<=d :
    print("Yes")
elif abs(a-b)<=d and abs(b-c)<=d :
    print("Yes")
else:
    print("No")
//  [python]
a,b,c,d = map(int, raw_input().split())
print 'Yes' if abs(c -a)<=d or (abs(b-a)<=d and abs(c - b)<=d) else 'No'
//  [python]
from sys import stdin
import bisect
from itertools import accumulate
import numpy as np

a,b,c,d= [int(x) for x in stdin.readline().rstrip().split()]

if abs(a-c) <= d:
    print("Yes")
elif abs(a-b)<= d and abs(b-c) <= d:
    print("Yes")
else:
    print("No")
//  [java]

import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args){
        final Scanner sc = new Scanner(System.in);
        final int a = sc.nextInt();
        final int b = sc.nextInt();
        final int c = sc.nextInt();
        final int d = sc.nextInt();

        if(Math.abs(a-c) <= d) {
            System.out.println("Yes");
            return;
        }

        int[] xs = IntStream.of(a, b, c).sorted().toArray();
        if(Math.abs(xs[0]-xs[1])<=d && Math.abs(xs[1]-xs[2])<=d) {
            System.out.println("Yes");
            return;
        }

        System.out.println("No");
    }
}
//  [java]
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] sarr = br.readLine().split(" ");
        int[] iarr    = Stream.of(sarr).mapToInt(Integer::parseInt).toArray();
        if (canConverse(iarr)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
    static boolean canConverse(int[] iarr) {
        int a = iarr[0];
        int b = iarr[1];
        int c = iarr[2];
        int d = iarr[3];
        if (Math.abs(a - c) <= d) {
            return true;
        } else if (Math.abs(a - b) <= d && Math.abs(b - c) <= d ) {
            return true;
        }
        return false;
    }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int d = scanner.nextInt();
        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");
        }
    }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
 
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  string ans="No";
  if(abs(a-c)<=d)ans="Yes";
  if(abs(a-b)<=d&&abs(b-c)<=d)ans="Yes";
  cout<<ans<<endl;
  return 0;
}
//  [cpp]
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
   ll dp[2000000];
 int gcd(int a, int b)
{
  if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b,a%b));
}
}
int main(){
  ll a,b,c,d;cin>>a>>b>>c>>d;
  if(abs(c-a)<=d)cout<<"Yes";
  else if(abs(b-a)<=d&&abs(c-b)<=d)cout<<"Yes";
  else cout<<"No";
}
//  [cpp]
#include <bits/stdc++.h>
#define rep( i, n ) for( int ( i ) = 0; ( i ) < ( n ); ( i )++ )
#define repr( i, n ) for( int ( i ) = ( n ); ( i ) >= 0; ( i )-- )
#define FOR( i, m, n ) for( int ( i ) = ( m ); ( i ) < ( n ); ( i )++ )
#define all( x ) ( x ).begin(), ( x ).end()
typedef long long lint;
using namespace std;
 
int main( void ){
	
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	if( abs( a - c ) <= d or abs( a - b ) <= d and abs( b - c ) <= d ){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	
	return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
  int a, b, c, d, ab, bc, ca;

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

  ab = abs(a - b);
  bc = abs(b - c);
  ca = abs(c - a);

  if((ab <= d && bc <= d) || ca <= d){
    printf("Yes");
  }
  else{
    printf("No");
  }

  return 0;

}
//  [c]
#define _CRT_SECURE_NO_WARNINGS

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

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)
#define FOR(i,s,n) for(int i=(int)(s),i##_len=(int)(n);i<i##_len;i++)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTL(d) printf("%lld\n",(d))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

#define INF 1e9

typedef long long ll;
int diff[4][2] = {
	{ 0, -1 },
	{ -1, 0 },
	{ 1, 0 },
	{ 0, 1 },
};

int Min(int a, int b) {
	return (a)<(b) ? (a) : (b);
}
int Max(int a, int b) {
	return (a) > (b) ? (a) : (b);
}
void Swap(int *a, int *b) {
	int tmp = *a;
	*a = *b;
	*b = tmp;
}

int main() {
	int a, b, c, d;
	scanf("%d %d %d %d", &a, &b, &c, &d);
	if ((abs(a - b) <= d&&abs(b - c) <= d)||abs(a-c)<=d) {
		puts("Yes");
	}
	else {
		puts("No");
	}
}
//  [c]
#include<stdio.h> 
#include<stdlib.h> 
int main() 
{ 
int a,b,c,d,x,y,z; 
scanf("%d%d%d%d",&a,&b,&c,&d); 
x=abs(a-b); 
y=abs(b-c); 
z=abs(c-a); 
if((x<=d&&y<=d)||z<=d)printf("Yes\n"); 
else printf("No\n"); 
return 0; 
}
//  [javascript]
'use strict';

function Main(input) {
  const list = input.split(' ');
  let dis_a_c = Math.abs(Number(list[2]) - Number(list[0]));
  let dis_a_b = Math.abs(Number(list[1]) - Number(list[0]));
  let dis_b_c = Math.abs(Number(list[2]) - Number(list[1]));
  let okdis = Number(list[3]);

  if(dis_a_c <= okdis) {
    console.log('Yes')
  }
  else if(dis_a_b <= okdis && dis_b_c <= okdis) {
    console.log('Yes');
  }
  else {
    console.log('No');
  }
  
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [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 dif_ac = Math.abs(a - c);
    if (dif_ac <= d) {
        console.log("Yes");
    }
    else {
        var dif_ab = Math.abs(a - b);
        var dif_bc = Math.abs(b - c);
        if (dif_ab <= d && dif_bc <= d) {
            console.log("Yes");
        }
        else {
            console.log("No");
        }
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {

	input = input.split(" ");
	var a = input[0];
	var b = input[1];
	var c = input[2];
	var d = input[3];
	
	if(Math.abs(b - a) <= d && Math.abs(c - b) <= d || Math.abs(a - c) <= d){
		console.log("Yes");
	} else {
		console.log("No");
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [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-c) <= d || abs(a-b) <= d && abs(b-c) <= d {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b, c, d := intScanner(), intScanner(), intScanner(), intScanner()
	if abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}

}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for A - Colorful Transceivers
	var a, b, c, d float64
	fmt.Scanf("%f %f %f %f", &a, &b, &c, &d)

	if math.Abs(a-c) <= d || (math.Abs(a-b) <= d && math.Abs(b-c) <= d) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [ruby]
a,b,c,d = gets.chomp.split(" ").map(&:to_i)
puts ((c - a).abs <= d || ((a - b).abs <= d && (b - c).abs <= d)) ? "Yes" : "No"
//  [ruby]
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A, B, C, D = get_ints

puts (C-A).abs <= D || ((C-B).abs <= D && (B-A).abs <=D) ? 'Yes' :'No'
//  [ruby]
a,b,c,d=gets.split.map(&:to_i)
puts (a-c).abs>d&&((b-c).abs>d||(a-b).abs>d) ?"No":"Yes"
//  [rust]
use proconio::input;

fn main() {
    input! {
        a: i32,
        b: i32,
        c: i32,
        d: i32,
    }

    if (a - c).abs() <= d {
        println!("Yes");
        return;
    }

    if (a - b).abs() <= d && (b - c).abs() <= d {
        println!("Yes");
        return;
    }

    println!("No");
}
//  [rust]
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]
 
use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;
 
use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;

    input!{ a: isize, b: isize, c: isize, d: isize, }

    let flag = if (a - c).abs() <= d {
        true
    } else if (a - b).abs() <= d && (b - c).abs() <= d {
        true
    } else {
        false
    };

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

fn main() {
    solve();
}
//  [rust]
fn main() {
    proconio::input! {
        a: i32,
        b: i32,
        c: i32,
        d: i32,
    }
    let f=|i:i32,j:i32|(i-j).abs()<=d;
    println!("{}",if f(a,c) || (f(a,b)&&f(b,c)) {"Yes"} else {"No"});
}
//  [typescript]
import { readFileSync } from "fs";

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

const main = (input: string[][]) => {
  const [a, b, c, d] = input[0].map(Number);

  return Math.abs(a - c) <= d || (Math.abs(a - b) <= d && Math.abs(b - c) <= d)
    ? "Yes"
    : "No";
};

console.log(main(read()));
//  [typescript]
import { isAbsolute } from 'path';

class Scanner {
  private buffer = '';
  private stdinQueue: any = [];

  constructor() {
    process.stdin.resume();
    process.stdin.setEncoding('utf8');
    process.stdin.on(
      'data',
      (chunk): void => {
        this.buffer += chunk;
        while (this.stdinQueue.length > 0) {
          const i = this.buffer.indexOf('\n');
          if (i < 0) {
            break;
          }
          let line = this.buffer.substr(0, i);
          if (line.endsWith('\r')) {
            line = line.slice(0, -1);
          }
          this.buffer = this.buffer.substr(i + 1);
          this.stdinQueue.shift()(line);
        }
      },
    );
  }
  public getLine(): Promise<string> {
    return new Promise((resolve, reject) => {
      const i = this.buffer.indexOf('\n');
      if (i >= 0 && this.stdinQueue.length == 0) {
        let line = this.buffer.substr(0, i);
        if (line.endsWith('\r')) {
          line = line.slice(0, -1);
        }
        this.buffer = this.buffer.substr(i + 1);
        resolve(line);
      } else {
        this.stdinQueue.push(resolve);
      }
    });
  }

  public close(): void {
    process.stdin.pause();
  }
}

async function slove() {
  const sc = new Scanner();
  const [a, b, c, d]: number[] = (await sc.getLine()).split(' ').map((x) => +x);
  if (Math.abs(a - c) <= d || (Math.abs(a - b) <= d && Math.abs(b - c) <= d)) {
    console.log('Yes');
  } else {
    console.log('No');
  }
  sc.close();
}

slove();
//  [typescript]
"use strict";
new Promise(resolve => {
  resolve(require("fs").readFileSync("/dev/stdin", "utf8").split(/\s/));
}).then(input => {
  const [a, b, c, d] = input.map(x => Number(x));
  const A2B = Math.abs(b - a);
  const B2C = Math.abs(c - b);
  const A2C = Math.abs(c - a);
  const ans = ((A2B <= d && B2C <= d) || A2C <= d) ? "Yes" : "No";
  console.log(ans);
});
//  [python]
import math
from decimal import *


def read():
    N, K = list(map(int, input().strip().split()))
    return N, K


def solve(N, K):
    # 得点nのとき、x回連続で表が出たらK以上になる
    getcontext().prec = 10
    prob = []
    for n in range(1, N+1):
        x = max(0, math.ceil(math.log2(K / n)))
        prob.append(Decimal.from_float(0.5) ** Decimal(x))
    return sum(prob) / Decimal(N)


if __name__ == '__main__':
    inputs = read()
    print("%.10f" % solve(*inputs))
//  [python]
N,K = map(int,input().split())

from fractions import Fraction

probability = Fraction(1, N)
probability_total = 0

for i in range(N):
    count = 0
    point = i + 1
    while K > point:
        count += 1
        point = point * 2
    probability_total = probability_total + probability * Fraction(1, 2) ** count

print(float(probability_total))
//  [python]
from fractions import Fraction
from decimal import Decimal

n, k = input().split(" ")
n = int(n)
k = int(k)

ans = 0
for i in range(1, n + 1):
    j = i
    times = 0
    while j < k:
        j *= 2
        times += 1
    x = Fraction(1, n) * Fraction(1, 2 ** times)
    ans += x
print("{:.10f}".format(Decimal(ans.numerator) / Decimal(ans.denominator)))
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.RoundingMode;

public class Main {
	public static void main(String[] args) {
		try {
			String[] input = new BufferedReader(new InputStreamReader(System.in)).readLine().split(" ");
			int faces = Integer.parseInt(input[0]);
			int target = Integer.parseInt(input[1]);
			BigDecimal rate = BigDecimal.ZERO;
			for (int i = 1; i <= faces; i++) {
				int cnt = 0;
				int sum = i;
				while(sum < target) {
					sum += sum;
					cnt++;
				}
				rate = rate.add(BigDecimal.valueOf(Math.pow(0.5, cnt) / faces));
			}
			System.out.println(rate.setScale(10, RoundingMode.HALF_UP));
		} catch (IOException e1) {
		}
	}
}
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.math.BigDecimal;
 
public class Main {
	
    public static void main(String[] args) {
    	FastScanner sc = new FastScanner();
 
    	int n = sc.nextInt();
    	int k = sc.nextInt();
    	
    	BigDecimal sum = BigDecimal.valueOf(0);
    	
    	for(int i=1; i<=n; i++){
    		if(i>=k){
    			sum = sum.add(BigDecimal.valueOf((double)1/(double)n));
    		}
    		else{
    			double need = (double)k / (double)i;
        		double x = Math.log(need) / Math.log(2);
        		int y = (int) Math.ceil(x);
        		sum = sum.add(iterationPow(BigDecimal.valueOf((double)1/(double)n),BigDecimal.valueOf(0.5),y));
        		
    		}
    	}
    
    	System.out.println(sum);
    }
    
	static BigDecimal iterationPow(BigDecimal moto,BigDecimal x, long n){
	    BigDecimal sum = moto;
	    while(n>0){
	        if((n&1)== 1){  //ビットが立っていたら
	            sum = sum.multiply(x);
	        }
	        x = x.multiply(x);
	        n >>= 1;
	    }
	    return sum;
	}
	
}
 
 
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());}
}