package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var testCase int

	_, err := fmt.Fscanf(input, "%d\n", &testCase)
	if err != nil {
	}

	for testCase > 0 {
		testCase--

		var n, m, k int
		_, err := fmt.Fscanf(input, "%d %d %d\n", &n, &m, &k)
		if err != nil {
		}

		var h = make([]int, n)
		for i := 0; i < n; i++ {
			_, err := fmt.Fscanf(input, "%v", &h[i])
			if err != nil {
			}
		}
		_, err = fmt.Fscanf(input, "\n")
		if err != nil {
		}

		for i := 0; i < n; i++ {
			if i == n-1 {
				fmt.Println("YES")
				break
			}
			if h[i] <= h[i+1] {
				// i 个柱子比 i+1 个柱子低
				if h[i+1]-h[i] <= k {
					// i 个柱子比 i+1 个柱子 低 k 内
					if k > h[i+1] {
						m += h[i]
						continue
					}
					m += h[i] + k - h[i+1]
					continue
				} else if h[i+1]-h[i]-m <= k {
					// i 个柱子比 i+1 个柱子 低 k 外, 包内往外拿
					m += h[i] + k - h[i+1]
					continue
				} else {
					fmt.Println("NO")
					break
				}
			} else if h[i] > h[i+1] {
				// i 个柱子比 i+1 个柱子 高，外包里放
				if h[i+1] < k {
					// i 个柱子比 i+1 个柱子 高，外包里放, 第 i+1 个柱子比 k 低
					m += h[i]
					continue
				}
				m += h[i] + k - h[i+1]
				continue
			}
		}
	}

}

package main

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

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		total int
		n     int
		m     int
		k     int
	)

	_, _ = fmt.Fscan(input, &total)

	for total > 0 {
		total -= 1

		_, _ = fmt.Fscan(input, &n, &m, &k)
		heights := make([]int, n)
		for i := 0; i < n; i += 1 {
			_, _ = fmt.Fscan(input, &heights[i])
		}

		win := true
		for i := 1; i < n; i += 1 {
			if heights[i-1] >= heights[i] {
				// 0o
				m += heights[i-1] - heights[i]
				if k > heights[i] {
					m += heights[i]
				} else {
					m += k
				}

			} else {
				// o0
				if heights[i]-heights[i-1] <= k {
					if k > heights[i]{
						m += heights[i-1]
					} else {
						m += k - (heights[i] - heights[i-1])
					}
				} else {
					if absInt(heights[i]-heights[i-1], k) <= m {
						m -= absInt(heights[i]-heights[i-1], k)
						if m < 0 {
							win = false
							break
						}
					} else {
						win = false
						break
					}
				}
			}
		}

		if win {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

// 1200
// 27.05.2020
// https://codeforces.com/problemset/problem/1200/B

func main() {
	var t int
	fmt.Scanln(&t)

	r := bufio.NewReader(os.Stdin)
LOOP:
	for tt := 0; tt < t; tt++ {
		var n, m, k int
		fmt.Fscanln(r, &n, &m, &k)
		b, _, err := r.ReadLine()
		if err != nil {
			panic(err)
		}
		str := string(b)

		strs := strings.SplitN(str, " ", n)

		next, cur := -1, -1
		for i := 0; i < n; i++ {
			cur = next
			var err error
			next, err = strconv.Atoi(strs[i])
			if err != nil {
				panic(err)
			}

			if cur == -1 {
				continue
			}
			u := next - k
			if u < 0 {
				u = 0
			}
			m += cur - u
			if m < 0 {
				fmt.Println("NO")
				continue LOOP
			}
		}
		fmt.Println("YES")
	}
}

package main

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

func main() {
	defer Flush()

	t := readi()
	for i := 0; i < t; i++ {
		n := readi()
		m := readll()
		k := readll()
		_, h := readIntsll(n)
		if solve(n, m, k, h) {
			println("YES")
		} else {
			println("NO")
		}
	}
}

func solve(n int, m, k int64, h []int64) bool {
	for i := 0; i+1 < n; i++ {
		b := maxll(0, h[i+1]-k)
		m += h[i] - b
		if m < 0 {
			return false
		}
	}
	return true
}

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

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

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

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

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

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

// reverse slice in place
func reverse(a []int) {
	for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 {
		a[i], a[j] = a[j], a[i]
	}
}

// areverse: allocating reverse
func areverse(a []int) []int {
	b := make([]int, len(a))
	for i := range a {
		b[i] = a[len(a)-i-1]
	}
	return b
}

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

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

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

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		if solveOne() {
			print("YES")
		} else {
			print("NO")
		}
	}
}

func solveOne() bool {
	n, m, k := readInt(), readInt(), readInt()
	cur := readInt()
	for i := 1; i < n; i++ {
		next := readInt()
		enough := next - k
		if enough < 0 {
			enough = 0
		}
		if cur > enough {
			m += cur - enough
		} else {
			m -= enough - cur
		}
		if m < 0 {
			for j := i + 1; j < n; j++ {
				readInt()
			}
			return false
		}
		cur = next
	}
	return true
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

package main
import "fmt"
import "os"
import "bufio"

var input *bufio.Reader

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

func solve() {
    var n, m, k int
    fmt.Fscanf(input, "%d%d%d\n", &n, &m, &k)
    h := make([]int, n)
    for i:=0; i<n; i++ {
        fmt.Fscanf(input, "%d", &h[i])
    }
    fmt.Fscanf(input, "\n")
    for i:=1; i<n; i++ {
        if h[i-1]+m >= h[i]-k {
            if h[i-1]>=h[i]-k {
                m+=h[i-1]-max(0, h[i]-k)
            } else {
                m+=h[i-1]-(h[i]-k)
            }
        } else {
            fmt.Println("NO")
            return
        }
    }
    fmt.Println("YES")
}

func main(){
    input = bufio.NewReader(os.Stdin)
    var T int
    fmt.Fscanf(input, "%d\n", &T)
    for i:=0; i<T; i++ {
        solve()
    }
}

// Author: sighduck
// URL: https://codeforces.com/contest/1200/problem/B

package main

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

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

func Solve(n int, m int, k int, blocks []int) string {
	for i := 0; i < n-1; i++ {
		if blocks[i+1] <= blocks[i] {
			newHeight := max(blocks[i+1]-k, 0)
			blocksToAddOrRemove := blocks[i] - newHeight
			m += blocksToAddOrRemove
		} else if blocks[i+1] > blocks[i] {
			newHeight := max(blocks[i+1]-k, 0)
			blocksToAddOrRemove := newHeight - blocks[i]
			m -= blocksToAddOrRemove
		}
		if m < 0 {
			return "NO"
		}
	}
	return "YES"
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var t int
	fmt.Fscanf(reader, "%d\n", &t)
	for i := 0; i < t; i++ {
		var n, m, k int
		fmt.Fscanf(reader, "%d %d %d\n", &n, &m, &k)
		blocks := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(reader, "%d", &blocks[i])
		}
		fmt.Fscanf(reader, "\n")
		fmt.Fprintf(writer, "%s\n", Solve(n, m, k, blocks))
	}
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		if solveOne() {
			print("YES")
		} else {
			print("NO")
		}
	}
}

func solveOne() bool {
	n, m, k := readInt(), readInt(), readInt()
	cur := readInt()
	for i := 1; i < n; i++ {
		next := readInt()
		enough := next - k
		if cur > enough {
			m += cur - enough
		} else {
			m -= enough - cur
		}
		if m < 0 {
			return false
		}
		cur = next
	}
	return true
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		if solveOne() {
			print("YES")
		} else {
			print("NO")
		}
	}
}

func solveOne() bool {
	n, m, k := readInt(), readInt(), readInt()
	cur := readInt()
	for i := 1; i < n; i++ {
		next := readInt()
		enough := next - k
		if cur > enough {
			m += cur - enough
		} else {
			m -= enough - cur
		}
		if m < 0 {
			return false
		}
		cur = enough
	}
	return true
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

package main

import (
	"bufio"
	"os"
	"runtime"
	"strconv"
)

/* solution */

func solve() {
	t := readInt()
	for i := 0; i < t; i++ {
		if solveOne() {
			print("YES")
		} else {
			print("NO")
		}
	}
}

func solveOne() bool {
	n, m, k := readInt(), readInt(), readInt()
	cur := readInt()
	for i := 1; i < n; i++ {
		next := readInt()
		enough := next - k
		if cur > enough {
			m += cur - enough
		} else {
			m -= enough - cur
		}
		if m < 0 {
			for j := i + 1; j < n; j++ {
				readInt()
			}
			return false
		}
		cur = next
	}
	return true
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

	writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	reader = bufio.NewScanner(f)
	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

package main

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

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		total int
		n     int
		m     int
		k     int
	)

	_, _ = fmt.Fscan(input, &total)

	for total > 0 {
		total -= 1

		_, _ = fmt.Fscan(input, &n, &m, &k)
		heights := make([]int, n)
		for i := 0; i < n; i += 1 {
			_, _ = fmt.Fscan(input, &heights[i])
		}

		win := true
		for i := 1; i < n; i += 1 {
			if heights[i-1] >= heights[i] {
				// 0o
				m += heights[i-1] - heights[i]
				if k > heights[i] {
					m += heights[i]
				} else {
					m += k
				}

			} else {
				// o0
				if heights[i]-heights[i-1] <= k {
					if k-heights[i]-heights[i-1] > heights[i-1] {
						m += heights[i-1]
					} else {
						m += k - heights[i] - heights[i-1]
					}

				} else {
					if absInt(heights[i]-heights[i-1], k) <= m {
						m -= absInt(heights[i]-heights[i-1], k)
						if m < 0 {
							win = false
							break
						}
					} else {
						win = false
						break
					}
				}
			}
		}

		if win {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		total int
		n     int
		m     int
		k     int
	)

	_, _ = fmt.Fscan(input, &total)

	for total > 0 {
		total -= 1

		_, _ = fmt.Fscan(input, &n, &m, &k)
		heights := make([]int, n)
		for i := 0; i < n; i += 1 {
			_, _ = fmt.Fscan(input, &heights[i])
		}

		win := true
		for i := 1; i < n; i += 1 {
			if heights[i-1] >= heights[i] {
				// 0o
				m += heights[i-1] - heights[i]
				if k > heights[i] {
					m += heights[i]
				} else {
					m += k
				}

			} else {
				// o0
				if heights[i]-heights[i-1] < k {
					if k-heights[i]-heights[i-1] > heights[i-1] {
						m += heights[i-1]
					} else {
						m += k - heights[i] - heights[i-1]
					}

				} else {
					if absInt(heights[i]-heights[i-1], k) <= m {
						m -= absInt(heights[i]-heights[i-1], k)
						if m < 0 {
							win = false
							break
						}
					} else {
						win = false
						break
					}
				}
			}
		}

		if win {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		total int
		n     int
		m     int
		k     int
	)

	_, _ = fmt.Fscan(input, &total)

	for total > 0 {
		total -= 1

		_, _ = fmt.Fscan(input, &n, &m, &k)
		heights := make([]int, n)
		for i := 0; i < n; i += 1 {
			_, _ = fmt.Fscan(input, &heights[i])
		}

		win := true
		for i := 1; i < n; i += 1 {
			if heights[i-1] >= heights[i] {
				m += heights[i-1] - heights[i] + k
				continue
			} else {
				if heights[i]-heights[i-1]-k <= m {
					m -= heights[i] - heights[i-1] - k
					if m < 0 {
						win = false
						break
					}
					continue
				} else {
					win = false
					break
				}
			}
		}

		if win {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		total int
		n     int
		m     int
		k     int
	)

	_, _ = fmt.Fscan(input, &total)

	for total > 0 {
		total -= 1

		_, _ = fmt.Fscan(input, &n, &m, &k)
		heights := make([]int, n)
		for i := 0; i < n; i += 1 {
			_, _ = fmt.Fscan(input, &heights[i])
		}

		win := true
		for i := 1; i < n; i += 1 {
			if heights[i-1] > heights[i] {
				m += heights[i-1] - heights[i] + k
				continue
			} else {
				if heights[i]-heights[i-1]-k <= m {
					m -= heights[i] - heights[i-1] - k
					if m < 0 {
						win = false
						break
					}
					continue
				} else {
					win = false
					break
				}
			}
		}

		if win {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		total int
		n     int
		m     int
		k     int
	)

	_, _ = fmt.Fscan(input, &total)

	for total > 0 {
		total -= 1

		_, _ = fmt.Fscan(input, &n, &m, &k)
		heights := make([]int, n)
		for i := 0; i < n; i += 1 {
			_, _ = fmt.Fscan(input, &heights[i])
		}

		win := true
		for i := 1; i < n; i += 1 {
			if heights[i-1] >= heights[i] {
				// 0o
				m += heights[i-1] - heights[i]
				if k > heights[i] {
					m += heights[i]
				} else {
					m += k
				}

			} else {
				// o0
				if absInt(heights[i]-heights[i-1], k) <= m {
					m -= absInt(heights[i]-heights[i-1], k)
					if m < 0 {
						win = false
						break
					}
				} else {
					win = false
					break
				}
			}
		}

		if win {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		total int
		n     int
		m     int
		k     int
	)

	_, _ = fmt.Fscan(input, &total)

	for total > 0 {
		total -= 1

		_, _ = fmt.Fscan(input, &n, &m, &k)
		heights := make([]int, n)
		for i := 0; i < n; i += 1 {
			_, _ = fmt.Fscan(input, &heights[i])
		}

		win := true
		for i := 1; i < n; i += 1 {
			if heights[i-1] >= heights[i] {
				// 0o
				m += heights[i-1] - heights[i]
				if k > heights[i] {
					m += heights[i]
				} else {
					m += k
				}

			} else {
				// o0
				if heights[i]-heights[i-1] <= k {
					if k-(heights[i]-heights[i-1]) > heights[i-1] {
						m += heights[i-1]
					} else {
						m += k - heights[i] - heights[i-1]
					}

				} else {
					if absInt(heights[i]-heights[i-1], k) <= m {
						m -= absInt(heights[i]-heights[i-1], k)
						if m < 0 {
							win = false
							break
						}
					} else {
						win = false
						break
					}
				}
			}
		}

		if win {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		total int
		n     int
		m     int
		k     int
	)

	_, _ = fmt.Fscan(input, &total)

	for total > 0 {
		total -= 1

		_, _ = fmt.Fscan(input, &n, &m, &k)
		heights := make([]int, n)
		for i := 0; i < n; i += 1 {
			_, _ = fmt.Fscan(input, &heights[i])
		}

		win := true
		for i := 1; i < n; i += 1 {
			if heights[i-1] > heights[i] {
				m += heights[i-1] - heights[i]
				continue
			} else {
				if heights[i]-heights[i-1]-k <= m {
					m -= heights[i] - heights[i-1] - k
					if m < 0 {
						win = false
						break
					}
					continue
				} else {
					win = false
					break
				}
			}
		}

		if win {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

package main

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

// 1200
// 27.05.2020
// https://codeforces.com/problemset/problem/1200/B

func main() {
	var t int
	fmt.Scanln(&t)

	r := bufio.NewReader(os.Stdin)
LOOP:
	for tt := 0; tt < t; tt++ {
		var n, m, k int
		fmt.Fscanln(r, &n, &m, &k)
		str, _ := r.ReadString('\n')
		strs := strings.SplitN(str, " ", n)
		strs[len(strs)-1] = strings.TrimSuffix(strs[len(strs)-1], "\n")

		next, cur := -1, -1
		for i := 0; i < n; i++ {
			cur = next
			next, _ = strconv.Atoi(strs[i])
			if cur == -1 {
				continue
			}
			m += cur - next + k
			if m < 0 {
				fmt.Println("NO")
				continue LOOP
			}
		}
		fmt.Println("YES")
	}
}

package main

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

// 1200
// 27.05.2020
// https://codeforces.com/problemset/problem/1200/B

func main() {
	var t int
	fmt.Scanln(&t)

	r := bufio.NewReader(os.Stdin)
LOOP:
	for tt := 0; tt < t; tt++ {
		var n, m, k int
		fmt.Fscanln(r, &n, &m, &k)
		b, _, err := r.ReadLine()
		if err != nil {
			panic(err)
		}
		str := string(b)

		strs := strings.SplitN(str, " ", n)

		next, cur := -1, -1
		for i := 0; i < n; i++ {
			cur = next
			var err error
			next, err = strconv.Atoi(strs[i])
			if err != nil {
				panic(err)
			}

			if cur == -1 {
				continue
			}
			m += cur - next + k
			if m < 0 {
				fmt.Println("NO")
				continue LOOP
			}
		}
		fmt.Println("YES")
	}
}

package main

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

// 1200
// 27.05.2020
// https://codeforces.com/problemset/problem/1200/B

func main() {
	var t int
	fmt.Scanln(&t)

LOOP:
	for tt := 0; tt < t; tt++ {
		var n, m, k int
		fmt.Scanln(&n, &m, &k)
		scn := bufio.NewScanner(os.Stdin)
		scn.Split(bufio.ScanWords)
		next, cur := -1, -1
		for i := 0; i < n && scn.Scan(); i++ {

			cur = next
			next, _ = strconv.Atoi(scn.Text())
			if cur == -1 {
				continue
			}
			m += cur - next + k
			if m < 0 {
				fmt.Println("NO")
				continue LOOP
			}
		}
		fmt.Println("YES")
	}
}

package main

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

// 1200
// 27.05.2020
// https://codeforces.com/problemset/problem/1200/B

func main() {
	var t int
	fmt.Scanln(&t)

LOOP:
	for tt := 0; tt < t; tt++ {
		var n, m, k int
		fmt.Scanln(&n, &m, &k)
		scn := bufio.NewScanner(os.Stdin)
		scn.Split(bufio.ScanWords)
		next, cur := -1, -1
		for i := 0; i < n; i++ {
			scn.Scan()
			cur = next
			next, _ = strconv.Atoi(scn.Text())
			if cur == -1 {
				continue
			}
			m += cur - next + k
			if m < 0 {
				fmt.Println("NO")
				continue LOOP
			}
		}
		fmt.Println("YES")
	}
}

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var testCase int

	_, err := fmt.Fscanf(input, "%d\n", &testCase)
	if err != nil {
	}

	for testCase > 0 {
		testCase--

		var n, m, k int
		_, err := fmt.Fscanf(input, "%d %d %d\n", &n, &m, &k)
		if err != nil {
		}

		var h = make([]int, n)
		for i := 0; i < n; i++ {
			_, err := fmt.Fscanf(input, "%v", &h[i])
			if err != nil {
			}
		}
		_, err = fmt.Fscanf(input, "\n")
		if err != nil {
		}

		for i := 0; i < n; i++ {
			if i == n-1 {
				fmt.Println("YES")
				break
			}
			if h[i] <= h[i+1] {
				if h[i+1]-h[i]-m <= k {
					m += h[i] + k - h[i+1]
					continue
				} else {
					fmt.Println("NO")
					break
				}
			} else if h[i] > h[i+1] {
				m += h[i] + k - h[i+1]
				continue
			}
		}
	}

}

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var testCase int

	_, err := fmt.Fscanf(input, "%d\n", &testCase)
	if err != nil {
	}

	for testCase > 0 {
		testCase--

		var n, m, k int
		_, err := fmt.Fscanf(input, "%d %d %d\n", &n, &m, &k)
		if err != nil {
		}

		var h = make([]int, n)
		for i := 0; i < n; i++ {
			_, err := fmt.Fscanf(input, "%v", &h[i])
			if err != nil {
			}
		}
		_, err = fmt.Fscanf(input, "\n")
		if err != nil {
		}

		for i := 0; i < n; i++ {
			if i == n-1 {
				fmt.Println("YES")
				break
			}
			if h[i] <= h[i+1] {
				if h[i+1]-h[i] <= k {
					m += h[i] + k - h[i+1]
					continue
				} else if h[i+1]-h[i]-m <= k {
					m += h[i] + k - h[i+1]
					continue
				} else {
					fmt.Println("NO")
					break
				}
			} else if h[i] > h[i+1] {
				if h[i+1] < k {
					m += h[i]
					continue
				}
				m += h[i] + k - h[i+1]
				continue
			}
		}
	}

}

package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var testCase int

	_, err := fmt.Fscanf(input, "%d\n", &testCase)
	if err != nil {
	}

	for testCase > 0 {
		testCase--

		var n, m, k int
		_, err := fmt.Fscanf(input, "%d %d %d\n", &n, &m, &k)
		if err != nil {
		}

		var h = make([]int, n)
		for i := 0; i < n; i++ {
			_, err := fmt.Fscanf(input, "%v", &h[i])
			if err != nil {
			}
		}
		_, err = fmt.Fscanf(input, "\n")
		if err != nil {
		}

		for i := 0; i < n; i++ {
			if i == n-1 {
				fmt.Println("YES")
				break
			}
			if h[i] <= h[i+1] {
				if h[i+1]-h[i] <= k {
					m += h[i] + k - h[i+1]
					continue
				} else if h[i+1]-h[i]-m <= k {
					m += h[i] + k - h[i+1]
					if m < 0 {
						fmt.Println("NO")
						break
					}
					continue
				} else {
					fmt.Println("NO")
					break
				}
			} else if h[i] > h[i+1] {
				if h[i+1] < k {
					m += h[i]
					continue
				}
				m += h[i] + k - h[i+1]
				continue
			}
		}
	}

}

package main
import "fmt"
import "os"
import "bufio"

var input *bufio.Reader

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

func solve() {
    var n, m, k int
    fmt.Fscanf(input, "%d%d%d\n", &n, &m, &k)
    h := make([]int, n)
    for i:=0; i<n; i++ {
        fmt.Fscanf(input, "%d", &h[i])
    }
    fmt.Fscanf(input, "\n")
    for i:=1; i<n; i++ {
        if h[i-1]+m >= h[i]-k {
            m+=h[i-1]-(h[i]-k)
        } else {
            fmt.Println("NO")
            return
        }
    }
    fmt.Println("YES")
}

func main(){
    input = bufio.NewReader(os.Stdin)
    var T int
    fmt.Fscanf(input, "%d\n", &T)
    for i:=0; i<T; i++ {
        solve()
    }
}

// Author: sighduck
// URL: https://codeforces.com/contest/1200/problem/B

package main

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

func Solve(n int, m int, k int, blocks []int) string {
	var blocksToAddOrRemove int
	for i := 0; i < n-1; i++ {
		if blocks[i+1] <= blocks[i] {
			newHeight := blocks[i+1] - k
			blocksToAddOrRemove = blocks[i] - newHeight
			m += blocksToAddOrRemove
		} else if blocks[i+1] > blocks[i] {
			newHeight := blocks[i+1] - k
			blocksToAddOrRemove = newHeight - blocks[i]
			m -= blocksToAddOrRemove
		}
		if m < 0 {
			return "NO"
		}
	}
	return "YES"
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var t int
	fmt.Fscanf(reader, "%d\n", &t)
	for i := 0; i < t; i++ {
		var n, m, k int
		fmt.Fscanf(reader, "%d %d %d\n", &n, &m, &k)
		blocks := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(reader, "%d", &blocks[i])
		}
		fmt.Fscanf(reader, "\n")
		fmt.Fprintf(writer, "%s\n", Solve(n, m, k, blocks))
	}
}


package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1365C(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, v, ans int
	Fscan(in, &n)
	cnt := make([]int, n)
	pos := make([]int, n+1)
	for i := range cnt {
		Fscan(in, &v)
		pos[v] = i
	}
	for i := range cnt {
		Fscan(in, &v)
		p := pos[v]
		if p < i {
			p += n
		}
		cnt[p-i]++
	}
	for _, c := range cnt {
		if c > ans {
			ans = c
		}
	}
	Fprint(out, ans)
}

func main() { CF1365C(os.Stdin, os.Stdout) }

package main

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

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func main() {
	reader := bufio.NewReader(os.Stdin)

	n := readNum(reader)

	A := readNNums(reader, n)
	B := readNNums(reader, n)

	fmt.Println(solve(n, A, B))
}

func solve(n int, A []int, B []int) int {
	pos := make([]int, n+1)

	for i := 0; i < n; i++ {
		pos[A[i]] = i
	}
	left := make([]int, n)
	right := make([]int, n)

	for i := 0; i < n; i++ {
		j := pos[B[i]]
		if i == j {
			left[0]++
			continue
		}
		if j < i {
			left[i-j]++
			right[j-i+n]++
		} else {
			left[i-j+n]++
			right[j-i]++
		}
	}

	res := left[0]

	for k := 1; k < n; k++ {
		if left[k] > res {
			res = left[k]
		}
		if right[k] > res {
			res = right[k]
		}
	}
	return res
}

package main

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

var checked []bool
var edges [][]int
var cnt int

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	//fmt.Fscanf(in, "%d\n", &t)
	for tt := int64(0); tt < t; tt++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		pos := make([]int, n+1)
		tmp := 0
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &tmp)
			pos[tmp] = i
		}
		fmt.Fscanf(in, "\n")
		cnt := make(map[int]int)
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &tmp)
			cnt[((i-pos[tmp])+n)%n]++
		}
		ans := 0
		for _, v := range cnt {
			if ans < v {
				ans = v
			}
		}
		fmt.Fprintf(out, "%d\n", ans)
	}
	return
}

func canWin(a []int) bool {
	//fmt.Println(a)
	if len(a) <= 1 {
		return true
	}
	sum := 0
	for i := range a {
		sum += a[i]
	}
	if (sum-2)%2 == 0 {
		return false
	}
	return true
}

func dfs(cur int) {
	cnt++
	checked[cur] = true
	for _, next := range edges[cur] {
		if !checked[next] {
			dfs(next)
		}
	}
}

// https://codeforces.com/contest/x/problem/A
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)
var input io.Reader

func main() {
	//var T int

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input = bufio.NewReader(os.Stdin)
	fmt.Println(solver())
}

func solver() int {
	var n int
	fmt.Fscan(input, &n)
	a := make([]int, n + 1)
	b := make([]int, n + 1)
	for i := 0; i < n; i++ {
		var t int
		fmt.Fscan(input, &t)
		a[t] = i
	}
	for i := 0; i < n; i++ {
		var t int
		fmt.Fscan(input, &t)
		b[t] = i
	}
	sh := make([]int, n + 1)
	ans := 0
	for i := 1; i <= n; i++ {
		index := (a[i] - b[i] + n) % n
		sh[index]++
		ans = max(ans, sh[index])
	}

	return ans
}

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

package main

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

func main() {
	n := nextInt()
	fmt.Println(solve(nextInts(n), nextInts(n)))
}

func solve(as, bs []int) int {
	n := len(as)
	aIndexes := make([]int, n+1)
	bIndexes := make([]int, n+1)
	for i := 0; i < n; i++ {
		aIndexes[as[i]] = i
		bIndexes[bs[i]] = i
	}

	distToCount := make(map[int]int)
	for i := 1; i <= n; i++ {
		dist := aIndexes[i] - bIndexes[i]
		if dist < 0 {
			dist += n
		}
		distToCount[dist]++
	}

	ans := 0
	for _, c := range distToCount {
		ans = max(ans, c)
	}
	return ans
}

func max(xs ...int) int {
	ret := xs[0]
	for _, x := range xs[1:] {
		if ret < x {
			ret = x
		}
	}
	return ret
}

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer(make([]byte, 256), 1e9)
	sc.Split(bufio.ScanWords)
}

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

func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return a
}

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

/*
URL:
https://codeforces.com/contest/1365/problem/C
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n    int
	A, B []int

	am   []int
	bnum []int
)

func main() {
	n = ReadInt()
	A = ReadIntSlice(n)
	B = ReadIntSlice(n)

	am = make([]int, n+50)
	for i := 0; i < n; i++ {
		a := A[i]
		am[a] = i
	}

	bnum = make([]int, n+50)
	for j := 0; j < n; j++ {
		b := B[j]
		i := am[b]

		var num int
		if j <= i {
			num = i - j
		} else {
			num = n - (j - i)
		}
		bnum[num]++
	}

	ans := 0
	for i := 0; i <= n; i++ {
		ChMax(&ans, bnum[i])
	}
	fmt.Println(ans)
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int, target int) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

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

var n int
var a [200001]int
var b [200001]int
var pos [200001]int
var shift [200001]int

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	fmt.Fscan(in, &n)

	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
		pos[a[i]] = i
	}
	fmt.Fscanln(in)

	for i := 0; i < n; i++ {
		fmt.Fscan(in, &b[i])

		s := pos[b[i]] - i
		if s < 0 {
			s += n
		}

		shift[i] = s
	}

	var cnt [200001]int
	res := 0
	for i := 0; i < n; i++ {
		cnt[shift[i]]++
		if cnt[shift[i]] > res {
			res = cnt[shift[i]]
		}
	}

	fmt.Fprint(out, res)
	out.Flush()
}

package main

import (
	. "fmt"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	buf := make([]byte, 4096)
	_i := len(buf)
	rc := func() byte {
		if _i == len(buf) {
			os.Stdin.Read(buf)
			_i = 0
		}
		b := buf[_i]
		_i++
		return b
	}
	r := func() (x int) {
		b := rc()
		for ; '0' > b ; b = rc() {
		}
		for ; '0' <= b ; b = rc() {
			x = x*10 + int(b&15)
		}
		return
	}
	n := r()
	pos := make([]int, n+1)
	for i := 0; i < n; i++ {
		pos[r()] = i
	}
	cnt := make([]int, n)
	for i := 0; i < n; i++ {
		p := pos[r()]
		if p < i {
			p += n
		}
		cnt[p-i]++
	}
	ans := 0
	for _, c := range cnt {
		if c > ans {
			ans = c
		}
	}
	Print(ans)
}

package main

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

func min(a, b int) int {
	return int(math.Min(float64(a), float64(b)))
}

func max(a, b int) int {
	return int(math.Max(float64(a), float64(b)))
}

func z(a []int) []int{
	mas := make([]int, len(a))
	var l, r int
	for i := 1; i < len(a);i++ {
		if i <= r {
			mas[i] = min(r-i+ 1, mas[i - l])
		}
		for (i+mas[i] < len(a)) && (a[mas[i]] == a[i+mas[i]]) {
			mas[i]++
		}
		if i+mas[i]-1 > r {
			l, r = i, i+mas[i]-1
		}
	}
	return mas
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n int
	fmt.Fscanf(in, "%d\n", &n)
	a := make([]int, n)
	ans := make([]int, n)
	var num int
	for i := 0;i < n;i++ {
		fmt.Fscan(in, &num)
		a[num-1] = i
	}
	fmt.Fscanf(in, "\n")
	for i := 0;i < n;i++ {
		fmt.Fscan(in, &num)
		if a[num-1] < i{
			ans[a[num-1]+n-i]++
		} else{
			ans[a[num-1]-i]++
		}
	}
	fmt.Fscanf(in, "\n")
	var Ans int
	for _, i := range ans {
		Ans = max(Ans, i)
	}
	fmt.Fprintln(out, Ans)
	return
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	scan := func(x ...interface{}) (n int, err error) {
		return fmt.Fscan(in, x...)
	}
	println := func(x ...interface{}) (n int, err error) {
		return fmt.Fprintln(out, x...)
	}

	var n int
	scan(&n)
	aPos := make([]int, n)
	bPos := make([]int, n)
	var x int
	for i := 0; i < n; i++ {
		scan(&x)
		aPos[x-1] = i
	}
	for i := 0; i < n; i++ {
		scan(&x)
		bPos[x-1] = i
	}
	moveCnt := make([]int, n+1)
	for i := 0; i < n; i++ {
		shift := bPos[i] - aPos[i]
		if shift < 0 {
			shift += n
		}
		moveCnt[shift]++
	}

	ans := 0
	for _, cnt := range moveCnt {
		if cnt > ans {
			ans = cnt
		}
	}
	println(ans)
}

package main

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

func solve(a []int, b map[int]int) string {
	v := make([]int, len(a))
	for i, vv := range a {
		vp := b[vv]
		v[((i-vp)+len(a))%len(a)] += 1

	}
	m := 0
	for _, vv := range v {
		if vv > m {
			m = vv
		}
	}
	return fmt.Sprint(m)
}

func output(i int, ans string) {
	fmt.Printf("%s\n", ans)
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 10000000), 10000000)
	var numTests int
	scanner.Scan()
	fmt.Sscan(scanner.Text(), &numTests)
	scanner.Scan()
	v1 := make([]int, numTests)
	v2 := map[int]int{}
	s1 := strings.Split(scanner.Text(), " ")
	scanner.Scan()
	s2 := strings.Split(scanner.Text(), " ")

	for i := 0; i < numTests; i++ {
		v1[i], _ = strconv.Atoi(s1[i])
		vv, _ := strconv.Atoi(s2[i])
		v2[vv] = i
	}
	output(0, solve(v1, v2))
}

// Author: sighduck
// URL: https://codeforces.com/contest/1365/problem/C

package main

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

func Solve(n int, a, b []int) int {
	al := make([]int, n+1)
	bl := make([]int, n+1)
	for i := 0; i < n; i++ {
		al[a[i]] = i
		bl[b[i]] = i
	}
	rotation := make([]int, n)
	for i := 1; i <= n; i++ {
		if al[i] <= bl[i] {
			rotation[bl[i]-al[i]] += 1
		} else {
			rotation[n-(al[i]-bl[i])] += 1
		}
	}
	max := 0
	for _, elem := range rotation {
		if elem > max {
			max = elem
		}
	}
	return max
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d ", &a[i])
	}
	fmt.Fscanf(reader, "\n")
	b := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d ", &b[i])
	}
	fmt.Fscanf(reader, "\n")
	fmt.Fprintf(writer, "%d\n", Solve(n, a, b))
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	Int64() int64
	UInt64() uint64
	String() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) Int64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) UInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) String() string {
	impl.Scan()
	return impl.Text()
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

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

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

const (
	INF = int64(math.MaxInt64)
	MOD = 1e9 + 7
)

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	n := reader.Int64()
	a := make([]int64, n)
	for i := range a {
		a[i] = reader.Int64()
	}
	b := make([]int64, n)
	for i := range b {
		b[i] = reader.Int64()
	}
	writer.Printf("%d\n", sol(a, b))
}

func sol(a, b []int64) int64 {
	posA := make([]int64, len(a))
	for i := range a {
		posA[a[i]-1] = int64(i)
	}
	posB := make([]int64, len(b))
	for i := range b {
		posB[b[i]-1] = int64(i)
	}
	dist := map[int64]int64{}
	for i := range posA {
		pa := posA[i]
		pb := posB[i]
		diff := (pb-pa+int64(len(a))) % int64(len(a))
		dist[diff]++
	}
	maxSoFar := int64(0)
	for _, d := range dist {
		maxSoFar = max(maxSoFar, d)
	}
	//writer.Printf("%+v %+v\n", posA, posB)
	//writer.Printf("%+v\n", dist)
	return maxSoFar
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"math/big"
	"os"
	"strconv"
)

var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func init() {
	in.Split(bufio.ScanWords)
}
func exit() {
	out.Flush()
}

// custom
func nextInt() int {
	in.Scan()
	ret, _ := strconv.Atoi(in.Text())
	return ret
}

/*
 */

var n *big.Rat
var l *big.Rat
var vp *big.Rat
var vb *big.Rat
var rongliang *big.Rat
var vhebp *big.Rat
var vchabp *big.Rat
var hehe *big.Rat
var haha *big.Rat
var NTime *big.Rat
var initdiff *big.Rat
var lpos *big.Rat
var inittime *big.Rat
var onetime *big.Rat
var backtime *big.Rat
var chasetime *big.Rat

func initAll() {
	vhebp = big.NewRat(0, 1)
	vchabp = big.NewRat(0, 1)
	hehe = big.NewRat(0, 1)
	haha = big.NewRat(0, 1)
	initdiff = big.NewRat(0, 1)
	NTime = big.NewRat(0, 1)
	lpos = big.NewRat(0, 1)
	inittime = big.NewRat(0, 1)
	onetime = big.NewRat(0, 1)
	backtime = big.NewRat(0, 1)
	chasetime = big.NewRat(0, 1)

	hehe.Add(vp, vb)
	vhebp.Set(hehe)
	hehe.Sub(vb, vp)
	vchabp.Set(hehe)

	var ntime, _ = hehe.Sub(n, rongliang).Quo(hehe, rongliang).Float64()
	NTime.SetFloat64(math.Ceil(ntime))
}
func cost(pos *big.Rat) *big.Rat {
	inittime.Quo(pos, vb)
	lpos.Mul(inittime, vp)
	initdiff.Sub(pos, lpos)
	backtime.Quo(initdiff, vhebp)
	hehe.Mul(backtime, vb)
	haha.Mul(backtime, vp)
	hehe.Add(hehe, haha)
	chasetime.Quo(hehe, vchabp)
	onetime.Add(backtime, chasetime)
	hehe.Mul(onetime, NTime)
	hehe.Mul(vp, hehe)
	hehe.Add(hehe, pos)
	hehe.Sub(hehe, l)
	return hehe.Abs(hehe)
}
func answer(pos *big.Rat) *big.Rat {
	inittime.Quo(pos, vb)
	lpos.Mul(inittime, vp)
	initdiff.Sub(pos, lpos)
	backtime.Quo(initdiff, vhebp)
	hehe.Mul(backtime, vb)
	haha.Mul(backtime, vp)
	hehe.Add(hehe, haha)
	chasetime.Quo(hehe, vchabp)
	onetime.Add(backtime, chasetime)
	hehe.Mul(onetime, NTime)
	return hehe.Add(inittime, hehe)
}
func main() {
	defer exit()

	n = big.NewRat(int64(nextInt()), 1)
	l = big.NewRat(int64(nextInt()), 1)
	vp = big.NewRat(int64(nextInt()), 1)
	vb = big.NewRat(int64(nextInt()), 1)
	rongliang = big.NewRat(int64(nextInt()), 1)
	initAll()

	if rongliang.Cmp(n) >= 0 {
		fmt.Fprintf(out, "%s\n", l.Quo(l, vb).FloatString(10))
		return
	}
	var cp = big.NewRat(1, 10000000000)
	var left = big.NewRat(1, 1000000000)
	var right = big.NewRat(0, 1)
	right.Set(l)
	var diff = big.NewRat(0, 1)
	var s_1_3 = big.NewRat(0, 1)
	var c13 = big.NewRat(0, 1)
	var s_1_2 = big.NewRat(0, 1)
	var c12 = big.NewRat(0, 1)
	var san = big.NewRat(3, 1)
	var er = big.NewRat(2, 1)
	for {
		if diff.Sub(right, left).Cmp(cp) < 0 {
			break
		}
		s_1_3.Quo(diff, san)
		s_1_3.Add(left, s_1_3)

		s_1_2.Quo(diff, er)
		s_1_2.Add(left, s_1_2)
		c13.Set(cost(s_1_3))
		c12.Set(cost(s_1_2))

		if c13.Cmp(c12) > 0 {
			left.Set(s_1_3)
		} else {
			right.Set(s_1_2)
		}
	}
	t := answer(left)
	fmt.Fprintf(out, "%s\n", t.FloatString(10))
}

package main

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

var bufin *bufio.Reader
var bufout *bufio.Writer

var n, k int
var l, v1, v2 float64

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)

	fmt.Fscan(bufin, &n, &l, &v1, &v2, &k)

	g := (n + k - 1) / k
	d := l * (v1 + v2) / (2*v1*float64(g) + v2 - v1)
	t := d/v2 + (l-d)/v1

	fmt.Fprintln(bufout, t)

	defer bufout.Flush()
}

package main

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

func main() {
	in := bufio.NewScanner(os.Stdin)
	in.Split(bufio.ScanWords)

	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	in.Scan()
	n, _ := strconv.Atoi(in.Text())

	in.Scan()
	l, _ := strconv.ParseFloat(in.Text(), 64)

	in.Scan()
	v1, _ := strconv.ParseFloat(in.Text(), 64)

	in.Scan()
	v2, _ := strconv.ParseFloat(in.Text(), 64)

	in.Scan()
	k, _ := strconv.Atoi(in.Text())

	for n%k != 0 {
		n++
	}

	a := float64(n / k)
	d := l * (v1 + v2) / (2*v1*a + v2 - v1)
	res := d/v2 + (l-d)/v1
	out.WriteString(strconv.FormatFloat(res, 'f', -1, 64))
}

package main

import "fmt"

const eps = 1e-8

func can(a, b, v1, v2, mi, l float64, it int) bool {
	for i := 0; i < it && mi > 0; i++ {
		t1 := (b - a) / (v1 + v2)
		c := a + t1*v1
		d := (v1*c - v2*l + v1*v2*(mi-t1)) / (v1 - v2)
		t2 := (d - c) / v2

		a = c + t2*v1
		b = d
		mi -= t1 + t2
	}
	return mi > 0
}

func solve(it, l, v1, v2 int) float64 {
	lo, hi := float64(0), float64(l)/float64(v1)
	if v1 >= v2 {
		return hi
	}
	for hi-lo > eps {
		mi := (lo + hi) / 2
		if mi-lo < eps {
			return hi
		}
		if can(0, 0, float64(v1), float64(v2), mi, float64(l), it) {
			hi = mi
		} else {
			lo = mi
		}
	}
	return hi
}

func main() {
	var n, l, v1, v2, k int
	fmt.Scanf("%d%d%d%d%d", &n, &l, &v1, &v2, &k)
	fmt.Println(solve((n+k-1)/k, l, v1, v2))
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"math/big"
	"os"
	"strconv"
)

var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func init() {
	in.Split(bufio.ScanWords)
}
func exit() {
	out.Flush()
}

// custom
func nextInt() int {
	in.Scan()
	ret, _ := strconv.Atoi(in.Text())
	return ret
}

/*
 */

var n *big.Rat
var l *big.Rat
var vp *big.Rat
var vb *big.Rat
var rongliang *big.Rat
var vhebp *big.Rat
var vchabp *big.Rat
var hehe *big.Rat
var haha *big.Rat
var NTime *big.Rat
var initdiff *big.Rat
var lpos *big.Rat
var inittime *big.Rat
var onetime *big.Rat
var backtime *big.Rat
var chasetime *big.Rat

func initAll() {
	vhebp = big.NewRat(0, 1)
	vchabp = big.NewRat(0, 1)
	hehe = big.NewRat(0, 1)
	haha = big.NewRat(0, 1)
	initdiff = big.NewRat(0, 1)
	NTime = big.NewRat(0, 1)
	lpos = big.NewRat(0, 1)
	inittime = big.NewRat(0, 1)
	onetime = big.NewRat(0, 1)
	backtime = big.NewRat(0, 1)
	chasetime = big.NewRat(0, 1)

	hehe.Add(vp, vb)
	vhebp.Set(hehe)
	hehe.Sub(vb, vp)
	vchabp.Set(hehe)

	var ntime, _ = hehe.Sub(n, rongliang).Quo(hehe, rongliang).Float64()
	NTime.SetFloat64(math.Ceil(ntime))
}
func cost(pos *big.Rat) *big.Rat {
	inittime.Quo(pos, vb)
	lpos.Mul(inittime, vp)
	initdiff.Sub(pos, lpos)
	backtime.Quo(initdiff, vhebp)
	hehe.Mul(backtime, vb)
	haha.Mul(backtime, vp)
	hehe.Add(hehe, haha)
	chasetime.Quo(hehe, vchabp)
	onetime.Add(backtime, chasetime)
	hehe.Mul(onetime, NTime)
	hehe.Mul(vp, hehe)
	hehe.Add(hehe, pos)
	hehe.Sub(hehe, l)
	return hehe.Abs(hehe)
}
func answer(pos *big.Rat) *big.Rat {
	inittime.Quo(pos, vb)
	lpos.Mul(inittime, vp)
	initdiff.Sub(pos, lpos)
	backtime.Quo(initdiff, vhebp)
	hehe.Mul(backtime, vb)
	haha.Mul(backtime, vp)
	hehe.Add(hehe, haha)
	chasetime.Quo(hehe, vchabp)
	onetime.Add(backtime, chasetime)
	hehe.Mul(onetime, NTime)
	return hehe.Add(inittime, hehe)
}
func main() {
	defer exit()

	n = big.NewRat(int64(nextInt()), 1)
	l = big.NewRat(int64(nextInt()), 1)
	vp = big.NewRat(int64(nextInt()), 1)
	vb = big.NewRat(int64(nextInt()), 1)
	rongliang = big.NewRat(int64(nextInt()), 1)
	initAll()

	if rongliang.Cmp(n) >= 0 {
		fmt.Fprintf(out, "%s\n", l.Quo(l, vb).FloatString(10))
		return
	}
	var cp = big.NewRat(1, 1000000000)
	var left = big.NewRat(1, 100000000)
	var right = big.NewRat(0, 1)
	right.Set(l)
	var diff = big.NewRat(0, 1)
	var s_1_3 = big.NewRat(0, 1)
	var c13 = big.NewRat(0, 1)
	var s_1_2 = big.NewRat(0, 1)
	var c12 = big.NewRat(0, 1)
	var san = big.NewRat(3, 1)
	var er = big.NewRat(2, 1)
	for {
		if diff.Sub(right, left).Cmp(cp) < 0 {
			break
		}
		s_1_3.Quo(diff, san)
		s_1_3.Add(left, s_1_3)

		s_1_2.Quo(diff, er)
		s_1_2.Add(left, s_1_2)
		c13.Set(cost(s_1_3))
		c12.Set(cost(s_1_2))

		if c13.Cmp(c12) > 0 {
			left.Set(s_1_3)
		} else {
			right.Set(s_1_2)
		}
	}
	t := answer(left)
	fmt.Fprintf(out, "%s\n", t.FloatString(10))
}

package main

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

var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func init() {
	in.Split(bufio.ScanWords)
}
func exit() {
	out.Flush()
}

// custom
func nextInt() int {
	in.Scan()
	ret, _ := strconv.Atoi(in.Text())
	return ret
}

/*
 */

var n int
var l int
var vp int
var vb int
var rongliang int

func cost(pos float64) float64 {
	// the number of the left pupils
	leftnum := n - rongliang
	// when bus stop to go back, where are the left pupils
	lpos := (pos / float64(vb)) * float64(vp)
	// when bus stop to go back, where are the in-bus pupils
	rpos := pos
	for leftnum > 0 {
		p_meet_b_t := (rpos - lpos) / float64(vp+vb)
		p_move := p_meet_b_t * float64(vp)
		l_now_pos := lpos + p_move
		r_now_pos := rpos + p_move
		b_zhui_t := (r_now_pos - l_now_pos) / float64(vb-vp)
		zong_t := p_meet_b_t + b_zhui_t
		lpos = lpos + float64(vp)*zong_t
		rpos = rpos + float64(vp)*zong_t
		leftnum -= rongliang
	}
	var re = float64(l) - rpos
	if re > 0 {
		return re
	}
	return -re
}
func answer(pos float64) float64 {
	var zongt = pos / float64(vb)
	// the number of the left pupils
	leftnum := n - rongliang
	// when bus stop to go back, where are the left pupils
	lpos := (pos / float64(vb)) * float64(vp)
	// when bus stop to go back, where are the in-bus pupils
	rpos := pos
	for leftnum > 0 {
		p_meet_b_t := (rpos - lpos) / float64(vp+vb)
		p_move := p_meet_b_t * float64(vp)
		l_now_pos := lpos + p_move
		r_now_pos := rpos + p_move
		b_zhui_t := (r_now_pos - l_now_pos) / float64(vb-vp)
		zong_t := p_meet_b_t + b_zhui_t
		lpos = lpos + float64(vp)*zong_t
		rpos = rpos + float64(vp)*zong_t
		leftnum -= rongliang
		zongt += zong_t
	}

	return zongt
}
func main() {
	defer exit()

	n = nextInt()
	l = nextInt()
	vp = nextInt()
	vb = nextInt()
	rongliang = nextInt()

	if rongliang >= n {
		fmt.Fprintf(out, "%f\n", float64(l)/float64(vb))
		return
	}
	var left = 0.0000001
	var right = float64(l) - 0.0000001
	var t float64
	for {
		if right-left < 0.0000002 {
			break
		}
		s_1_3 := left + (right-left)/3

		s_1_2 := left + (right-left)/2
		var c_s_1_3 = cost(s_1_3)
		var c_s_1_2 = cost(s_1_2)
		if c_s_1_3 < c_s_1_2 {
			right = s_1_2
		} else {
			left = s_1_3
		}
	}
	t = answer(left)
	fmt.Fprintf(out, "%f\n", t)
}


package main

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

var checked []bool
var edges [][]int
var cnt int
var a, b, c, d, e, f []int
var children [][]int

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	//fmt.Fscanf(in, "%d\n", &t)
	for tt := int64(0); tt < t; tt++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		a := make([]int64, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
		}
		fmt.Fscanf(in, "\n")
		ans := a[0]
		if n == 2 {
			ans = ans | a[1]
		}
		for i := 0; i < n; i++ {
			for j := i + 1; j < n; j++ {
				for k := j + 1; k < n; k++ {
					if a[i]|a[j]|a[k] > ans {
						ans = a[i] | a[j] | a[k]
					}
				}
			}
		}
		fmt.Fprintf(out, "%d\n", ans)
	}
}

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

func countOne(cur int) {
	checked[cur] = true
	d[cur] = b[cur]
	e[cur] = 1
	f[cur] = c[cur]
	for _, v := range edges[cur] {
		if !checked[v] {
			countOne(v)
			d[cur] += d[v]
			e[cur] += e[v]
			f[cur] += f[v]
			children[cur] = append(children[cur], v)
		}
	}
}

package main

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

const maxN = 500

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	buff := make([]byte, 2*1024*1024)

	scanner.Buffer(buff,  1024*1024)

	scanner.Scan()

	scanner.Text()

	scanner.Scan()

	line := scanner.Text()

	nums := MustParseFields(line)

	ans := solve4(nums)

	fmt.Println(ans)
}

func solve4(nums []int64) int64 {
	var sum int64

	if len(nums) == 1 {
		return nums[0]
	}

	if len(nums) == 2 {
		return nums[0] | nums[1]
	}

	for i := 0; i < len(nums); i++ {
		for j := i + 1; j < len(nums); j++ {
			for k:= j + 1; k < len(nums); k++ {
				s := nums[i] | nums[j] | nums[k]
				if s > sum {
					sum = s
				}
			}
		}
	}

	return sum
}

func MustParseFields(str string) []int64 {
	parts := strings.Fields(str)

	var ints []int64

	for i := 0; i < len(parts); i++ {
		v, err := strconv.ParseInt(parts[i], 10, 64);

		if err != nil {
			panic(err)
		}
		ints = append(ints, v)
	}
	return ints
}

/*
URL:
https://codeforces.com/contest/1365/problem/E
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int
	A []int64
)

func main() {
	n = ReadInt()
	A = ReadInt64Slice(n)

	if n == 1 {
		fmt.Println(A[0])
		return
	}

	if n == 2 {
		ans := A[0] | A[1]
		fmt.Println(ans)
		return
	}

	ans := int64(0)
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			for k := j + 1; k < n; k++ {
				a, b, c := A[i], A[j], A[k]
				v := a | b | c

				ChMax(&ans, v)
			}
		}
	}

	fmt.Println(ans)
}

// ChMax accepts a pointer of integer and a target value.
// If target value is LARGER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMax(updatedValue *int64, target int64) bool {
	if *updatedValue < target {
		*updatedValue = target
		return true
	}
	return false
}

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num int64, nth int) int64 {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num int64, nth int) int64 {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num int64, nth int) int64 {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int64) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func CF1365E(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var n, ans int64
	Fscan(in, &n)
	a := make([]int64, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	if n == 1 {
		ans = a[0]
	} else if n == 2 {
		ans = a[0] | a[1]
	} else {
		for i, v := range a {
			for j, w := range a[i+1:] {
				for _, u := range a[j+1:] {
					if v|w|u > ans {
						ans = v | w | u
					}
				}
			}
		}
	}
	Fprint(out, ans)
}

func main() { CF1365E(os.Stdin, os.Stdout) }

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	scan := func(x ...interface{}) (n int, err error) {
		return fmt.Fscan(in, x...)
	}
	println := func(x ...interface{}) (n int, err error) {
		return fmt.Fprintln(out, x...)
	}

	var n int
	scan(&n)
	a := make([]int64, n)
	for i := range a {
		scan(&a[i])
	}
	ans := int64(0)
	for i := range a {
		for j := range a {
			for k := range a {
				tripleOr := a[i] | a[j] | a[k]
				if tripleOr > ans {
					ans = tripleOr
				}
			}
		}
	}
	println(ans)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	scan := func(x ...interface{}) (n int, err error) {
		return fmt.Fscan(in, x...)
	}
	println := func(x ...interface{}) (n int, err error) {
		return fmt.Fprintln(out, x...)
	}

	var n int
	scan(&n)
	a := make([]int64, n)
	for i := range a {
		scan(&a[i])
	}
	ans := int64(0)
	for i := range a {
		for j := 0; j <= i; j++ {
			for k := 0; k <= j; k++ {
				tripleOr := a[i] | a[j] | a[k]
				if tripleOr > ans {
					ans = tripleOr
				}
			}
		}
	}
	println(ans)
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

	n := readNum(reader)

	A := make([]uint64, n)

	s, _ := reader.ReadBytes('\n')
	var pos int = -1

	for i := 0; i < n; i++ {
		pos = readUint64(s, pos+1, &A[i])
	}

	fmt.Println(solve(n, A))
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n int, A []uint64) uint64 {
	var best uint64

	for i := 0; i < n; i++ {
		best = max(best, A[i])
	}

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			best = max(best, A[i]|A[j])
		}
	}

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			for k := j + 1; k < n; k++ {
				best = max(best, A[i]|A[j]|A[k])
			}
		}
	}

	return best
}

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

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

	n := readNum(reader)

	A := make([]uint64, n)

	s, _ := reader.ReadBytes('\n')
	var pos int = -1

	for i := 0; i < n; i++ {
		pos = readUint64(s, pos+1, &A[i])
	}

	fmt.Println(solve(n, A))
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n int, A []uint64) uint64 {
	sort.Sort(Nums(A))

	var res uint64
	cnt := make([]int, 64)
	var k int

	update := func(num uint64, v int) {
		for i := 0; i < 64; i++ {
			if num>>i&1 == 1 {
				cnt[i] += v
			}
		}
	}

	check := func(pos int) bool {
		kk := max(1, k-2)

		for i := 63; i >= pos; i-- {
			if cnt[i] > 0 && cnt[i] < kk {
				return false
			}
		}
		return true
	}

	for i, pos := 0, 63; i < n && pos >= 0; pos-- {
		ii := i
		for ii < n && A[ii]>>pos&1 == 1 {
			ii++
		}

		for j := i; j < ii; j++ {
			update(A[j], 1)
			k++
			if !check(pos) {
				update(A[j], -1)
				k--
				break
			}
		}

		if cnt[pos] >= max(1, k-2) {
			res |= 1 << pos
		}

		i = ii
	}

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

type Nums []uint64

func (nums Nums) Len() int {
	return len(nums)
}

func (nums Nums) Less(i, j int) bool {
	return nums[i] > nums[j]
}

func (nums Nums) Swap(i, j int) {
	nums[i], nums[j] = nums[j], nums[i]
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

	n := readNum(reader)

	A := make([]uint64, n)

	s, _ := reader.ReadBytes('\n')
	var pos int = -1

	for i := 0; i < n; i++ {
		pos = readUint64(s, pos+1, &A[i])
	}

	fmt.Println(solve(n, A))
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n int, A []uint64) uint64 {
	sort.Sort(Nums(A))

	var res uint64
	cnt := make([]int, 64)
	var k int

	update := func(num uint64, v int) {
		for i := 0; i < 64; i++ {
			if num>>i&1 == 1 {
				cnt[i] += v
			}
		}
	}

	check := func(pos int) bool {
		kk := max(1, k-2)

		for i := 63; i >= pos; i-- {
			if cnt[i] > 0 && cnt[i] < kk {
				return false
			}
		}
		return true
	}

	for i, pos := 0, 63; i < n && pos >= 0; pos-- {
		ii := i
		for ii < n && A[ii]>>pos&1 == 1 {
			ii++
		}

		for j := i; j < ii; j++ {
			update(A[j], 1)
			k++
			if !check(pos) {
				update(A[j], -1)
				k--
				break
			}
		}

		if cnt[pos] > 0 {
			res |= 1 << pos
		}

		i = ii
	}

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

type Nums []uint64

func (nums Nums) Len() int {
	return len(nums)
}

func (nums Nums) Less(i, j int) bool {
	return nums[i] > nums[j]
}

func (nums Nums) Swap(i, j int) {
	nums[i], nums[j] = nums[j], nums[i]
}

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)

	n := readNum(reader)

	A := make([]uint64, n)

	s, _ := reader.ReadBytes('\n')
	var pos int = -1

	for i := 0; i < n; i++ {
		pos = readUint64(s, pos+1, &A[i])
	}

	fmt.Println(solve(n, A))
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n int, A []uint64) uint64 {
	sort.Sort(Nums(A))

	cnt := make([]int, 64)
	var k int

	update := func(num uint64, v int) {
		for i := 0; i < 64; i++ {
			if num>>i&1 == 1 {
				cnt[i] += v
			}
		}
	}

	check := func(pos int) bool {
		kk := max(1, k-2)

		for i := 63; i >= pos; i-- {
			if cnt[i] > 0 && cnt[i] < kk {
				return false
			}
		}
		return true
	}

	for i, pos := 0, 63; i < n && pos >= 0; pos-- {
		ii := i
		for ii < n && A[ii]>>pos&1 == 1 {
			ii++
		}

		for j := i; j < ii; j++ {
			update(A[j], 1)
			k++
			if !check(pos) {
				update(A[j], -1)
				k--
				break
			}
		}
		i = ii
	}

	var res uint64

	for i := 0; i < 64; i++ {
		if cnt[i] >= max(1, k-2) {
			res |= 1 << i
		}
	}

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

type Nums []uint64

func (nums Nums) Len() int {
	return len(nums)
}

func (nums Nums) Less(i, j int) bool {
	return nums[i] > nums[j]
}

func (nums Nums) Swap(i, j int) {
	nums[i], nums[j] = nums[j], nums[i]
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	scan := func(x ...interface{}) (n int, err error) {
		return fmt.Fscan(in, x...)
	}
	println := func(x ...interface{}) (n int, err error) {
		return fmt.Fprintln(out, x...)
	}

	var n int
	scan(&n)
	a := make([]int64, n)
	for i := range a {
		scan(&a[i])
	}
	ans := int64(0)
	for i := range a {
		for j := 0; j < i; j++ {
			for k := 0; k < j; k++ {
				tripleOr := a[i] | a[j] | a[k]
				if tripleOr > ans {
					ans = tripleOr
				}
			}
		}
	}
	println(ans)
}