Ezzat has an array of $$$n$$$ integers (maybe negative). He wants to split it into two non-empty subsequences $$$a$$$ and $$$b$$$, such that every element from the array belongs to exactly one subsequence, and the value of $$$f(a) + f(b)$$$ is the maximum possible value, where $$$f(x)$$$ is the average of the subsequence $$$x$$$. A sequence $$$x$$$ is a subsequence of a sequence $$$y$$$ if $$$x$$$ can be obtained from $$$y$$$ by deletion of several (possibly, zero or all) elements.The average of a subsequence is the sum of the numbers of this subsequence divided by the size of the subsequence.For example, the average of $$$[1,5,6]$$$ is $$$(1+5+6)/3 = 12/3 = 4$$$, so $$$f([1,5,6]) = 4$$$.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^3$$$)— the number of test cases. Each test case consists of two lines. The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$-10^9 \le a_i \le 10^9$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$3\cdot10^5$$$.

For each test case, print a single value — the maximum value that Ezzat can achieve. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)
func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=0;u<t;u++ {
		a := []int{}
		var temp int
		var n int
		fmt.Fscan(in,&n)
		var sum int64
		sum = 0
		mx := -math.MaxInt32
		for i:=0;i<n;i++{
			fmt.Fscan(in,&temp)
			a = append(a,temp)
			sum += int64(temp)
			if mx<temp{
				mx = temp
			}
		}
		ans := float64(sum-int64(mx))/float64(n-1) + float64(mx)
		fmt.Fprintln(out,ans)
	}
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+5)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a[:n])
		fmt.Fprintf(w, "%.9f", w1)
		fmt.Fprintln(w)
	}
}

func do(n int, a []int) float64 {
	max := a[0]
	s := int64(0)
	for i := 0; i < n; i++ {
		s += int64(a[i])
		if a[i] > max {
			max = a[i]
		}
	}
	return float64(s-int64(max))/float64(n-1) + float64(max)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	tc := readInt(in)

	for i := 0; i < tc; i++ {
        n := readInt(in)
        arr := readArrInt64(in)

        max := arr[0]
        total := arr[0]
        for j := 1; j < n; j++ {
            total += arr[j]
            if arr[j] > max {
                max = arr[j]
            }
        }
        total -= max
        fmt.Println(float64(total)/float64(n-1)+float64(max))
	}
}

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

package main

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

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

	scan := func(a ...interface{}) (int, error)             { return fmt.Fscan(ins, a...) }
	printf := func(s string, a ...interface{}) (int, error) { return fmt.Fprintf(out, s, a...) }
	var l int
	scan(&l)
	for i:=0; i<l; i++ {
		var n int
		scan(&n)
		sum:= int64(0)
		max := int64(-2000000000)
		for i := 0; i < n; i++ {
			var el int64
			scan(&el)
			if el > max{
				max = el
			}
			sum+= el
		}
		sum-=max
		printf("%g\n", float64(max) + (float64(sum)/float64(n-1)))
	}
}

package main

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

func hand(err error){
	if err != nil {
		panic(err)
	}
}

func main() {
	in  :=  bufio . NewReader ( os.Stdin )
	out  :=  bufio . NewWriter ( os.Stdout )
	defer  out . Flush ()
	var t,n int
	_, err := fmt.Fscan(in,&t)
	hand(err)
	for ca:=1;ca<=t;ca++ {
		_, err := fmt.Fscan(in,&n)
		hand(err)
		arr := make([]float64, n)
		for i:=0;i<n;i++ {
			_, err = fmt.Fscan(in,&arr[i])
			hand(err)
		}
		sort.Float64s(arr)
		total :=0.0
		for i:=0;i<n-1;i++{
			total+=arr[i]
		}
		total/=float64(n-1)
		total+=arr[n-1]
		_, err = fmt.Fprintf(out,"%.6f\n",total)
		hand(err)
	}
}

package main

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

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

	for ca:=1;ca<=t;ca++ {
		fmt.Fscan(in,&n)

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

		}
		sort.Float64s(arr)
		total :=0.0
		for i:=0;i<n-1;i++{
			total+=arr[i]
		}
		total/=float64(n-1)
		total+=arr[n-1]
		fmt.Fprintf(out,"%.6f\n",total)

	}
}

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

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

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func _string() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int64()
		a := make([]int64, n)
		for i := range a {
			a[i] = _int64()
		}
		printf("%v\n", sol(n, a))
	}
}

func sol(n int64, a []int64) float64 {
	max := a[0]
	total := int64(0)
	for i := range a {
		if a[i] > max {
			max = a[i]
		}
		total += a[i]
	}
	rem := total - max
	return float64(max) + float64(rem)/float64(len(a)-1)
}

package main

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

func main() {
	defer _w.Flush()
    t := ReadInt()

    for tc:=0; tc<t; tc+=1{
        n := ReadInt()
        a := ReadInts(n)

        var maxi float64 = -1e9
        var sum float64 = 0
        for i:=0; i<n; i+=1{
            maxi = math.Max(maxi, float64(a[i]))
            sum += float64(a[i]);
        }

        sum -= float64(maxi)
        sum /= float64(n-1)
        printf("%.9f\n",sum+maxi);
    }
}

var _r, _w = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func print(a ...interface{})            { fmt.Fprint(_w, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(_w, f, a...) }
func println(a ...interface{}) {
	for i, v := range a {
		if i > 0 {
			print(" ")
		}
		if k := reflect.ValueOf(v).Kind(); k == reflect.Slice || k == reflect.Array {
			s := fmt.Sprint(v)
			v = s[1 : len(s)-1]
		}
		print(v)
	}
	print("\n")
}
func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(_r, a...); err != nil {
		panic(err)
	}
}
func ReadString() (s string)   { Scan(&s); return }
func ReadInt() (i int)         { Scan(&i); return }
func ReadFloat64() (f float64) { Scan(&f); return }
func ReadInts(n int) (a []int) {
	for i := 0; i < n; i++ {
		a = append(a, ReadInt())
	}
	return
}

package main

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

func solve1() {
	n := getInt()
	a := getNint(n)
	mx := a[0]
	sum := int64(0)
	for i := range a {
		if i == 0 {
			mx = a[i]
		} else {
			mx = max(a[i], mx)
		}
		sum += a[i]
	}
	ans := float64(mx)
	if n > 1 {
		ans += float64(sum-mx) / float64(n-1)
	}
	fmt.Fprintf(OUT, "%.8f\n", ans)
}

func main() {
	defer OUT.Flush()
	tt := int64(1)
	tt = getInt()
	for tt > 0 {
		solve1()
		tt--
	}
}

type Input struct {
	*bufio.Scanner
}

var OUT = bufio.NewWriter(os.Stdout)

var IN = func() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return Input{Scanner: sc}
}()

func getInt() int64 {
	IN.Scan()
	x, _ := strconv.ParseInt(IN.Text(), 10, 64)
	return x
}
func getInt32() int {
	IN.Scan()
	x, _ := strconv.Atoi(IN.Text())
	return x
}
func getInt32Ok() (int, bool) {
	ok := IN.Scan()
	x, _ := strconv.Atoi(IN.Text())
	return x, ok
}
func getIntOk() (int64, bool) {
	ok := IN.Scan()
	x, _ := strconv.ParseInt(IN.Text(), 10, 64)
	return x, ok
}
func getNint32(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = getInt32()
	}
	return v
}
func getNint(n int64) []int64 {
	len := int(n)
	v := make([]int64, len)
	for i := 0; i < len; i++ {
		v[i] = getInt()
	}
	return v
}
func getVint(v []int64) bool {
	var ok bool
	for i := 0; i < len(v); i++ {
		v[i], ok = getIntOk()
	}
	return ok
}
func getWord() string {
	IN.Scan()
	return IN.Text()
}
func getWordOk() (string, bool) {
	ok := IN.Scan()
	return IN.Text(), ok
}

func min32(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max32(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func minStr(a, b string) string {
	if a < b {
		return a
	}
	return b
}
func maxStr(a, b string) string {
	if a < b {
		return b
	}
	return a
}
func abs32(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}
func assert(cond bool) {
	if !cond {
		panic("assertion failed")
	}
}

package main

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

func solve1() {
	n := getInt()
	a := make([]int64, n)
	mx := int64(-1)
	for i := range a {
		a[i] = getInt64()
		if i == 0 {
			mx = a[i]
		} else {
			mx = max64(a[i], mx)
		}
	}
	sumothers := int64(0)
	countmax := 0
	for _, x := range a {
		if x == mx {
			countmax++
			if countmax != 1 {
				sumothers += x
			}
		} else {
			sumothers += x
		}
	}
	ans := float64(mx)
	if n > 1 {
		ans += float64(sumothers) / float64(n-1)
	}
	fmt.Fprintf(OUT, "%.8f\n", ans)
}

func main() {
	defer OUT.Flush()
	tt := 1
	tt = getInt()
	for tt > 0 {
		solve1()
		tt--
	}
}

type Input struct {
	*bufio.Scanner
}

var OUT = bufio.NewWriter(os.Stdout)

var IN = func() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return Input{Scanner: sc}
}()

func getInt64() int64 {
	IN.Scan()
	x, _ := strconv.ParseInt(IN.Text(), 10, 64)
	return x
}
func getInt() int {
	IN.Scan()
	x, _ := strconv.Atoi(IN.Text())
	return x
}
func getIntOk() (int, bool) {
	ok := IN.Scan()
	x, _ := strconv.Atoi(IN.Text())
	return x, ok
}
func getNint(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = getInt()
	}
	return v
}
func getVint(v []int) bool {
	var ok bool
	for i := 0; i < len(v); i++ {
		v[i], ok = getIntOk()
	}
	return ok
}
func getWord() string {
	IN.Scan()
	return IN.Text()
}
func getWordOk() (string, bool) {
	ok := IN.Scan()
	return IN.Text(), ok
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func minStr(a, b string) string {
	if a < b {
		return a
	}
	return b
}
func maxStr(a, b string) string {
	if a < b {
		return b
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

type CF1557A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1557A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1557A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1557A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1557A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1557A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1557A
Date: 6/11/21
User: pepradere
URL: https://codeforces.com/problemset/problem/1557/A
Problem: CF1557A
**/
func (in *CF1557A) Run() {

	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt()
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}

		sort.Ints(arr)

		sum := float64(0)
		for i := 0; i < n-1; i++ {
			sum += float64(arr[i])
		}
		sol := float64(arr[n-1]) + (sum / float64(n-1))
		fmt.Printf("%.7f\n", sol)

	}
}

func NewCF1557A(r *bufio.Reader) *CF1557A {
	return &CF1557A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1557A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

	"math"

)

func run(r io.Reader ,w io.Writer){

	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)

	defer out.Flush()

	solve := func(){

		var n int

		fmt.Fscan(in , &n)

		arr := make([]int , n )
		//arr1 := make([]int , n)

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

		}

		//sort.Ints(arr)

		//fmt.Println("sort",arr)

		var maxi float64 = -1e9
        var sum float64 = 0
        for i:=0; i<n; i+=1{
            maxi = math.Max(maxi, float64(arr[i]))
            sum += float64(arr[i]);
        }

        sum -= float64(maxi)
        sum /= float64(n-1)
        fmt.Printf("%.9f\n",sum+maxi);

		}

	T := 1

	fmt.Fscan(in ,&T)

	for o := 0 ; o < T ; o++{
		solve()
	}

}

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t, n int
	fmt.Fscan(in, &t)
	for ca := 0; ca < t; ca++ {
		fmt.Fscan(in, &n)
		arr := make([]float64, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Float64s(arr)
		total := 0.0
		for i := 0; i < n-1; i++ {
			total += arr[i]
		}
		total /= float64(n - 1)
		total += arr[n-1]
		fmt.Fprintf(out, "%.6f\n", total)

	}
}

package main

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

var iost *Iost

type Iost struct {
	Scanner *bufio.Scanner
	Writer  *bufio.Writer
}

func NewIost(fp io.Reader, wfp io.Writer) *Iost {
	const BufSize = 1000000
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, BufSize), BufSize)
	return &Iost{Scanner: scanner, Writer: bufio.NewWriter(wfp)}
}

func (i *Iost) Text() string {
	if !i.Scanner.Scan() {
		panic("scan failed")
	}
	return i.Scanner.Text()
}

func (i *Iost) Atoi(s string) int                 { x, _ := strconv.Atoi(s); return x }
func (i *Iost) GetNextInt() int                   { return i.Atoi(i.Text()) }
func (i *Iost) Atoi64(s string) int64             { x, _ := strconv.ParseInt(s, 10, 64); return x }
func (i *Iost) GetNextInt64() int64               { return i.Atoi64(i.Text()) }
func (i *Iost) Atof64(s string) float64           { x, _ := strconv.ParseFloat(s, 64); return x }
func (i *Iost) GetNextFloat64() float64           { return i.Atof64(i.Text()) }
func (i *Iost) Print(x ...interface{})            { fmt.Fprint(i.Writer, x...) }
func (i *Iost) Printf(s string, x ...interface{}) { fmt.Fprintf(i.Writer, s, x...) }
func (i *Iost) Println(x ...interface{})          { fmt.Fprintln(i.Writer, x...) }
func isLocal() bool                               { return os.Getenv("I") == "IronMan" }

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	if isLocal() {
		fp, _ = os.Open(os.Getenv("END_GAME"))
	}
	iost = NewIost(fp, wfp)
	defer func() {
		if isLocal() {
			iost.Println(recover())
		}
		iost.Writer.Flush()
	}()
	solve()
	for i := 0; isLocal() && i < 100; i++ {
		iost.Println("-----------------------------------")
		solve()
	}
}

func solve() {
	t := iost.GetNextInt()
	for t > 0 {
		t--
		func() {
			n := iost.GetNextInt()
			var sum int64
			var maxA int64 = math.MinInt64
			for i := 0; i < n; i++ {
				a := iost.GetNextInt64()
				sum += a
				if maxA < a {
					maxA = a
				}
			}
			// iost.Println(sum, maxA)
			iost.Println(fmt.Sprintf("%.8f", float64(((sum)+maxA*int64((n-2))))/float64((n-1))))
		}()
	}
}

// https://www.cnblogs.com/hl-fc/p/15123081.html

package main

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

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

	tmpLine, _ := reader.ReadString('\n')

	testCount, _ := strconv.Atoi(strings.TrimSpace(tmpLine))

	for i := 0; i < testCount; i++ {
		reader.ReadString('\n')
		tmpLine, _ = reader.ReadString('\n')
		fmt.Println(solve(strings.Split(strings.TrimSpace(tmpLine), " ")))
	}
}

func solve(ss []string) float64 {
	var sum float64
	max, _ := strconv.Atoi(ss[0])
	var tmp int
	for i := range ss {
		if tmp, _ = strconv.Atoi(ss[i]); max < tmp {
			max = tmp
		}
		sum += float64(tmp)
	}
	return (sum-float64(max))/float64(len(ss)-1)+float64(max)
}

package main

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

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

	tmpLine, _ := reader.ReadString('\n')
	testCount := strings.TrimSpace(tmpLine)

	testCountInt, _ := strconv.Atoi(testCount)

	for i := 0; i < testCountInt; i++ {
		_, _ = reader.ReadString('\n')
		tmpLine, _ = reader.ReadString('\n')
		ints := stringToInt(strings.Split(strings.TrimSpace(tmpLine), " "))
		sort.Ints(ints)
		fmt.Println(float64(ints[len(ints)-1]) + sred(ints[:len(ints)-1]))
	}
}

func stringToInt(ss []string) []int {
	res := make([]int, len(ss))
	for i := range ss {
		res[i], _ = strconv.Atoi(ss[i])
	}
	return res
}

func sred(ii []int) float64 {
	var summ float64
	for i := range ii {
		summ += float64(ii[i])
	}
	return summ / float64(len(ii))
}

package main

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

func main() {
	r := bufio.NewReaderSize(os.Stdin, 1024*1024)

	var T, n int
	fmt.Fscanf(r, "%d\n", &T)

	for t := 0; t < T; t++ {
		fmt.Fscanf(r, "%d\n", &n)

		arr := make([]int64, n)
		sum := int64(0)
		for i := 0; i < n; i++ {
			fmt.Fscanf(r, "%d", &arr[i])
			sum += arr[i]
		}
		fmt.Fscanf(r, "\n")

		sort.Slice(arr, func(i, j int) bool {
			return arr[i] < arr[j]
		})

		x := int64(0)
		res := float64(0.0)
		for i := 0; i < len(arr); i++ {
			x += arr[i]
			sum -= arr[i]

			v := float64(x)/float64(i+1) + float64(sum)/float64(n-i-1)
			if i == 0 || v > res {
				res = v
			}
		}

		fmt.Printf("%.9f\n", res)
	}
}

package main
import(
    "fmt"
    "bufio"
    "os"
    "sort"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Fscan(in,&n)
		list:= make([]float64,n)
		for j:=0;j<n;j++{
			fmt.Fscan(in,&list[j])
		}
		sort.Float64s(list)
		var sum float64
		for j:=0;j<n-1;j++{
			sum+=list[j]
		}
		fmt.Fprintln(out,(sum/(float64(n)-1))+list[n-1])
	}
}

package main

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

func solve(r *bufio.Reader) {
	var n int
	fmt.Fscan(r, &n)

	var max, tmp int64
	fmt.Fscan(r, &max)
	total := max

	for i := 0; i < n-1; i++ {
		fmt.Fscan(r, &tmp)
		total += tmp

		if tmp > max {
			max = tmp
		}
	}
	total -= max
	fmt.Println(float64(total)/float64(n-1) + float64(max))
}
func main() {
	r := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(r, &n)
	for i := 0; i < n; i++ {
		solve(r)
	}
}

package main

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

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N, n := 0, 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		fmt.Fscan(f, &n)
		mx, sum := float64(math.MinInt64), float64(0)
		for j := 0; j < n; j++ {
			p := float64(0)
			fmt.Fscan(f, &p)
			if p > mx {
				mx = p
			}
			sum += p
		}
		fmt.Fprintln(w, mx+((sum-mx)/float64(n-1)))
	}
	w.Flush()
}

func main() {
	solve()
}

package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t, n   int
)

func solve(n int, a []int) float64 {
	sort.Ints(a)
	v := float64(0)
	for i := 0; i < n-1; i++ {
		v += float64(a[i])
	}
	return v/float64(n-1) + float64(a[n-1])
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		a := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(n, a))
	}
}

package main

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

func main() {
	in:=bufio.NewReader(os.Stdin)
	out:=os.Stdout
	var t int
	fmt.Fscan(in, &t)
	for i := 0;i<t;i++ {
		var temp []int
		var n int
		fmt.Fscan(in,&n)
		var sum int64
		sum =0
		var a int
		for j := 0;j<n;j++ {
			fmt.Fscan(in,&a)
			temp=append(temp,a)
			sum += int64(a)
		}
		sort.Ints(temp)
		ans:=float64(sum-int64(temp[n-1]))/float64(n-1)+float64(temp[n-1])
		fmt.Fprintln(out, ans)
	}
}

// Go file
/***********************************************
# @Author: Charmber - charmber@qq.com
# @Create Time: 2021-08-15 16:42:11
# @Last Modified: 2021-08-15 16:42:11
***********************************************/

package main

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

const REPEAT bool = true
const CASE bool = false

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

	if REPEAT {
		var t int
		Fscan(in, &t)
		for i := 1; i <= t; i++ {
			if CASE {
				Fprintf(out, "Case #%d: ", i)
			}
			solve(in, out)
		}
	} else {
		solve(in, out)
	}
}

func solve(in io.Reader, out io.Writer) {
	var n int
	Fscan(in, &n)
	var arr = make([]int, n)
  var mxm = math.MinInt32
  var sum = 0.0
  for i := 0; i < n; i++ {
    Fscan(in, &arr[i])
    sum += float64(arr[i])
    if mxm < arr[i] {
      mxm = arr[i]
    }
  }
  sum -= float64(mxm)
  var avg = sum / float64(n - 1)
  Fprint(out, avg + float64(mxm))
	Fprintln(out)
}

package main

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

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })

func MIN(x, y int64) int64 {
	if x > y {
		return y
	} else {
		return x
	}
}

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

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

func MAX(x, y int64) int64 {
	if x > y {
		return x
	} else {
		return y
	}
}

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

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	if x*y == 0 {
		return MAX(x, y)
	} else {
		var l, q int64
		l = MAX(x, y)
		q = MIN(x, y)
		var m int64
		for l*q > 0 {
			a := l % q
			b := l - a
			cc := int64(b / q)
			remain := l - cc*q
			l = MAX(remain, q)
			q = MIN(remain, q)
			if l*q == 0 {
				m = l + q
				break
			}

		}
		return m
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		var n int
		fmt.Fscan(input, &n)
		var sum int64
		ARR := make([]int64, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(input, &ARR[i])
			sum = sum + ARR[i]
		}
		var ANS float64 = -3000000000

		sort.Slice(ARR, func(i, j int) bool {
			return ARR[i] > ARR[j]
		})
		var first, second int64
		var num int64 = 0
		second = sum
		for i := 0; i < n-1; i++ {
			num++
			first = first + ARR[i]
			second = second - ARR[i]
			q := float64(first)/float64(num) + float64(second)/(float64(n)-float64(num))
			if q > ANS {
				ANS = q
			}
		}
		fmt.Println(ANS)

	}

}

package main

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

var in = NewIn()
var out = NewOut()

func main() {
	defer out.flush()

	tests()
	// solve()
}

/* --- Solution A --- */
func solve() {
	n := in.nextInt()

	nums := make([]int, n)
	for i := 0; i < n; i++ {
		v := in.nextInt()
		nums[i] = v
	}

	sort.Slice(nums, func(i, j int) bool { return nums[i] < nums[j] })

	avg := 0.
	for i := 0; i < n-1; i++ {
		avg += (float64(nums[i]) - avg) / float64(i+1)
	}
	avg += float64(nums[n-1])
	out.println(avg)
}

func tests() {
	tt := in.nextInt()
	for ; tt > 0; tt-- {
		solve()
	}
}

/* --- I/O --- */
type In struct {
	scanner *bufio.Scanner
}

func NewIn() *In {
	in := In{bufio.NewScanner(os.Stdin)}
	in.scanner.Split(bufio.ScanWords)
	return &in
}

func (in *In) nextInt() int {
	in.scanner.Scan()
	i, _ := strconv.Atoi(in.scanner.Text())
	return i
}

func (in *In) nextLong() int64 {
	in.scanner.Scan()
	i, _ := strconv.ParseInt(in.scanner.Text(), 10, 64)
	return i
}

func (in *In) next() string {
	in.scanner.Scan()
	return in.scanner.Text()
}

type Out struct {
	writer *bufio.Writer
}

func NewOut() *Out {
	out := Out{bufio.NewWriter(os.Stdout)}
	return &out
}

func (out *Out) println(a ...interface{}) {
	fmt.Fprintln(out.writer, a...)
}

func (out *Out) printf(format string, a ...interface{}) {
	fmt.Fprintf(out.writer, format, a...)
}

func (out *Out) print(a ...interface{}) {
	fmt.Fprint(out.writer, a...)
}

func (out *Out) flush() {
	out.writer.Flush()
}

package main

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

func main() {

	r := bufio.NewReader(os.Stdin)

	var t int
	fmt.Fscan(r, &t)

	for i := 0; i < t; i++ {
		var n int
		fmt.Fscan(r, &n)

		a := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Fscan(r, &a[j])
		}

		ans := solve(a, n)

		fmt.Printf("%.6f", ans)
		fmt.Println()
	}
}

func solve(a []int, n int) float64 {
	sort.Ints(a)

	var s float64
	for j := 0; j < n-1; j++ {
		s += float64(a[j])
	}
	med := s / float64(n-1)

	return med + float64(a[n-1])

}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)
func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=0;u<t;u++ {
		a := []int{}
		var temp int
		var n int
		fmt.Fscan(in,&n)
		var sum int64
		sum = 0
		mx := -math.MaxInt32
		for i:=0;i<n;i++{
			fmt.Fscan(in,&temp)
			a = append(a,temp)
			sum += int64(temp)
			if mx<temp{
				mx = temp
			}
		}
		ans := float64((sum-int64(mx))/int64((n-1))) + float64(mx)
		fmt.Fprintln(out,ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)
func main() {
	in := bufio.NewReader(os.Stdin)
	out := os.Stdout
	var t int
	fmt.Fscan(in,&t)
	for u:=0;u<t;u++ {
		a := []int{}
		var temp int
		var n int
		fmt.Fscan(in,&n)
		sum := 0
		mx := -math.MaxInt32
		for i:=0;i<n;i++{
			fmt.Fscan(in,&temp)
			a = append(a,temp)
			sum += temp
			if mx<temp{
				mx = temp
			}
		}
		ans := float64(sum-mx)/float64(n-1) + float64(mx)
		fmt.Fprintln(out,ans)
	}
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)
func run(_r io.Reader, _w io.Writer){
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for c:=0;c<t;c++{
		var n int
		fmt.Fscan(in,&n)
		a := []int64{}
		for i:=0;i<n;i++{
			var ip int64
			fmt.Fscan(in,&ip)
			a = append(a,ip)
		}
		fmt.Fprintln(out,maxans(a))
	}
}
func maxans(a []int64) float64{
	ans := -float64(math.MaxInt64)
	sum := [100005]int64{}
	//fmt.Println(a)
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=a[i]
			continue
		}
		sum[i]=sum[i-1]+a[i]
	}
	for i:=0;i<len(a)-1;i++{
		temp := float64(sum[i])/float64(i+1) + float64(sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}

//	fmt.Println(ans)
	return ans
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)
func run(_r io.Reader, _w io.Writer){
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for c:=0;c<t;c++{
		var n int
		fmt.Fscan(in,&n)
		a := []int64{}
		for i:=0;i<n;i++{
			var ip int64
			fmt.Fscan(in,&ip)
			a = append(a,ip)
		}
		fmt.Fprintln(out,maxans(a))
	}
}
func maxans(a []int64) float64{
	ans := -float64(math.MaxInt32)
	sum := [100005]int64{}
	//fmt.Println(a)
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=a[i]
			continue
		}
		sum[i]=sum[i-1]+a[i]
	}
	for i:=0;i<len(a)-1;i++{
		temp := float64(sum[i])/float64(i+1) + float64(sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
//	fmt.Println(ans)
	return ans
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)
func run(_r io.Reader, _w io.Writer){
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for c:=0;c<t;c++{
		var n int
		fmt.Fscan(in,&n)
		a := []int64{}
		for i:=0;i<n;i++{
			var ip int64
			fmt.Fscan(in,&ip)
			a = append(a,ip)
		}
		fmt.Fprintln(out,maxans(a))
	}
}
func maxans(a []int64) float64{
	ans := -float64(math.MaxInt32)
	sum := [100005]int64{}
	//fmt.Println(a)
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=a[i]
			continue
		}
		sum[i]=sum[i-1]+a[i]
	}
	for i:=0;i<len(a)-1;i++{
		temp := float64(sum[i]/int64(i+1)) + float64(sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	//fmt.Println(ans)
	return ans
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)
func run(_r io.Reader, _w io.Writer){
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for c:=0;c<t;c++{
		var n int
		fmt.Fscan(in,&n)
		a := []int{}
		for i:=0;i<n;i++{
			var ip int
			fmt.Fscan(in,&ip)
			a = append(a,ip)
		}
		fmt.Fprintln(out,maxans(a))
	}
}
func maxans(a []int) float64{
	ans := -float64(math.MaxInt32)
	sum := [100005]float64{}
	//fmt.Println(a)
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"io/ioutil"
	"math"
	"os"
)
func run(_r io.Reader, _w io.Writer){
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for ;t>=0;t--{
		var n int
		fmt.Fscan(in,&n)
		a := []int{}
		for i:=0;i<n;i++{
			var ip int
			fmt.Fscan(in,&ip)
			a = append(a,ip)
		}
		fmt.Fprintln(out,maxans(a))
	}
	ioutil.ReadAll(in)
}
func maxans(a []int) float64{
	ans := -float64(math.MaxInt32)
	sum := [100005]float64{}
	//fmt.Println(a)
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)
func run(_r io.Reader, _w io.Writer){
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	var t int
	for fmt.Fscan(in,&t);t>=0;t--{
		var n int
		fmt.Fscan(in,&n)
		a := []int{}
		for i:=0;i<n;i++{
			var ip int
			fmt.Fscan(in,&ip)
			a = append(a,ip)
		}
		fmt.Fprintln(out,maxans(a))
	}
}
func maxans(a []int) float64{
	ans := -float64(math.MaxInt32)
	sum := [100005]float64{}
	//fmt.Println(a)
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
)
func run(_r io.Reader, _w io.Writer){
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	var t int
	for fmt.Fscan(in,&t);t>=0;t--{
		var n int
		fmt.Fscan(in,&n)
		a := []int{}
		for i:=0;i<n;i++{
			var ip int
			fmt.Fscan(in,&ip)
			a = append(a,ip)
		}
		fmt.Fprintln(out,maxans(a))
	}
}
func maxans(a []int) float64{
	ans := -float64(math.MaxInt32)
	sum := [100005]float64{}
	//fmt.Println(a)
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	fmt.Println(ans)
	return ans
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

import "fmt"

func maxans(a []int) float64{
	ans := 0.0
	sum := [100005]float64{}
	fmt.Println(a)
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	var t int
	fmt.Scanf("%d",&t)
	for u:=1;u<=t;u++{
		var n int
		fmt.Scanf("%d",&n)
		a := []int{}
		for i:=1;i<=n;i++{
			var temp int
			fmt.Scanf("%d",&temp)
			a = append(a, temp)
		}
		fmt.Printf("%.f\n",maxans(a))
	}
}

package main

import "fmt"

func maxans(a []int) float64{
	ans := 0.0
	sum := [100005]float64{}
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			fmt.Println(a[i],sum[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	var t int
	fmt.Scanf("%d",&t)
	for u:=1;u<=t;u++{
		var n int
		fmt.Scanf("%d",&n)
		a := []int{}
		for i:=1;i<=n;i++{
			var temp int
			fmt.Scanf("%d",&temp)
			a = append(a, temp)
		}
		fmt.Printf("%.f\n",maxans(a))
	}
}

package main

import "fmt"

func maxans(a []int) float64{
	ans := 0.0
	sum := [100005]float64{}
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	fmt.Printf("%.f, %.f,%.f",sum[0],sum[1],sum[2])
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	var t int
	fmt.Scanf("%d",&t)
	for u:=1;u<=t;u++{
		var n int
		fmt.Scanf("%d",&n)
		a := []int{}
		for i:=1;i<=n;i++{
			var temp int
			fmt.Scanf("%d",&temp)
			a = append(a, temp)
		}
		fmt.Printf("%.f\n",maxans(a))
	}
}

package main

import "fmt"

func maxans(a []int) float64{
	ans := 0.0
	sum := [100005]float64{}
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	fmt.Println(sum[0],sum[1],sum[2])
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	var t int
	fmt.Scanf("%d",&t)
	for u:=1;u<=t;u++{
		var n int
		fmt.Scanf("%d",&n)
		a := []int{}
		for i:=1;i<=n;i++{
			var temp int
			fmt.Scanf("%d",&temp)
			a = append(a, temp)
		}
		fmt.Println(maxans(a))
	}
}

package main

import "fmt"

func maxans(a []int) float64{
	ans := 0.0
	sum := [100005]float64{}
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	var t int
	fmt.Scanf("%d",&t)
	for u:=1;u<=t;u++{
		var n int
		fmt.Scanf("%d",&n)
		a := []int{}
		for i:=1;i<=n;i++{
			var temp int
			fmt.Scanf("%d",&temp)
			a = append(a, temp)
		}
		fmt.Println(maxans(a))
	}
}

package main

import "fmt"

func maxans(a []int) float64{
	ans := -99999.0
	sum := [100005]float64{}
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	var t int
	fmt.Scanf("%d",&t)
	for u:=1;u<=t;u++{
		var n int
		fmt.Scanf("%d",&n)
		a := []int{}
		for i:=1;i<=n;i++{
			var temp int
			fmt.Scanf("%d",&temp)
			a = append(a, temp)
		}
		fmt.Println(maxans(a))
	}
}

package main

import "fmt"

func maxans(a []int) float64{
	ans := -99999999.0
	sum := [100005]float64{}
	for i:=0;i<len(a);i++{
		if(i==0){
			sum[i]=float64(a[i])
			continue
		}
		sum[i]=sum[i-1]+float64(a[i])
	}
	for i:=0;i<len(a)-1;i++{
		temp := sum[i]/float64(i+1) + (sum[len(a)-1]-sum[i])/float64(len(a)-i-1)
		if temp > ans{
			ans = temp
		}
	}
	return ans
}
func main() {
	var t int
	fmt.Scanf("%d",&t)
	for u:=1;u<=t;u++{
		var n int
		fmt.Scanf("%d",&n)
		a := []int{}
		for i:=1;i<=n;i++{
			var temp int
			fmt.Scanf("%d",&temp)
			a = append(a, temp)
		}
		fmt.Println(maxans(a))
	}
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+5)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a[:n])
		fmt.Fprintf(w, "%f", w1)
		fmt.Fprintln(w)
	}
}

func do(n int, a []int) float64 {
	max := a[0]
	s := 0
	for i := 0; i < n; i++ {
		s += a[i]
		if a[i] > max {
			max = a[i]
		}
	}
	return float64(s-max)/float64(n-1) + float64(max)
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+5)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1, _ := do(n, a[:n])
		fmt.Fprintf(w, "%f", w1)
		fmt.Fprintln(w)
	}
}

func do(n int, a []int) (float64, int) {
	sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
	for i := 1; i < n; i++ {
		a[i] += a[i-1]
	}
	var w1 float64
	var w2 int
	for l := 1; l < n; l++ {
		b := (n - l) * l
		c := a[n-1] * int(l)
		if v := n - 2*l; v >= 0 {
			c += int(v) * (a[n-1] - a[n-l-1])
		} else {
			c += int(v) * a[l-1]
		}
		if n == 1e5 && l == 1 {
			fmt.Println(c, b, n, l, a[n-1], (a[n-1] - a[n-l-1]))
		}
		w := float64(c) / float64(b)
		if w2 == 0 || w > w1 {
			w1, w2 = w, l
		}
	}
	return w1, w2
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+5)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1, _ := do(n, a[:n])
		fmt.Fprintf(w, "%f", w1)
		fmt.Fprintln(w)
	}
}

func do(n int, a []int) (float64, int) {
	sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
	for i := 1; i < n; i++ {
		a[i] += a[i-1]
	}
	var w1 float64
	var w2 int
	for l := 1; l < n; l++ {
		b := (n - l) * l
		c := a[n-1] * int(l)
		if v := n - 2*l; v >= 0 {
			c += int(v) * (a[n-1] - a[n-l-1])
		} else {
			c += int(v) * a[l-1]
		}
		if l == 1 {
			fmt.Println(c, b, n, l, a[n-1], (a[n-1] - a[n-l-1]))
		}
		w := float64(c) / float64(b)
		if w2 == 0 || w > w1 {
			w1, w2 = w, l
		}
	}
	return w1, w2
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+5)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1, _ := do(n, a[:n])
		fmt.Fprintf(w, "%f", w1)
		fmt.Fprintln(w)
	}
}

func do(n int, a []int) (float64, int) {
	sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })
	for i := 1; i < n; i++ {
		a[i] += a[i-1]
	}
	var w1 float64
	var w2 int
	for l := 1; l < n; l++ {
		b := (n - l) * l
		c := a[n-1] * int(l)
		if v := n - 2*l; v >= 0 {
			c += int(v) * (a[n-1] - a[n-l-1])
		} else {
			c += int(v) * a[l-1]
		}
		w := float64(c) / float64(b)
		if w2 == 0 || w > w1 {
			w1, w2 = w, l
		}
	}
	return w1, w2
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+1)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a[:n])
		fmt.Fprintf(w, "%f", w1)
		fmt.Fprintln(w)
	}
}

func do(n int, a []int) float64 {
	sort.Ints(a)
	for i := n - 2; i >= 0; i-- {
		a[i] += a[i+1]
	}
	var w1 float64
	var w2 bool
	for l := 1; l < n; l++ {
		b := n*l - l*l
		c := a[0] * l
		if v := n - 2*l; v >= 0 {
			c += v * a[n-l]
		} else {
			c += v * (a[0] - a[l])
		}
		w := float64(c) / float64(b)
		if !w2 || cmp(w, w1) > 0 {
			w1, w2 = w, true
		}
	}
	return w1
}

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

func cmp(a, b float64) int {
	diff := a - b
	if math.Abs(diff)/max(1, math.Abs(b)) <= 1e-6 {
		return 0
	}
	if diff > 0 {
		return 1
	}
	return -1
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+1)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a[:n])
		fmt.Fprintf(w, "%.9f", w1)
		fmt.Fprintln(w)
	}
}

func do(n int, a []int) float64 {
	sort.Ints(a)
	for i := n - 2; i >= 0; i-- {
		a[i] += a[i+1]
	}
	var w1 float64
	var w2 bool
	for l := 1; l < n; l++ {
		b := n*l - l*l
		c := a[0] * l
		if v := n - 2*l; v >= 0 {
			c += v * a[n-l]
		} else {
			c += v * (a[0] - a[l])
		}
		w := float64(c) / float64(b)
		if !w2 || cmp(w, w1) > 0 {
			w1, w2 = w, true
		}
	}
	return w1
}

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

func cmp(a, b float64) int {
	diff := a - b
	if math.Abs(diff)/max(1, math.Abs(b)) <= 1e-6 {
		return 0
	}
	if diff > 0 {
		return 1
	}
	return -1
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+1)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a[:n])
		fmt.Fprintf(w, "%.9f", w1)
		fmt.Fprintln(w)
	}
}

// max(avg(b)+avg(c))
func do(n int, a []int) float64 {
	sort.Ints(a)
	for i := n - 2; i >= 0; i-- {
		a[i] += a[i+1]
	}
	var w1 float64
	var w2 bool
	for l := 1; l < n; l++ {
		b := n*l - l*l
		c := a[0] * l
		if v := n - 2*l; v >= 0 {
			c += v * a[n-l]
		} else {
			c += v * (a[0] - a[l])
		}
		w := float64(c) / float64(b)
		if !w2 || cmp(w, w1) > 0 {
			w1, w2 = w, true
		}
	}
	return w1
}

func cmp(a, b float64) int {
	diff := a - b
	if math.Abs(diff) <= 1e-6 {
		return 0
	}
	if diff > 0 {
		return 1
	}
	return -1
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+1)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a[:n])
		fmt.Fprintf(w, "%.9f", w1)
		fmt.Fprintln(w)
	}
}

// max(avg(b)+avg(c))
func do(n int, a []int) float64 {
	sort.Ints(a)
	for i := n - 2; i >= 0; i-- {
		a[i] += a[i+1]
	}
	var w1 float64
	var w2 bool
	for l := 1; l < n; l++ {
		b := n*l - l*l
		a := (n-2*l)*a[n-l] + a[0]*l
		w := float64(a) / float64(b)
		if !w2 || w > w1 {
			w1, w2 = w, true
		}
	}
	for l := 1; l < n; l++ {
		b := n*l - l*l
		a := (n-2*l)*(a[0]-a[l]) + a[0]*l
		w := float64(a) / float64(b)
		if !w2 || w > w1 {
			w1, w2 = w, true
		}
	}
	return w1
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t, n int
	a := make([]int, 1e5+1)

	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		fmt.Fscan(r, &n)
		for i := 0; i < n; i++ {
			fmt.Fscan(r, &a[i])
		}
		w1 := do(n, a[:n])
		fmt.Fprintf(w, "%.9f", w1)
		fmt.Fprintln(w)
	}
}

// max(avg(b)+avg(c))
func do(n int, a []int) float64 {
	sort.Ints(a)
	for i := n - 2; i >= 0; i-- {
		a[i] += a[i+1]
	}
	var w1 float64
	var w2 bool
	for l := 1; l < n; l++ {
		b := n*l - l*l
		a := (n-2*l)*a[l] + a[0]*l
		w := float64(a) / float64(b)
		if !w2 || w > w1 {
			w1 = w
		}
	}
	for l := 1; l < n; l++ {
		b := n*l - l*l
		a := (n-2*l)*(a[0]-a[l]) + a[0]*l
		w := float64(a) / float64(b)
		if !w2 || w > w1 {
			w1 = w
		}
	}
	return w1
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	tc := readInt(in)

	for i := 0; i < tc; i++ {
        n := readInt(in)
        arr := readArrInt(in)

        max := arr[0]
        total := arr[0]
        for j := 1; j < n; j++ {
            total += arr[j]
            if arr[j] > max {
                max = arr[j]
            }
        }
        total -= max
        fmt.Println(float64(total)/float64(n-1)+float64(max))
	}
}

func readInt(in *bufio.Reader) int {
	nStr, _ := in.ReadString('\n')
	nStr = strings.ReplaceAll(nStr, "\r", "")
	nStr = strings.ReplaceAll(nStr, "\n", "")
	n, _ := strconv.Atoi(nStr)
	return n
}

func readLineNumbs(in *bufio.Reader) []string {
	line, _ := in.ReadString('\n')
	line = strings.ReplaceAll(line, "\r", "")
	line = strings.ReplaceAll(line, "\n", "")
	numbs := strings.Split(line, " ")
	return numbs
}

func readArrInt(in *bufio.Reader) []int {
	numbs := readLineNumbs(in)
	arr := make([]int, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.Atoi(n)
		arr[i] = val
	}
	return arr
}

func readArrInt64(in *bufio.Reader) []int64 {
	numbs := readLineNumbs(in)
	arr := make([]int64, len(numbs))
	for i, n := range numbs {
		val, _ := strconv.ParseInt(n, 10, 64)
		arr[i] = val
	}
	return arr
}

package main

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

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

	scan := func(a ...interface{}) (int, error)             { return fmt.Fscan(ins, a...) }
	printf := func(s string, a ...interface{}) (int, error) { return fmt.Fprintf(out, s, a...) }
	var l int
	scan(&l)
	for i:=0; i<l; i++ {
		var n int
		scan(&n)
		sum:= 0
		max := -2000000000
		for i := 0; i < n; i++ {
			var el int
			scan(&el)
			if el > max{
				max = el
			}
			sum+= el
		}
		sum-=max
		printf("%g\n", float64(max) + float64(sum)/float64(n-1))
	}
}

package main

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

func hand(err error){
	if err != nil {
		panic(err)
	}
}

func main() {
	in  :=  bufio . NewReader ( os.Stdin )
	out  :=  bufio . NewWriter ( os.Stdout )
	defer  out . Flush ()
	var t,n int
	_, err := fmt.Fscan(in,&t)
	hand(err)
	for ca:=1;ca<=t;ca++ {
		_, err := fmt.Fscan(in,&n)
		hand(err)
		arr := make([]float64, n)
		for i:=0;i<n;i++ {
			_, err = fmt.Fscan(in,&arr[i])
			hand(err)
		}
		sort.Float64s(arr)
		total :=0.0
		for i:=0;i<n-1;i++{
			total+=arr[i]
		}
		total/=float64(n-1)
		total+=arr[n-1]
		_, err = fmt.Fprintf(out,"%.4f\n",total)
		hand(err)
	}
}

package main

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

func main() {
	var t,n int
	fmt.Fscan(os.Stdin,&t)

	for ca:=1;ca<=t;ca++ {
		fmt.Fscan(os.Stdin,&n)

		arr := make([]float64, n)
		for i:=0;i<n;i++ {
			fmt.Fscan(os.Stdin,&arr[i])

		}
		sort.Float64s(arr)
		total :=0.0
		for i:=0;i<n-1;i++{
			total+=arr[i]
		}
		total/=float64(n-1)
		total+=arr[n-1]
		fmt.Fprint(os.Stdout,total)

	}
}

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

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

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func _string() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		a := make([]int, n)
		for i := range a {
			a[i] = _int()
		}
		printf("%v\n", sol(n, a))
	}
}

func sol(n int, a []int) float64 {
	max := a[0]
	total := 0
	for i := range a {
		if a[i] > max {
			max = a[i]
		}
		total += a[i]
	}
	rem := total - max
	return float64(max) + float64(rem)/float64(len(a)-1)
}

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

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

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func _string() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		a := make([]int, n)
		for i := range a {
			a[i] = _int()
		}
		printf("%.10f\n", sol(n, a))
	}
}

func sol(n int, a []int) float64 {
	max := a[0]
	total := 0
	for i := range a {
		if a[i] > max {
			max = a[i]
		}
		total += a[i]
	}
	rem := total - max
	return float64(max) + float64(rem)/float64(len(a)-1)
}

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

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

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func _string() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		a := make([]int, n)
		for i := range a {
			a[i] = _int()
		}
		printf("%.7f\n", sol(n, a))
	}
}

func sol(n int, a []int) float64 {
	max := a[0]
	total := 0
	for i := range a {
		if a[i] > max {
			max = a[i]
		}
		total += a[i]
	}
	rem := total - max
	return float64(max) + float64(rem)/float64(len(a)-1)
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

const mxN int = 1e6
var a [mxN]int

func main() {
    defer writer.Flush()
    var t int
    scanf("%d\n", &t)

    for tc:=0; tc<t; tc+=1{
        var n int
        scanf("%d\n",&n)

        var maxi float64 = -1e9
        var sum float64 = 0
        for i:=0; i<n; i+=1{
            scanf("%d ", &a[i])
            maxi = math.Max(maxi, float64(a[i]))
            sum += float64(a[i]);
        }

        sum -= float64(maxi)
        sum /= float64(n-1)

        printf("%.9f\n",sum+maxi);
    }
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

const mxN int = 1e6
var a [mxN]int

func main() {
    defer writer.Flush()
    var t int
    fmt.Scan(&t)

    for tc:=0; tc<t; tc+=1{
        var n int
        scanf("%d\n",&n)

        var maxi float64 = -1e9
        var sum float64 = 0
        for i:=0; i<n; i+=1{
            scanf("%d ", &a[i])
            maxi = math.Max(maxi, float64(a[i]))
            sum += float64(a[i]);
        }

        sum -= float64(maxi)
        sum /= float64(n-1)

        printf("%.9f\n",sum+maxi);
    }
}

package main

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

func solve1() {
	n := getInt()
	a := make([]int, n)
	mx := -1
	for i := range a {
		a[i] = getInt()
		if i == 0 {
			mx = a[i]
		} else {
			mx = max(a[i], mx)
		}
	}
	sumothers := 0
	countmax := 0
	for _, x := range a {
		if x == mx {
			countmax++
			if countmax != 1 {
				sumothers += x
			}
		} else {
			sumothers += x
		}
	}
	ans := float64(mx)
	if n > 1 {
		ans += float64(sumothers) / float64(n-1)
	}
	fmt.Fprintf(OUT, "%.8f\n", ans)
}

func main() {
	defer OUT.Flush()
	tt := 1
	tt = getInt()
	for tt > 0 {
		solve1()
		tt--
	}
}

type Input struct {
	*bufio.Scanner
}

var OUT = bufio.NewWriter(os.Stdout)

var IN = func() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return Input{Scanner: sc}
}()

func getInt64() int64 {
	IN.Scan()
	x, _ := strconv.ParseInt(IN.Text(), 10, 64)
	return x
}
func getInt() int {
	IN.Scan()
	x, _ := strconv.Atoi(IN.Text())
	return x
}
func getIntOk() (int, bool) {
	ok := IN.Scan()
	x, _ := strconv.Atoi(IN.Text())
	return x, ok
}
func getNint(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = getInt()
	}
	return v
}
func getVint(v []int) bool {
	var ok bool
	for i := 0; i < len(v); i++ {
		v[i], ok = getIntOk()
	}
	return ok
}
func getWord() string {
	IN.Scan()
	return IN.Text()
}
func getWordOk() (string, bool) {
	ok := IN.Scan()
	return IN.Text(), ok
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func minStr(a, b string) string {
	if a < b {
		return a
	}
	return b
}
func maxStr(a, b string) string {
	if a < b {
		return b
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

package main

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

type CF1557A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1557A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1557A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1557A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1557A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1557A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1557A
Date: 6/11/21
User: pepradere
URL: https://codeforces.com/problemset/problem/1557/A
Problem: CF1557A
**/
func (in *CF1557A) Run() {

	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt()
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}

		//sort.Ints(arr)
		sum := make([]int, n)
		sum[0] = arr[0]
		for i := 1; i < n; i++ {
			sum[i] = sum[i-1] + arr[i]
		}
		var max *float64
		for i := 0; i < n-1; i++ {
			a := float64(sum[i]) / float64(i+1)
			b := float64(sum[n-1]-sum[i]) / float64(n-i-1)
			if max == nil {
				sol := a + b
				max = &sol
			} else {
				sol := math.Max(*max, a+b)
				max = &sol
			}

		}

		fmt.Printf("%.7f\n", *max)

	}
}

func NewCF1557A(r *bufio.Reader) *CF1557A {
	return &CF1557A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1557A(bufio.NewReader(os.Stdin)).Run()
}

package main

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

type CF1557A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1557A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1557A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1557A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1557A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1557A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1557A
Date: 6/11/21
User: pepradere
URL: https://codeforces.com/problemset/problem/1557/A
Problem: CF1557A
**/
func (in *CF1557A) Run() {

	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt()
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			arr[i] = in.NextInt()
		}

		sort.Ints(arr)
		sum := make([]int, n)
		sum[0] = arr[0]
		for i := 1; i < n; i++ {
			sum[i] = sum[i-1] + arr[i]
		}
		var max *float64
		for i := 0; i < n-1; i++ {
			a := float64(sum[i]) / float64(i+1)
			b := float64(sum[n-1]-sum[i]) / float64(n-i-1)
			if max == nil {
				sol := a + b
				max = &sol
			} else {
				sol := math.Max(*max, a+b)
				max = &sol
			}

		}

		fmt.Printf("%.7f\n", *max)

	}
}

func NewCF1557A(r *bufio.Reader) *CF1557A {
	return &CF1557A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1557A(bufio.NewReader(os.Stdin)).Run()
}

package main

import(
	"fmt"
	"bufio"
	"io"
	"os"
	"sort"

)
	var SUM int64
	var RES float64

func run(r io.Reader ,w io.Writer){

	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)

	defer out.Flush()

	solve := func(){

		var n int

		fmt.Fscan(in , &n)

		arr := make([]int , n )
		arr1 := make([]int , n)

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

		}

		sort.Ints(arr)

		//fmt.Println("sort",arr)

		for i := 0 ; i < len(arr) ; i++{

				x := []int{}

					if i == 0 {
					temp := arr[i]
					arr1 =arr[i+1:]
					calAvg(temp, arr1)
					}else{
							temp := arr[i]
							arr1 = arr[0:i]
							//fmt.Println("arr before values",arr1)
							x = append(x,arr1...)
							//fmt.Println("arr append1 after values",x)
							arr1 = arr[i+1:]
							x = append(x,arr1...)
							//fmt.Println("arr append2 after values",x)
							//fmt.Println("arr after values",arr1)
							//fmt.Println("temp value",temp)
							calAvg(temp, x)
					}

		}

		fmt.Println(RES * 0.000001)

	}

	T := 1

	fmt.Fscan(in ,&T)

	for o := 0 ; o < T ; o++{
		solve()
	}

}

func calAvg(a int , arr []int){
		SUM  = 0.0
		RES = 0.0
		var avg float64 = 0
		n := len(arr)
		for i := 0 ; i < n ; i++{
		  SUM += int64(arr[i])
		}

		avg = ( float64(SUM) / (float64(n))) + (float64(a))

		if avg > RES || avg < 0{
			RES = float64(avg)
		}

}

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

package main

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

var iost *Iost

type Iost struct {
	Scanner *bufio.Scanner
	Writer  *bufio.Writer
}

func NewIost(fp io.Reader, wfp io.Writer) *Iost {
	const BufSize = 1000000
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, BufSize), BufSize)
	return &Iost{Scanner: scanner, Writer: bufio.NewWriter(wfp)}
}

func (i *Iost) Text() string {
	if !i.Scanner.Scan() {
		panic("scan failed")
	}
	return i.Scanner.Text()
}

func (i *Iost) Atoi(s string) int                 { x, _ := strconv.Atoi(s); return x }
func (i *Iost) GetNextInt() int                   { return i.Atoi(i.Text()) }
func (i *Iost) Atoi64(s string) int64             { x, _ := strconv.ParseInt(s, 10, 64); return x }
func (i *Iost) GetNextInt64() int64               { return i.Atoi64(i.Text()) }
func (i *Iost) Atof64(s string) float64           { x, _ := strconv.ParseFloat(s, 64); return x }
func (i *Iost) GetNextFloat64() float64           { return i.Atof64(i.Text()) }
func (i *Iost) Print(x ...interface{})            { fmt.Fprint(i.Writer, x...) }
func (i *Iost) Printf(s string, x ...interface{}) { fmt.Fprintf(i.Writer, s, x...) }
func (i *Iost) Println(x ...interface{})          { fmt.Fprintln(i.Writer, x...) }
func isLocal() bool                               { return os.Getenv("I") == "IronMan" }

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	if isLocal() {
		fp, _ = os.Open(os.Getenv("END_GAME"))
	}
	iost = NewIost(fp, wfp)
	defer func() {
		if isLocal() {
			iost.Println(recover())
		}
		iost.Writer.Flush()
	}()
	solve()
	for i := 0; isLocal() && i < 100; i++ {
		iost.Println("-----------------------------------")
		solve()
	}
}

func solve() {
	t := iost.GetNextInt()
	for t > 0 {
		t--
		func() {
			n := iost.GetNextInt()
			sum := 0
			maxA := -1000000001
			for i := 0; i < n; i++ {
				a := iost.GetNextInt()
				sum += a
				if maxA < a {
					maxA = a
				}
			}
			// iost.Println(sum, maxA)
			iost.Println(fmt.Sprintf("%.8f", float64(((sum)+maxA*(n-2)))/float64((n-1))))
		}()
	}
}

package main

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

func main() {
	r := bufio.NewReaderSize(os.Stdin, 1024*1024)

	var T, n int
	fmt.Fscanf(r, "%d\n", &T)

	for t := 0; t < T; t++ {
		fmt.Fscanf(r, "%d\n", &n)

		fmt.Println(n)

		arr := make([]int64, n)
		sum := int64(0)
		for i := 0; i < n; i++ {
			fmt.Fscanf(r, "%d", &arr[i])
			sum += arr[i]
		}
		fmt.Fscanf(r, "\n")

		sort.Slice(arr, func(i, j int) bool {
			return arr[i] < arr[j]
		})

		x := int64(0)
		res := float64(0.0)
		for i := 0; i < len(arr); i++ {
			x += arr[i]
			sum -= arr[i]

			v := float64(x)/float64(i+1) + float64(sum)/float64(n-i-1)
			if i == 0 || v > res {
				res = v
			}
		}

		fmt.Printf("%.9f\n", res)
	}
}


Suppose you are living with two cats: A and B. There are $$$n$$$ napping spots where both cats usually sleep.Your cats like to sleep and also like all these spots, so they change napping spot each hour cyclically:   Cat A changes its napping place in order: $$$n, n - 1, n - 2, \dots, 3, 2, 1, n, n - 1, \dots$$$ In other words, at the first hour it's on the spot $$$n$$$ and then goes in decreasing order cyclically;  Cat B changes its napping place in order: $$$1, 2, 3, \dots, n - 1, n, 1, 2, \dots$$$ In other words, at the first hour it's on the spot $$$1$$$ and then goes in increasing order cyclically. The cat B is much younger, so they have a strict hierarchy: A and B don't lie together. In other words, if both cats'd like to go in spot $$$x$$$ then the A takes this place and B moves to the next place in its order (if $$$x < n$$$ then to $$$x + 1$$$, but if $$$x = n$$$ then to $$$1$$$). Cat B follows his order, so it won't return to the skipped spot $$$x$$$ after A frees it, but will move to the spot $$$x + 2$$$ and so on.Calculate, where cat B will be at hour $$$k$$$?

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first and only line of each test case contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 10^9$$$; $$$1 \le k \le 10^9$$$) — the number of spots and hour $$$k$$$.

For each test case, print one integer — the index of the spot where cat B will sleep at hour $$$k$$$.

NoteIn the first and second test cases $$$n = 2$$$, so:   at the $$$1$$$-st hour, A is on spot $$$2$$$ and B is on $$$1$$$;  at the $$$2$$$-nd hour, A moves to spot $$$1$$$ and B — to $$$2$$$.  If $$$n = 3$$$ then:   at the $$$1$$$-st hour, A is on spot $$$3$$$ and B is on $$$1$$$;  at the $$$2$$$-nd hour, A moves to spot $$$2$$$; B'd like to move from $$$1$$$ to $$$2$$$, but this spot is occupied, so it moves to $$$3$$$;  at the $$$3$$$-rd hour, A moves to spot $$$1$$$; B also would like to move from $$$3$$$ to $$$1$$$, but this spot is occupied, so it moves to $$$2$$$. In the sixth test case:   A's spots at each hour are $$$[5, 4, 3, 2, 1]$$$;  B's spots at each hour are $$$[1, 2, 4, 5, 2]$$$.

// link: https://codeforces.com/problemset/problem/1487/B
//
// finding: even number both cat wont reach the same spot, odd number will
// more detail solution explanation: https://www.youtube.com/watch?v=ceOIfdS33hs
// n=5, k=10
// A -> 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1
// B -> 1 2 x 4 5 x 2 3 x 5 1 x 3 4 x 1 2 4 5 2 3 5 1 3 4
// B will meet A once 2 steps

package main

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

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var cases int
	fmt.Fscan(in, &cases)

	for i := 0; i < cases; i++ {
		var n, k int
		fmt.Fscan(in, &n, &k)

		var stepsToAdd int
		if n%2 != 0 {
			stepBMeetA := n / 2

			if k%stepBMeetA == 0 {
				stepsToAdd = (k / stepBMeetA) - 1
			} else {
				stepsToAdd = (k / stepBMeetA)
			}
		}

		spotB := (k + stepsToAdd) % n
		if spotB == 0 {
			spotB = n
		}

		fmt.Fprintln(out, spotB)
	}
}

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

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func print(a ...interface{})            { fmt.Fprint(writer, a...) }
func scan(a ...interface{})             { fmt.Fscan(reader, a...) }

func main() {
	defer writer.Flush()
	////////////////////
	var count int
	scan(&count)
	for count != 0 {
		solve()
		count--
	}

}

func solve() {
	p, t := 0, 0
	scan(&p, &t)
	if p%2 == 0 {
		if t%p == 0 {
			print(p, "\n")
			return
		}
		print(t%p, "\n")
		return
	} else {
		period := p / 2
		//print("Period: ", period, "\n")
		r := (t + (t-1)/period) % p
		if r == 0 {
			r = p
		}
		print(r, "\n")
	}
	return
}

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1487B(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	var T, n, k int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &k)
		k--
		if n&1 == 0 {
			Fprintln(out, k%n+1)
		} else {
			Fprintln(out, (k+k/(n/2))%n+1)
		}
	}
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1487B(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, n, k int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &k)
		k--
		if n&1 == 0 {
			Fprintln(out, k%n+1)
			continue
		}
		delta := k / (n / 2)
		Fprintln(out, (k+delta)%n+1)
	}
}

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

// 00
package main

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

func write(f *bufio.Writer, a ...interface{}) {
	f.Write([]byte(fmt.Sprint(a...)))
}

type Number interface {
	int64 | float64 | int
}

func min[K Number](a K, b K) K {
	if a < b {
		return a
	}
	return b
}
func max[K Number](a K, b K) K {
	if a > b {
		return a
	}
	return b
}
func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n, k int
		fmt.Fscan(reader, &n, &k)
		if n%2 == 0 {
			pos := k
			if pos%n == 0 {
				pos = n
			} else {
				pos = pos % n
			}
			write(f, pos, "\n")
		} else {
			half := (n / 2)
			rounds := (k - 1) / half
			pos := 1 + (half+1)*rounds + (k-1)%half
			if pos%n == 0 {
				pos = n
			} else {
				pos = pos % n
			}
			write(f, pos, "\n")
		}
	}
}

package main

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

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

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var n, k int64
		fmt.Fscan(in, &n, &k)
		k--
		z := n / 2
		fmt.Fprintln(out, (k+(n%2)*k/z)%n+1)
	}
}

package main

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

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

	tc := readNum(reader)

	var buf bytes.Buffer

	for tc > 0 {
		tc--
		n, k := readTwoNums(reader)
		res := solve(n, k)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	fmt.Print(buf.String())
}

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, k int) int {
	k--
	f := n / 2
	x := (k + (n&1)*(k/f)) % n
	return x + 1
}

package main

import "fmt"

func main() {
	t := 0
	fmt.Scan(&t)
	for ; t > 0; t-- {
		n, k := 0, 0
		fmt.Scan(&n, &k)
		ans1 := 0
		if (n % 2) == 1 {
			ans1 = ((k - 1 + ((k - 1) / (n / 2))) % n) + 1
		} else {
			ans1 = ((k - 1) % n) + 1
		}
		fmt.Println(ans1)
	}
}

package main

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

func main() {
	var tcs int
	in := bufio.NewReader(os.Stdin)
	_, _ = fmt.Fscan(in, &tcs)

	for tc := 0; tc < tcs; tc++ {
		var n, k int64
		_, _ = fmt.Fscan(in, &n, &k)

		ans := int64(0)
		if (n % 2) == 0 {
			ans = k % n
		} else {
			m := n / 2
			ans = 1
			k--
			ans += (k / m) * (m + 1)
			ans += k % m
			ans %= n
		}
		if ans == 0 {
			ans += n
		}
		fmt.Println(ans)
	}
}

package main

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

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

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

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}

}

// sort.Slice(arr, func(i, j int) bool {
// 	return arr[i] > arr[j]
// })
var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var n int
		var k int
		fmt.Fscan(input, &n)
		fmt.Fscan(input, &k)

		if n%2 == 0 {
			p := k % n
			if p == 0 {
				fmt.Println(n)
			} else {
				fmt.Println(p)
			}
		} else {
			l := int((n - 1) / 2)

			m := int((k - 1) / l)
			gecenyoly := 1 + m*(l+1) + ((k - 1) % l)
			pp := gecenyoly % n
			if pp == 0 {
				fmt.Println(n)
			} else {
				fmt.Println(pp)
			}

		}

	}

}

package main

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

var (
	writer  = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
)

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

func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}

func sint64() int64 {
	s := sstring()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

func sint64s(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = sint64()
	}
	return a
}

func sstring() string {
	if !scanner.Scan() {
		panic(scanner.Err())
	}
	return scanner.Text()
}

func main() {
	defer writer.Flush()
	for t := sint64(); t > 0; t-- {
		n := sint64()
		k := sint64()
		printf("%d\n", sol(n, k))
	}
}

func sol(n, k int64) int64 {
	if n&1 == 0 {
		return 1 + ((k-1) % n)
	}
	meet := (k - 1) / (n / 2)
	return ((k - 1 + meet) % n) + 1
}

package main

import (
	"fmt"
	"log"
	"os"
	"strings"
)

type bufferedReader struct {
	buf     [4096]byte
	ptr, sz int
	eof     bool
	ended   bool
	in      *os.File
}

func newReader(in *os.File) bufferedReader {
	var tmp [4096]byte
	return bufferedReader{tmp, 0, 0, false, false, in}
}

func (r *bufferedReader) isEof() bool {
	return r.eof
}

func (r *bufferedReader) load() {
	if r.ended {
		r.eof = true
		return
	}
	sz, err := r.in.Read(r.buf[:])
	r.sz = sz
	if sz < 4096 {
		r.ended = true
	}
	if err != nil {
		log.Fatal(err)
	}
	r.ptr = 0
}

func (r *bufferedReader) getChar() byte {
	if r.ptr == r.sz && !r.eof {
		r.load()
	}
	if r.ptr == r.sz || r.eof {
		r.eof = true
		return 0
	}
	r.ptr += 1
	return r.buf[r.ptr-1]
}

func (r *bufferedReader) skipNonIntChars() {
	for {
		c := r.getChar()
		if r.eof {
			break
		}
		if (c >= 48 && c <= 57) || (c == 45) {
			r.ptr -= 1
			break
		}
	}
}

func (r *bufferedReader) skipWhitespace() {
	for {
		c := r.getChar()
		if r.eof {
			break
		}
		if c != ' ' && c != '\n' && c != '\t' && c != '\r' {
			r.ptr -= 1
			break
		}
	}
}

func (r *bufferedReader) readInt() int {
	r.skipNonIntChars()
	var ans int = 0
	var neg bool = false
	fst := r.getChar()
	if fst == 45 {
		neg = true
	} else {
		ans = int(fst) - 48
	}
	for {
		c := r.getChar()
		if r.eof {
			break
		}
		if c >= 48 && c <= 57 {
			ans = ans*10 + int(c-48)
		} else {
			r.ptr -= 1
			break
		}
	}
	if neg {
		ans = -ans
	}
	return ans
}

func (r *bufferedReader) readString() string {
	r.skipWhitespace()
	sz := 0
	capacity := 2
	s := make([]byte, 2)
	for {
		c := r.getChar()
		if r.eof {
			break
		}
		if c == ' ' || c == '\n' || c == '\t' || c == '\r' {
			r.ptr--
			break
		}
		if sz == capacity {
			capacity <<= 1
			s1 := make([]byte, capacity)
			for i := 0; i < sz; i++ {
				s1[i] = s[i]
			}
			s = s1
		}
		s[sz] = c
		sz++
	}
	return string(s[:sz])
}

func main() {
	var in bufferedReader
	hostname, err := os.Hostname()
	if err != nil {
		log.Fatal(err)
	}
	if strings.HasSuffix(hostname, "lenovo") {
		file, _ := os.Open("input.txt")
		in = newReader(file)
	} else {
		in = newReader(os.Stdin)
	}
	T := in.readInt()
	for t := 0; t < T; t++ {
		n := in.readInt()
		k := in.readInt()
		if n%2 == 0 {
			fmt.Printf("%d\n", (k-1)%n+1)
		} else {
			k--
			p := (n - 1) >> 1
			m := k % p
			full := k / p
			ans := int64(full) * int64(p+1)
			ans += int64(m)
			ans = ans%int64(n) + 1
			fmt.Printf("%d\n", ans)
		}
	}
}

// link: https://codeforces.com/problemset/problem/1487/B
// 5 25
// A -> 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1
// B -> 1 2 4 5 2 3 5 1 3 4 1 2 4 5 2 3 5 1 3 4 1 2 4 5 2
//
// 3 9
// A -> 1 2 3 1 2 3 1 2 3
// B -> 3 1 2 3 1 2 3 1 2
//
// 2 4
// A -> 1 2 1 2
// B -> 2 1 2 1
//
// 6 12
// A -> 1 2 3 4 5 6 1 2 3 4 5 6
// B -> 6 5 4 3 2 1 6 5 4 3 2 1
//
// 7 28
// A -> 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7
// B -> 7 6 5 3 2 1 6 5 4 2 1 7 5 4 3 1 7 6 4 3 2 7 6 5 3 2 1 6
//
// finding: even number both cat wont reach the same spot, odd number will

package main

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

func logic(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var cases int
	fmt.Fscan(in, &cases)

	for i := 0; i < cases; i++ {
		var n, k int
		fmt.Fscan(in, &n, &k)

		a := n
		b := 1

		for j := 1; j < k; j++ {
			a--
			if a == 0 {
				a = n
			}

			b++
			if b > n {
				b = 1
			}
			if b == a {
				b++
			}
		}

		fmt.Fprintln(out, b)
	}
}

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

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func print(a ...interface{})            { fmt.Fprint(writer, a...) }
func scan(a ...interface{})             { fmt.Fscan(reader, a...) }

func main() {
	defer writer.Flush()
	////////////////////
	var count int
	scan(&count)
	for count != 0 {
		solve()
		count--
	}

}

func solve() {
	p, t := 0, 0
	scan(&p, &t)
	if p%2 == 0 {
		if t%p == 0 {
			print(p, "\n")
			return
		}
		print(t%p, "\n")
		return
	} else {
		period := p / 2
		r := t%p + t/period
		if p == 3 {
			if t%3 == 1 {
				print(1, "\n")
				return
			}
			if t%3 == 2 {
				print(3, "\n")
				return
			}
			if t%3 == 0 {
				print(2, "\n")
				return
			}
		}
		print(r, "\n")
	}
	return
}

package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }
func print(a ...interface{})            { fmt.Fprint(writer, a...) }
func scan(a ...interface{})             { fmt.Fscan(reader, a...) }

func main() {
	defer writer.Flush()
	////////////////////
	var count int
	scan(&count)
	for count != 0 {
		solve()
		count--
	}

}

func solve() {
	p, t := 0, 0
	scan(&p, &t)
	if p%2 == 0 {
		if t%p == 0 {
			print(p, "\n")
			return
		}
		print(t%p, "\n")
		return
	} else {
		period := p / 2
		r := t%p + t/period
		if p == 3 {
			print(r-1, "\n")
			return
		}
		print(r, "\n")
	}
	return
}