var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

const INF = 2e14;

function main () {
	let T = rn();
	while (T--) {
		let n = rn();
		let c = rna();
		c.unshift(0);

		let ans = INF, mno = c[1], mne = c[2], sm = c[1];
		for (let l = 2; l <= n; l++) {
			const k = Math.floor((l - 1)/2);

			const mn = l%2 ? mne : mno;
			const pthl = l%2 ? n-k+1 : n-k;

			const cost = pthl*mn + sm-mn + (n-k)*c[l];

			if (l%2 == 0)
				mne = Math.min(mne, c[l]);
			else
				mno = Math.min(mno, c[l]);

			sm += c[l];

			ans = Math.min(ans, cost);
		}

		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

const INF = 1e20 + 1;

function main () {
	let T = rn();
	while (T--) {
		let n = rn();
		let c = rna();
		c.unshift(0);

		let ans = INF, mno = c[1], mne = c[2], sm = c[1];
		for (let l = 2; l <= n; l++) {
			const k = Math.floor((l - 1)/2);

			const mn = l%2 ? mne : mno;
			const pthl = l%2 ? n-k+1 : n-k;

			const cost = pthl*mn + sm-mn + (n-k)*c[l];
			//console.log('cost', cost, 'sm', sm, 'k', k);

			if (l%2 == 0)
				mne = Math.min(mne, c[l]);
			else
				mno = Math.min(mno, c[l]);

			sm += c[l];

			ans = Math.min(ans, cost);
		}

		console.log(ans);
	}
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main();
var mod = 1000000000n + 7n
var maxN = 10e6 + 1

function main() {
  var x = parseInt(readline())

  Array(parseInt(x)).fill(1).map((t, iii) => {
    var n = parseInt(readline())
    // var [n, k1, k2] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // });
    var a = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    });
    // var a = readline()
    var array = []
    var array2 = []

    var sum = new Array(n)
    sum[0] = a[0]
    for (let i = 1; i < n; i++) {
      sum[i] = sum[i - 1] + a[i]
    }

    var answer = Number.MAX_SAFE_INTEGER
    var minX = 10e8
    var minXI = 0
    var minY = 10e8
    var minYI = 0

    for (let i = 0; i < n; i++) {
      if (i % 2 === 0) {
        if (a[i] < minX) {
          minX = a[i]
          minXI = i
        }
      }
      if (i % 2 === 1) {
        if (a[i] < minY) {
          minY = a[i]
          minYI = i
        }
      }
      var mult1 = i % 2 === 0 ? (n - Math.floor(i / 2)-1) : (n - Math.floor(i / 2)-1)
      var mult2 = i % 2 === 1 ? (n - Math.floor(i / 2)-1): (n - Math.floor(i / 2))
      // var mult2 =
      answer = Math.min(answer, sum[i] + minX * mult1 + minY * mult2)
      // console.log(answer, minX, mult1, minY, mult2)
    }
    console.log(answer)

  });
}

function getInt(num){
    return parseInt(num, 10)
}

var t = parseInt(readline(), 10);

for(var i = 0; i<t; i++){
    var line1 = readline().split(' ').map(getInt);
    var line2 = readline().split(' ').map(getInt);
    print(solution(line1[0], line2));
}
function solution(n, arr){

    var minWayOdd = arr[0] * n;
    var minWayEven = arr[1] * n;
    var paramsOdd = {
        min: arr[0],
        res: minWayOdd,
        n: n,
        restArrLength: 0,
    }
    var paramsEven = {
        min: arr[1],
        res: minWayEven,
        n: n,
        restArrLength: 0,
    }
    var res = minWayOdd + minWayEven;

    for(var k = 3; k<=n; k++){
        if(k%2 === 1){
            paramsOdd = minWayLinear2(paramsOdd, arr[k-1]);
        }else{
            paramsEven = minWayLinear2(paramsEven, arr[k-1]);
        }
        minWayOdd = paramsOdd.res;
        minWayEven = paramsEven.res;
        res = Math.min(res, minWayOdd + minWayEven);
    }

    return res;
}

function minWayLinear2(data, newNum){
    var newRes;
    if(newNum < data.min){
        newRes =  data.res + ( data.n - data.restArrLength - 1) * newNum + (data.restArrLength + 1 - data.n) * data.min;

    }else{
        newRes =  data.res - data.min + newNum;
    }
    var params = {
        min: Math.min(newNum, data.min),
        res: newRes,
        n: data.n,
        restArrLength: data.restArrLength + 1,
    }
    return params;
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

const INF = 1e14 + 1;

function main () {
	let T = rn();
	while (T--) {
		let n = rn();
		let c = rna();
		c.unshift(0);

		let ans = INF, mno = c[1], mne = c[2], sm = c[1];
		for (let l = 2; l <= n; l++) {
			const k = Math.floor((l - 1)/2);

			const mn = l%2 ? mne : mno;
			const pthl = l%2 ? n-k+1 : n-k;

			const cost = pthl*mn + sm-mn + (n-k)*c[l];
			//console.log('cost', cost, 'sm', sm, 'k', k);

			if (l%2 == 0)
				mne = Math.min(mne, c[l]);
			else
				mno = Math.min(mno, c[l]);

			sm += c[l];

			ans = Math.min(ans, cost);
		}

		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

const INF = 1e9+1;

function main () {
	let T = rn();
	while (T--) {
		let n = rn();
		let c = rna();
		c.unshift(0);

		let ans = INF, mno = c[1], mne = c[2], sm = c[1];
		for (let l = 2; l <= n; l++) {
			const k = Math.floor((l - 1)/2);

			const mn = l%2 ? mne : mno;
			const pthl = l%2 ? n-k+1 : n-k;

			const cost = pthl*mn + sm-mn + (n-k)*c[l];
			//console.log('cost', cost, 'sm', sm, 'k', k);

			if (l%2 == 0)
				mne = Math.min(mne, c[l]);
			else
				mno = Math.min(mno, c[l]);

			sm += c[l];

			ans = Math.min(ans, cost);
		}

		console.log(ans);
	}
}

function getInt(num){
    return parseInt(num, 10)
}

var t = parseInt(readline(), 10);

for(var i = 0; i<t; i++){
    var line1 = readline().split('').map(getInt);
    var line2 = readline().split(' ').map(getInt);
    print(solution(line1[0], line2));
}
function solution(n, arr){
    var res = -1;
    var odd = [];
    var even = [];
    var minWay;

    for(var k = 2; k <=n; k++){
        odd = [];
        even = [];
        for(var l = 0; l< k; l+= 2){
            odd.push(arr[l]);
        }
        for(var s = 1; s < k; s+= 2){
            even.push(arr[s]);
        }

        minWay = minWayLinear(even, n) + minWayLinear(odd, n);

        if(res < 0){
            res = minWay;
            continue;
        }

        res = Math.min(res, minWay);
    }

    return res;
}

function minWayLinear(arr, n){
    var res = 0;
    var min = arr[0];
    arr.forEach(function(item){
        if(item < min){
            min = item;
        }
        res+=item;
    })

    res -= min;

    res += (n - (arr.length - 1)) * min;

    return res;
}

function getInt(num){
    return parseInt(num, 10)
}

var t = parseInt(readline(), 10);

for(var i = 0; i<t; i++){
    var line1 = readline().split('').map(getInt);
    var line2 = readline().split(' ').map(getInt);
    print(solution(line1[0], line2));
}
function solution(n, arr){
    var res = -1;
    var odd = [];
    var even = [];
    var minWay;

    for(var k = 2; k <=n; k++){
        odd = [];
        even = [];
        for(var l = 0; l< k; l+= 2){
            odd.push(arr[l]);
        }
        for(var l = 1; l < k; l+= 2){
            even.push(arr[l]);
        }

        minWay = minWayLinear(even, n) + minWayLinear(odd, n);

        if(res < 0){
            res = minWay;
            continue;
        }

        res = Math.min(res, minWay);
    }

    return res;
}

function minWayLinear(arr, n){
    var res = 0;
    var min = arr[0];
    arr.forEach(function(item){
        if(item < min){
            min = item;
        }
        res+=item;
    })

    res -= min;

    res += (n - (arr.length - 1)) * min;

    return res;
}


process.stdin.setEncoding("ascii");
let input = "";
process.stdin.on("data", data => input += data);
process.stdin.on("end", () => {
    console.log(input.split("\n").filter(x => x.trim() !== "").filter((_, i) => i !== 0).filter((_, i) => i % 2 === 1).map(x => x.split(" ").map(Number)).map(x => x.reduce((acc, cur) => acc + cur) / x.length).map(Math.ceil).join("\n"));
})

var readline = require('readline');
var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
var STATE = 1;
var n, a, sum;
rl.on('line', function (input) {
  switch (STATE) {
    case 1:
      STATE = 2;
      break;
    case 2:
      n = parseInt(input, 10);
      sum = 0;
      // console.log(STATE + ':', a, a_t);
      STATE = 3;
      break;
    case 3:
      a = input.split(' ');
      for (var i = 0; i < n; i++) {
        sum += parseInt(a[i], 10)
      }
      console.log(Math.ceil(sum / n))
      STATE = 2;
      break;
    default:
      // code
  }
}).on('close', function() {
  process.exit(0);
});

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const q = parseInt(arr.shift())

  for(let i = 0; i < q; i++) {
    const n = parseInt(arr.shift())
    const a = arr.shift().split(' ')

    let sum = 0
    for(let j = 0; j < n; j++) {
      sum += parseInt(a[j])
    }

    console.log(Math.ceil(sum / n))
  }
})

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
  	var N = nextInt();
  	var list = nextIntArray();
  	var sum = 0;
  	for(var j = 0; j < N; j++){
  		sum += list[j];
  	}
  	output[i] = Math.ceil(sum / N);
  }
  myout(myconv(output, 9));
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL);

    function foo (data, n) {
        let result = data.reduce((a, b) => (a + b)) / data.length;
        result =  Math.ceil(result);
        return result;
    }

    let testCount = 1;
    let answer = '';
    while(testCount <= +lines[0]) {
        let data = lines[testCount * 2].split(" ").map(Number);
        let n = lines[testCount * 2 - 1].split(" ").map(Number);

        //console.log(data);
        //console.log(n);
        let result = foo(data, n);
        answer += result +"\n";
        testCount++;
    }
    console.log(answer);
})

'use strict'

const prices = (n, a) => {
    return Math.ceil(a.reduce((r, i) => r + i, 0) / n);
}

const q = parseInt(readline());
for (let i = 0; i < q; i++) {
    write(prices(parseInt(readline()), readline().split(' ').map(Number)) + '\n');
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (data) => {
  if (c === 0) {
    c++;
    return;
  }

  if (c % 2) {
    c++;
    return;
  }

  let arr = data.split(' ').map(Number);
  const sum = arr.reduce((a, b) => a + b, 0);
  console.log(Math.ceil(sum / arr.length));

  c++;
});

rl.on('close', () => {

});

var t=Number(readline());
for(var i=0;i<t;i++){
	var n=Number(readline());
	var str = readline().split(" ");
	var avg=0;
	for(var j=0;j<n;j++){
		avg=avg+Number(str[j]);
	}
	avg=Math.ceil(avg/n);
	print(avg);
}

var amount = +readline();
for (var i = 0; i < amount; i++){
    var am = +readline();
    print(Math.ceil(readline().split(" ").reduce(function (s,n) {
        return +s + +n
    })/am))

}

const input = [];

const RL = require('readline').createInterface({
   input : process.stdin,
   output : process.stdout
});

RL.on('line', line => input.push(line));

RL.on('close', () => {
  const [q] = input[0].split(' ').map(x => parseInt(x));

  for (let i = 1; i < q*2; i += 2) {
    let n = parseInt(input[i]);
    const nums = input[i+1].split(' ').map(x => parseInt(x));
    const sum = nums.reduce((prev, next) => prev + next, 0);

    console.log(Math.ceil(sum/n));
  }

});

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
    const q = readline();
    for(let i = 0;i<q;i++){
        calcQuery(readline(),readline().split(" ").map((value,index,array)=>{return parseInt(value)}));
    }
}

function calcQuery(count, values){
    let sum = 0;
    values.forEach(element => {
        sum += element;
    });
    let minsugest = Math.floor(sum/count);
    while(minsugest*count < sum) {
        minsugest++;
    }
    console.log(minsugest);
}

var numOfQueries = readline();
while (numOfQueries) {
  var length = readline();
  var nums = readline().split(" ").map(x => parseInt(x));
  var sum = nums.reduce((a, b) => a + b, 0);
  print(Math.ceil(sum / length))
  numOfQueries--;
}

let data = '';
process.stdin.on('data', c => data += c);

const solution = () => {
	let line = data.split('\n');
	let q = parseInt(line.shift(),10);
	let result = [];
	for(let i = 0; i < q; i++){
		let n = parseInt(line.shift(),10);
		let sum = line.shift().split(' ').map(v => parseInt(v,10)).reduce((s, e) => s + e);
		result.push(Math.ceil(sum/n));
	}
	console.log(result.join('\n'));
};

process.stdin.on('end', solution);

var q = parseInt(readline());
var ans = '';
while(q--) {
	var n = parseInt(readline());
	var arr = readline().split(' ');
	var r = 0;
	for (var i=0; i<n; i++) r += +arr[i];
	ans+=((n - r%n)%n + r)/n + '\n';
}
print(ans);

var queriesCount = parseInt(readline());

for (var i = 0; i < queriesCount; i++) {
  readline();
  var query = readline().split(' ').map(function (num) {
    return parseInt(num);
  })

  var average = query.reduce(function(acc, num) { return acc + num }, 0) / query.length
  var reminder = query.reduce(function(acc, num) { return acc + num }, 0) % query.length

  write(reminder ? (( Math.floor(average) + 1) + '\n') : (average + '\n'));
}

var count = +readline();
var allPrice;
var ans;
for (var i = 0; i < count; i++) {
    itemsCount = +readline();
    itemsPrices = readline().split(' ');
    allPrice = 0;
    for (var k = 0; k < itemsCount; k++) {
        allPrice += +itemsPrices[k];
    }
    ans = Math.ceil(allPrice / itemsCount);
    write(ans + "\n");
}

T = readline()
while (T--) {
  n = +(readline())
  s = readline().split(' ').map(x => +x).reduce((acc, x) => acc + x)
  print(Math.ceil(s / n))
}

//var input = readline()

var t = parseInt(readline());
for(var i=0; i<t; i++) {
    var s = 0;
    var n= parseInt(readline());
    var ar = readline().split(' ').map(x => parseInt(x));

    var sum = ar.reduce((a, b) => a + b)
    print(Math.ceil(sum/n));
}

//

var t=Number(readline());
for(var i=0;i<t;i++){
	var n=Number(readline());
	var str = readline();
	var avg=0;
	for(var j=0;j<str.length;j++){
		avg=avg+Number(str[j]);
	}
	avg=Math.ceil(avg/n);
	print(avg);
}

const nums = readline().split(" ").map(x => parseInt(x));
const sum = nums.reduce((a, b) => a + b, 0)
print(Math.ceil(sum / nums.length));

var numOfQueries = readline();
const res = []
while (numOfQueries) {
  var length = readline();
  var nums = readline().split(" ").map(x => parseInt(x));
  var sum = nums.reduce((a, b) => a + b, 0);
  res.push(Math.ceil(sum / length))
  numOfQueries--;
}

res.forEach(print)

var numOfQueries = readline();
// while (numOfQueries) {
//   var length = readline();
//   var nums = readline().split(" ").map(x => parseInt(x));
//   var sum = nums.reduce((a, b) => a + b, 0);
//   print(Math.ceil(sum / length)
//   numOfQueries--;
// }

var q = parseInt(readline());
var ans = '';
while(q--) {
	var n = parseInt(readline());
	var arr = readline().split(' ');
	var r = 0;
	for (var i=0; i<n; i++) r += +arr[i];
	ans+=(r%n + r)/n + '\n';
}
print(ans);

var queriesCount = parseInt(readline());

for (var i = 0; i < queriesCount; i++) {
  readline();
  var query = readline().split(' ').map(function (num) {
    return parseInt(num);
  })

  var average = query.reduce(function(acc, num) { return acc + num }, 0) / query.length
  var reminder = query.reduce(function(acc, num) { return acc + num }, 0) % query.length

  write(reminder ? Math.floor(average) + 1 : average);
}

var queriesCount = parseInt(readline());

for (var i = 0; i < queriesCount; i++) {
  readline();
  var query = readline().split(' ').map(function (num) {
    return parseInt(num);
  })

  var average = query.reduce(function(acc, num) { return acc + num }, 0) / query.length
  var reminder = query.reduce(function(acc, num) { return acc + num }, 0) % query.length

  write(reminder ? (( Math.floor(average) + 1) + '') : (average + ''));
}

var count = +readline();
var allPrice;
var ans;
for (var i = 0; i < count; i++) {
    itemsCount = +readline();
    itemsPrices = readline().split(' ');
    allPrice = 0;
    for (var k = 0; k < itemsCount; k++) {
        allPrice += +itemsPrices[k];
    }
    ans = Math.ceil(allPrice / itemsCount);
    write(ans);
}


let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  let nums = lines[1].split(' ');
  nums = nums.map(num => parseInt(num, 10));
  zeroArray(nums);
});

function zeroArray(nums) {
  // let sum = nums.reduce((a, b) => a + b, 0);
  let max = -1;
  let sum = 0;
  for (let i = 0; i < nums.length; i++) {
    max = Math.max(nums[i], max);
    sum += nums[i];
  }

  if (max <= sum - max && (sum % 2 === 0)) {
    console.log('YES');
  } else {
    console.log('NO');
  }
}

var n = +readline();
var arr = readline().split(' ').map(item => +item);

if(n === 2) {
  print(arr[0] === arr[1] ? 'YES' : 'NO');
} else {
  arr.sort((a, b) => b - a);
  var max = arr[0];
  var sum = arr.reduce((c, p) => c + p);
  print((sum - max >= max && sum % 2 === 0) ? 'YES' : 'NO');
}

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});
var count = 0;
rl.on('line', function (line) {
    if (count == 1) {
        var arr = line.trim().split(' ').map(Number);
        var sum = arr.reduce(function (a, b) { return a + b; });
        var max = Math.max.apply(Math, arr);
        console.log(!(sum % 2) && (max <= sum - max) ? "YES" : "NO");
    }
    count++;
});

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var A = rdArN();
    if (n === 1 && A[0] === 1) {
        wr('YES');
        return;
    }

    A.sortGt();
    var max = A[0];
    //pr(max);
    var sum = A.reduce((a,v)=>a+v, 0);
    //pr(sum);
    var isEven = sum%2 === 0;
    var isMaxNotSoBig = max <= (sum - max);
    wr(isEven && isMaxNotSoBig ? 'YES' : 'NO');
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

var n = +readline();
var arr = readline().split(' ').map(item => +item);

if(n === 2) {
  print(arr[0] === arr[1] ? 'YES' : 'NO');
} else {
  var sum = 0, max = 0;
  for(var i = 0; i < n; i++) {
    sum += arr[i];
    max = max < arr[0] ? arr[0] : max;
  }
  print(sum - max >= max && sum % 2 === 0 ? 'YES' : 'NO');
}

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});
var count = 0;
rl.on('line', function (line) {
    if (count == 1) {
        var arr = line.trim().split(' ').map(Number);
        var odd = arr.filter(function (a) { return (a % 2); }).length;
        console.log(odd % 2 ? "NO" : "YES");
    }
    count++;
});

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});
var count = 0;
rl.on('line', function (line) {
    if (count == 1) {
        var sum = line.trim().split(' ').map(Number).reduce(function (a, b) { return a + b; });
        console.log(sum % 2 ? "NO" : "YES");
    }
    count++;
});

let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  let nums = lines[1].split(' ');
  nums = nums.map(num => parseInt(num, 10));
  zeroArray(nums);
});

function zeroArray(nums) {
  // let sum = nums.reduce((a, b) => a + b, 0);
  let max = -1;
  let sum = 0;
  for (let i = 0; i < nums.length; i++) {
    max = Math.max(nums[i], max);
    sum += nums[i];
  }

  if (max <= sum * 2 && (sum % 2 === 0)) {
    console.log('YES');
  } else {
    console.log('NO');
  }
}

let i = '';
process.stdin.on('data', (c) => {
  i += c;
});
process.stdin.on('end', () => {
  const { EOL } = require('os');
  const lines = i.split(EOL);
  let nums = lines[1].split(' ');
  nums = nums.map(num => parseInt(num, 10));
  zeroArray(nums);
});

function zeroArray(nums) {
  // let sum = nums.reduce((a, b) => a + b, 0);
  let max = -1;
  let sum = 0;
  for (let i = 0; i < nums.length; i++) {
    max = Math.max(nums[i], max);
    sum += nums[i];
  }

  if (max <= sum && sum % 2 === 0) {
    console.log('YES');
  } else {
    console.log('NO');
  }
}


ip = readline().split(" ");
n = parseInt(ip[0]);
k = parseInt(ip[1]);
s = 0;
str = "";

if (n < k || (k == 1 && n > 1)){
	write(-1);
} else {
	if (k < n){
		for (var i = 0; i < n-k+2; i++){
			str += String.fromCharCode(97 + i%2);
		}
		for (var i = 2; i < k; i++){
			str += String.fromCharCode(97 + i);
		}
	} else {
		for (var i = 0; i < n; i++){
			str += String.fromCharCode(97 + i);
		}
	}
	write(str);
}

var a = "a".charCodeAt(0),
	z = "z".charCodeAt(0);

print((function (n, k) {
	if (k > n) return -1;
	if (k === 1 && n !== 1) return -1;
	if (k === 1 && n === 1) return 'a';

	var str = 'a';

	var l = n - k + 2;

	if (l > 1) {
		while (str.length < n - k + 2) str += str.slice(-1)[0] === 'b' ? 'a' : 'b';
		for (var i = 0; i < k-2 && str.length < n; i++) str += String.fromCharCode(a + 2 + i);
	}

	return str;
}).apply(null, readline().split(' ').map(Number)));

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var integers = tokenizeIntegers(readline());
	var length = integers[0], variety = integers[1];

	if ((variety == 1 && length > 1) || (variety > length)) {
		print(-1);
		return;
	}

	var tailLength = Math.max(0, variety-2);
	var headLength = Math.max(length-tailLength);
	var tailStartCharCode = 'c'.charCodeAt(0);
	var characters = [];
	for (var i = 0; i < headLength; i += 1) {
		characters.push(i%2 == 0 ? 'a' : 'b');
	}
	for (var i = 0; i < tailLength; i += 1) {
		characters.push(String.fromCharCode(tailStartCharCode+i));
	}

	print(characters.join(''));
}

main();

ip = readline().split(" ");
n = parseInt(ip[0]);
k = parseInt(ip[1]);
s = 0;
str = "";

if (n < k){
	write(-1);
} else {
	if (k < n){
		for (var i = 0; i < n-k+2; i++){
			str += String.fromCharCode(97 + i%2);
		}
		for (var i = 2; i < k; i++){
			str += String.fromCharCode(97 + i);
		}
	} else {
		for (var i = 0; i < n; i++){
			str += String.fromCharCode(97 + i);
		}
	}
	write(str);
}

ip = readline().split(" ");
n = ip[0];
k = ip[1];
s = 0;
str = "";

if (n < k){
	write(-1);
} else {
	if (k < n){
		for (var i = 0; i < n-k+2; i++){
			str += String.fromCharCode(97 + i%2);
		}
		for (var i = 2; i < k-2; i++){
			str += String.fromCharCode(97 + i);
		}
	} else {
		for (var i = 0; i < n; i++){
			str += String.fromCharCode(97 + i);
		}
	}
	write(str);
}

ip = readline().split(" ");
n = parseInt(ip[0]);
k = parseInt(ip[1]);
s = 0;
str = "";

if (n < k || k == 1){
	write(-1);
} else {
	if (k < n){
		for (var i = 0; i < n-k+2; i++){
			str += String.fromCharCode(97 + i%2);
		}
		for (var i = 2; i < k; i++){
			str += String.fromCharCode(97 + i);
		}
	} else {
		for (var i = 0; i < n; i++){
			str += String.fromCharCode(97 + i);
		}
	}
	write(str);
}

ip = readline().split(" ");
n = ip[0];
k = ip[1];
s = 0;
str = "";

if (n < k){
	write(-1);
} else {
	if (k < n){
		for (var i = 0; i < n-k+2; i++){
			str += String.fromCharCode(97 + i%2);
		}
		for (var i = 2; i < k; i++){
			str += String.fromCharCode(97 + i);
		}
	} else {
		for (var i = 0; i < n; i++){
			str += String.fromCharCode(97 + i);
		}
	}
	write(str);
}

var a = "a".charCodeAt(0),
	z = "z".charCodeAt(0);

print((function (n, k) {
	if (k > n) return -1;

	var str = 'a';
	var l = n - k + 2;

	if (l > 1) {
		while (str.length < n - k + 2) str += str.slice(-1)[0] === 'b' ? 'a' : 'b';
		for (var i = 0; i < k-2; i++) str += String.fromCharCode(a + 2 + i);
	}

	return str;
}).apply(null, readline().split(' ').map(Number)));

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var integers = tokenizeIntegers(readline());
	var length = integers[0], variety = integers[1];

	if ((variety == 1 && length > 1) || (variety > length)) {
		print(-1);
		return;
	}

	var tailLength = Math.max(0, variety-2);
	var tailStartCharCode = 'c'.charCodeAt(0);
	var characters = [];
	for (var i = length; i > tailLength; i -= 1) {
		characters.push(i%2 == 0 ? 'b' : 'a');
	}
	for (var i = 0; i < tailLength; i += 1) {
		characters.push(String.fromCharCode(tailStartCharCode+i));
	}

	print(characters.join(''));
}

main();

var a = "a".charCodeAt(0),
	z = "z".charCodeAt(0);

print((function (n, k) {
	if (k > n) return -1;
	if (k === 1 && n !== 1) return -1;

	var str = 'a';
	var l = n - k + 2;

	if (l > 1) {
		while (str.length < n - k + 2) str += str.slice(-1)[0] === 'b' ? 'a' : 'b';
		for (var i = 0; i < k-2; i++) str += String.fromCharCode(a + 2 + i);
	}

	return str;
}).apply(null, readline().split(' ').map(Number)));

var a = "a".charCodeAt(0),
	z = "z".charCodeAt(0);

print((function (n, k) {
	if (k > n) return -1;
	if (k === 1 && n !== 1) return -1;
	if (k === 1 && n === 1) return str;

	var str = 'a';

	var l = n - k + 2;

	if (l > 1) {
		while (str.length < n - k + 2) str += str.slice(-1)[0] === 'b' ? 'a' : 'b';
		for (var i = 0; i < k-2 && str.length < n; i++) str += String.fromCharCode(a + 2 + i);
	}

	return str;
}).apply(null, readline().split(' ').map(Number)));

var a = "a".charCodeAt(0),
	z = "z".charCodeAt(0);

print((function (n, k) {
	if (k > n || k == 1) return -1;

	var str = '';
	while (str.length < n - k + 2) str += str.slice(-1) === 'a' ? 'b' : 'a';
	for (var i = 0; i < k-2; i++) str += String.fromCharCode(a + (k - 3) + i);

	return str;
}).apply(null, readline().split(' ').map(Number)));

var a = "a".charCodeAt(0),
	z = "z".charCodeAt(0);

print((function (n, k) {
	if (k > n) return -1;
	if (k === 1 && n !== 1) return -1;

	var str = 'a';
	var l = n - k + 2;

	if (l > 1) {
		while (str.length < n - k + 2) str += str.slice(-1)[0] === 'b' ? 'a' : 'b';
		for (var i = 0; i < k-2 && str.length < n; i++) str += String.fromCharCode(a + 2 + i);
	}

	return str;
}).apply(null, readline().split(' ').map(Number)));

var a = "a".charCodeAt(0),
	z = "z".charCodeAt(0);

print((function (n, k) {
	if (k > n || k == 1) return -1;

	var str = '';
	while (str.length < n - k + 2) str += str.slice(-1) === 'a' ? 'b' : 'a';
	for (var i = 0; i < k-2; i++) str += String.fromCharCode(a + (k - 2) + i);

	return str;
}).apply(null, readline().split(' ').map(Number)));

var a = "a".charCodeAt(0),
	z = "z".charCodeAt(0);

print((function (n, k) {
	if (k > n || k == 1) return -1;

	var str = '';
	while (str.length < n - k + 2) str += str.slice(-1)[0] === 'a' ? 'b' : 'a';
	for (var i = 0; i < k-2; i++) str += String.fromCharCode(a + 2 + i);

	return str;
}).apply(null, readline().split(' ').map(Number)));


function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var noteNum = parseInt(readline());

	var maxVolume = tokenizeIntegers(readline());
	var totalVolume = tokenizeIntegers(readline());

	var score = 0;
	for (var i = 0; i < noteNum; ++i) {
		if (2*maxVolume[i] < totalVolume[i]) {
			score -= 1;
		}
		else {
			var a = Math.floor(totalVolume[i]/2), b = totalVolume[i] - a;
			score += (a*b == 0 ? -1 : a*b);
		}
	}
	print(score);
}

main();

const readline = require('readline');
//const lineReader = require('fs');
//const scanner = lineReader.createReadStream('main.in');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let n, lp = 0, a, b;

rl.on('line', (input) => {
    if (lp === 0){
        lp = 1;
        n = parseInt(input);
    } else if (lp === 1){
        lp = 2;
        a = input.split(' ').map((x) => {
            return parseInt(x);
        });
    } else if (lp === 2){
        b = input.split(' ').map((x) => {
            return parseInt(x);
        });
        let ck, an = 0;
        for (let i = 0; i < n; i++){
            ck = b[i] - a[i];
            let x;
            if (ck > a[i] || b[i] === 1){
                x = -1;
            } else if (b[i] % 2 === 0){
                x = (b[i] / 2) * (b[i] / 2);
            } else {
                x = Math.floor(b[i] / 2) * Math.ceil(b[i] / 2);
            }
            an += x;
        }
        console.log(an);
        rl.close();
    }

});

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var noteNum = parseInt(readline());

	var maxVolume = tokenizeIntegers(readline());
	var totalVolume = tokenizeIntegers(readline());

	var score = 0;
	for (var i = 0; i < noteNum; ++i) {
		if (2*maxVolume[i] < totalVolume[i]) {
			score -= 1;
		}
		else {
			var a = Math.floor(totalVolume[i]/2), b = totalVolume[i] - a;
			score += a*b;
		}
	}
	print(score);
}

main();

const readline = require('readline');
//const lineReader = require('fs');
//const scanner = lineReader.createReadStream('main.in');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let n, lp = 0, a, b;

rl.on('line', (input) => {
    if (lp === 0){
        lp = 1;
        n = parseInt(input);
    } else if (lp === 1){
        lp = 2;
        a = input.split(' ').map((x) => {
            return parseInt(x);
        });
    } else if (lp === 2){
        b = input.split(' ').map((x) => {
            return parseInt(x);
        });
        let ck, an = 0;
        for (let i = 0; i < n; i++){
            ck = b[i] - a[i];
            if (ck < 0){
                console.log(-1);
                process.exit(0);
            } else if (ck > a[i]){
                console.log(-1);
                process.exit(0);
            }
            let x;
            if (b[i] % 2 === 0){
                x = (b[i] / 2) * (b[i] / 2);
            } else {
                x = Math.floor(b[i] / 2) * Math.ceil(b[i] / 2);
            }
            an += x;
        }
        console.log(an);
        rl.close();
    }

});

const readline = require('readline');
//const lineReader = require('fs');
//const scanner = lineReader.createReadStream('main.in');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let n, lp = 0, a, b;

rl.on('line', (input) => {
    if (lp === 0){
        lp = 1;
        n = parseInt(input);
    } else if (lp === 1){
        lp = 2;
        a = input.split(' ').map((x) => {
            return parseInt(x);
        });
    } else if (lp === 2){
        b = input.split(' ').map((x) => {
            return parseInt(x);
        });
        let ck, an = 0;
        for (let i = 0; i < n; i++){
            ck = b[i] - a[i];
            let x;
            if (ck <= 0 || ck > a[i]){
                x = -1;
            } else if (b[i] % 2 === 0){
                x = (b[i] / 2) * (b[i] / 2);
            } else {
                x = Math.floor(b[i] / 2) * Math.ceil(b[i] / 2);
            }
            an += x;
        }
        console.log(an);
        rl.close();
    }

});

const readline = require('readline');
//const lineReader = require('fs');
//const scanner = lineReader.createReadStream('main.in');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let n, lp = 0, a, b;

rl.on('line', (input) => {
    if (lp === 0){
        lp = 1;
        n = parseInt(input);
    } else if (lp === 1){
        lp = 2;
        a = input.split(' ').map((x) => {
            return parseInt(x);
        });
    } else if (lp === 2){
        b = input.split(' ').map((x) => {
            return parseInt(x);
        });
        let ck, an = 0;
        for (let i = 0; i < n; i++){
            ck = b[i] - a[i];
            let x;
            if (ck < 0 || ck > a[i] || a[i] === 1 && b[i] === 1){
                x = -1;
            } else if (b[i] % 2 === 0){
                x = (b[i] / 2) * (b[i] / 2);
            } else {
                x = Math.floor(b[i] / 2) * Math.ceil(b[i] / 2);
            }
            an += x;
        }
        console.log(an);
        rl.close();
    }

});


var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

const char = i => String.fromCharCode('a'.charCodeAt(0) + i);

function main () {
	const [n, k] = rna();

	let ans = '';
	let cur = 0;
	while (cur < k) {
		for (let i = cur; i < k; i++) {
			ans = ans + char(i) + char(cur);
		}
		ans = ans.slice(0, ans.length - 1);
		cur++;
	}

	ans = ans.repeat(Math.ceil(n/k)).slice(0, n);

	console.log(ans);
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

var maxN = 2 * 1e5 + 10
var mod = BigInt(1e9 + 7)

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // const xx = readline();
  // Array(Number(xx)).fill(1).map((t, i) => {
  //   var n = parseInt(readline());
  var [n, k] = readline().split(' ').map((x, iii) => {
    return parseInt(x)
  })
  // var [x, y] = readline().split(' ').map((x, iii) => {
  //   return parseInt(x)
  // });
  var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');

  var res = []
  while (res.length < n) {
    var letter = 0

    for (let i = 0; i < k; i++) {
      res.push(alphabet[letter])
      for (let j = i + 1; j < k; j++) {
        res.push(alphabet[letter])
        res.push(alphabet[j])
      }
      letter++
    }
  }
  var ans= []
  for (let i = 0; i < n; i++) {
    ans.push(res[i])
  }
  console.log(ans.join(''))
  // console.log(ans.length)
  // })
}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let input = [];
rl.on('line', line => {
    input.push(line);
})
rl.on('close', line => {
    var [n, k] = input[0].split(" ").map((i) => {
        return Number(i);
    });
    var visited = [];
    for (var i = 0; i < k; i++) {
        visited[i] = [];
        for (var j = 0; j < k; j++) {
            visited[i][j] = false;
        }
    }
    var str = "";
    var stack = [];
    function findPath(i) {
        var j;
        for (j = 0; j < visited[i].length; j++) {
            if (!visited[i][j]) {
                visited[i][j] = true;
                findPath(j);
            }
        }
        if (j === visited[i].length) {
            stack.push(String.fromCharCode("a".charCodeAt(0) + i));
        }
    }
    findPath(0);
    while (stack.length !== 0) {
        str += stack.pop();
    }
    str = str.slice(0, str.length - 1);
    var result = "";
    for (var i = 0; i < n; i++) {
        result += str[i % str.length];
    }
    console.log(result);
})

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let input = [];
rl.on('line', line => {
    input.push(line);
})
rl.on('close', line => {
    var [n, k] = input[0].split(" ").map((i) => {
        return Number(i);
    });
    var str = "";
    for (var i = 0; i < k; i++) {
        str += String.fromCharCode("a".charCodeAt(0) + i);
        for (var j = i + 1; j < k; j++) {
            str += String.fromCharCode("a".charCodeAt(0) + i);
            str += String.fromCharCode("a".charCodeAt(0) + j);
        }
    }
    var result = "";
    for (var i = 0; i < n; i++) {
        result += str[i % str.length];
    }
    console.log(result);
})

'use strict';

function solve(n, m) {
  let res = '';
  for (let i = 0; i < m; i++) {
    const char = String.fromCharCode(i + 97);
    res += char;
    for (let j = i + 1; j < m; j++) {
      res += char + String.fromCharCode(j + 97);
    }
  }
  return res.repeat(Math.ceil(n / (m * m))).slice(0, n);
}

async function main(read) {
  try {
    let res = [];
    const [n, m] = (await read()).split(' ').map(Number);
    res.push(solve(n, m));
    console.log(res.join('\n'));
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', () => {
  inputs = str.split('\n').values();
  main(read);
});

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

const char = i => String.fromCharCode('a'.charCodeAt(0) + i);

function main () {
	const [n, k] = rna();

	let ans = '';
	for (let cur = 0; cur < k; cur++) {
		for (let i = cur; i < k; i++) {
			ans += char(i) + char(cur);
		}
		ans = ans.slice(0, -1);
	}

	ans = ans.repeat(Math.ceil(n/k)).slice(0, n);

	console.log(ans);
}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let input = [];
rl.on('line', line => {
    input.push(line);
})
rl.on('close', line => {
    var [n, k] = input[0].split(" ").map((i) => {
        return Number(i);
    });
    var visited = [];
    for (var i = 0; i < n; i++) {
        visited[i] = [];
        for (var j = 0; j < n; j++) {
            visited[i][j] = false;
        }
    }
    function findPath(str, i, visited) {
        str += i;
        for (var j = 0; j < visited[i].length; j++) {
            if (!visited[i][j]) {
                visited[i][j] = true;
                findPath(str, j, visited);
                break;
            }
        }
    }
    var str = "";
    findPath(str, 0, visited);
    var result = [];
    for (var i = 0; i < n; i++) {
        result[i] = str[i % str.length];
    }
    console.log(result);
})

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let input = [];
rl.on('line', line => {
    input.push(line);
})
rl.on('close', line => {
    var [n, k] = input[0].split(" ").map((i) => {
        return Number(i);
    });
    var visited = [];
    for (var i = 0; i < n; i++) {
        visited[i] = [];
        for (var j = 0; j < n; j++) {
            visited[i][j] = false;
        }
    }
    function findPath(str, i, visited) {
        str += i;
        for (var j = 0; j < visited[i].length; j++) {
            if (!visited[i][j]) {
                visited[i][j] = true;
                findPath(str, j, visited);
                break;
            }
        }
    }
    var str = "";
    findPath(str, 0, visited);
    var result = [];
    for (var i = 0; i < n; i++) {
        result[i] = str[i % str.length];
    }
    return result;
})

'use strict';

function solve(n, m) {
  let res = '';
  for (let i = 0; i < m; i++) {
    const char = String.fromCharCode(i + 97);
    res += char;
    for (let j = i + 1; j < m; j++) {
      res += char + String.fromCharCode(j + 97);
    }
  }
  return res.slice(0, n);
}

async function main(read) {
  try {
    let res = [];
    const [n, m] = (await read()).split(' ').map(Number);
    res.push(solve(n, m));
    console.log(res.join('\n'));
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', () => {
  inputs = str.split('\n').values();
  main(read);
});

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

var maxN = 2 * 1e5 + 10
var mod = BigInt(1e9 + 7)

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // const xx = readline();
  // Array(Number(xx)).fill(1).map((t, i) => {
  //   var n = parseInt(readline());
  var [n, k] = readline().split(' ').map((x, iii) => {
    return parseInt(x)
  })
  // var [x, y] = readline().split(' ').map((x, iii) => {
  //   return parseInt(x)
  // });
  var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split('');

  var res = 'a'
  var j = 1
  for (let i = 0; i < n-1; i++) {
    if (i % 2 === 0) res += 'a'
    else if (i % 2 === 1 && j < k) {
      res += alphabet[j]
      j++
    } else {
      res += 'a'
    }
  }
  console.log(res)
  // })
}


'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main()
});

function readline() {
  return inputString[currentLine++]
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // console.time('Execution Time')
  let testCases = readline()
  while(testCases--)
    solve()
  // console.timeEnd('Execution Time');
}

// function to solve problems
function solve (){
  let n = readline()
  let arr = readline().split(' ').map(x => +x)
  let fa = Math.max(...arr)
  let fb = arr.reduce((num, sum) => sum += num)
  fb -= fa
  fb = (fb/(arr.length - 1))
  console.log(fa + fb)
}

function sortAscending(a, b) {
  return a[0] - b[0]
}
// String.prototype.replaceAt = function (index, replacement) {
//   return this.substring(0, index) + replacement + this.substring(index + replacement.length)
// }

let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var t = lines[0];
    var e = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var ans = 0;
            for(j = 0; j < e - 1; j++){
                ans += k[j];
            }
            ans /= e - 1;
            ans += k[e - 1];
            console.log(ans.toPrecision(10));
        }
    }
});

// --------------- TEMPLATE START ---------------
const rl = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const nextLine = () => {
  const nextLineGen = (async function* () {
    for await (const line of rl) {
      yield line.trim();
    }
  }());
  return (async () => {
    const next = await nextLineGen.next();
    return next.value;
  })();
};

const nextNum = async () => {
  const line = await nextLine();
  return Number(line);
};

const nextNumArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => Number(num));
};
// --------------- TEMPLATE END ---------------

const ezzatAndTwoSubsequences = async () => {
  let t = await nextNum();

  while (t-- > 0) {
    let n = await nextNum();
    let arr = await nextNumArr();

    let top = Math.max(...arr);
    let sum = 0;
    for(let i = 0; i < n; i++) {
      sum += arr[i];
    }

    console.log((sum - top) / (n-1) + top);
  }
};

ezzatAndTwoSubsequences();

// --------------- TEMPLATE START ---------------
const rl = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const nextLine = () => {
  const nextLineGen = (async function* () {
    for await (const line of rl) {
      yield line.trim();
    }
  }());
  return (async () => {
    const next = await nextLineGen.next();
    return next.value;
  })();
};

const nextNum = async () => {
  const line = await nextLine();
  return Number(line);
};

const nextNumArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => Number(num));
};
// --------------- TEMPLATE END ---------------

const ezzatAndTwoSubsequences = async () => {
  let t = await nextNum();

  while (t-- > 0) {
    let n = await nextNum();
    let arr = await nextNumArr();

    arr.sort((a, b) => a - b);

    let sum = 0;
    for(let i = 0; i < n-1; i++) {
      sum += arr[i];
    }

    console.log(sum / (n-1) + arr[n-1]);
  }
};

ezzatAndTwoSubsequences();

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t = nl.num();
	let ans = [];
	for(let i = 0; i < t; i++){
		let n = nl.num();
		let a = nl.nums();
		let m = a.reduce((ac, e) => e > ac?e:ac, a[0]);
		let s = a.reduce((ac, e) => ac + e, 0) - m;
		ans.push(((s / (n - 1)) + m).toFixed(9));
	}
	console.log(ans.join('\n'));

};

process.stdin.on('end', sol);

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var list = nextIntArray(N);
		list.sort(function(a,b){
			return a - b;
		});
		var sum = 0;
		for(var i = 0; i < N - 1; i++){
			sum += list[i];
		}
		sum /= N - 1;
		myout(sum + list[N - 1]);
	}
}

// function calculateAvg(array) {
//   let result = 0;
//   for (let i = 0; i < array.length; i++) {
//     result += array[i];
//   }
//   return result / (array.length);
// }
// function getMax(array) {
//   let max = array[0];
//   for (let i = 1; i < array.length; i++) {
//     if (max < array[i]) max = array[i];
//   }
//   return max;
// }

function max(list) {
  let res = list[0]
  for (let i = 0; i < list.length; i++) {
    if (res < list[i]) {
      res = list[i]
    }
  }

  return res
}

function min(list) {
  let res = list[0]
  for (let i = 0; i < list.length; i++) {
    if (res > list[i]) {
      res = list[i]
    }
  }
  return res
}

function solve(n, list) {
  let res = 0
  for (let i = 0; i < n; i++) {
    res += list[i];
  }
  const maxValue = max(list);
  res -= maxValue;
  return res / (n - 1) + maxValue;
}
function main(array) {
  const T = array[0];
  for (let i = 0; i < T; i++) {
    const n = array[i * 2 + 1];
    const list = array[(i + 1) * 2];
    const res = solve(n, list.split(' ').map((item) => parseInt(item, 10)));
    console.log(res);
    // console.log(res)
  }
}

let inputString = '';

process.stdin.on('data', (inputStdin) => {
  inputString += inputStdin;
});

process.stdin.on('end', (_) => {
  inputString = inputString.trim().split('\n').map((string) => string.trim());

  main(inputString);
});

let examplesStrings = [
`4
3
3 1 2
3
-7 -6 -6
3
2 2 2
4
17 3 5 -3`,
// `3
// 1 2 3`,
// `9
// 1 2 1 3 2 2 2 2 3`
];

let examples = [
    [
        [3,1,2],
        [-7, -6, -6],
        [2,2,2],
        [17,3,5,-3]
    ],
    // [1,2,3],
    // [1,2,1,3,2,2,2,2,3]
];

let answers = [
`4.5
-12.5
4
18.666666667`
// `2`,
// `4`,
// '10'
];

//

const parser = (string) => {
    const lines = string.match(/[^\r\n]+/g);

    // return lines[1].split(' ').map(x => parseInt(x, 10))

    const finalResult = [];
    for(let i = 2; i < lines.length; i+=2) {
        finalResult.push(lines[i].split(' ').map(x => parseInt(x, 10)))
    }
    return finalResult;
}

const solver = (arr2d) => {
    return arr2d.map(arr => {
        arr.sort((a,b) => b-a);

        console.log(arr);
        return arr[0] + arr.slice(1).reduce((a,b) => a+b, 0) / (arr.length - 1)
    }).join("\r\n")

};

const multiSolver = (_inputs) => {
    const isMulti = false;

    const inputs = isMulti ? _inputs : [_inputs];

    let results = [];
    for(let input of inputs) {
        results.push(solver(input));
        // logResult(solver(input))
    }
    console.log({results})
    const strResults = results.join("\r\n");
    logResult(strResults);
    return strResults;

}

// FINISH HERE !!!
// STOP
// STOP

const isDevMode = process.env.LOCAL === 'knotri';
const logResult = console.log;

const deepEq = (obj1, obj2) => JSON.stringify(obj1) === JSON.stringify(obj2)
const validate = ({examplesStrings, examples, answers, parser, multiSolver}) => {
    examplesStrings.forEach((string, index) => {
        const actualParse = parser(string);
        const desiredParse = examples[index];

        if (!deepEq(actualParse, desiredParse)) {
            console.error('PARSE WRONG!');
            console.log({actualParse, desiredParse})
        }

        const actualAnswer = multiSolver(actualParse);
        const desiredAnswer = answers[index];

        if (!deepEq(actualAnswer, desiredAnswer)) {
            console.error('SOLVE WRONG!');
            console.log({actualParse, actualAnswer, desiredAnswer})
        }

    });

}

if (!isDevMode) {
    console.log = () => {};
    const fs = require("fs");
    const stdinBuffer = fs.readFileSync(0);
    const string = stdinBuffer.toString();

    multiSolver(parser(string));
} else {
    validate({examplesStrings, examples, answers, parser, multiSolver})
}

const MOD = Math.pow(10, 9) + 7;

function solve() {
   const [n] = readArray(Number);
   const bigN = BigInt(n);
   const arr = readArray((x) => BigInt(x) * 10000000n);
   arr.sort(sortF);
   let sum = 0n;
   for (let i = 0; i < n; i++) {
      sum += arr[i];
   }

   let curSum = arr[0];
   let ans = curSum + (sum - curSum) / (bigN - 1n);
   for (let i = 1; i < n - 1; i++) {
      curSum += arr[i];
      const counter = BigInt(i + 1);
      const curAns = curSum / counter + (sum - curSum) / (bigN - counter);
      if (curAns > ans) {
         ans = curAns;
      }
   }

   let full = ans / 10000000n;
   if (full < 0n) {
      full = -full;
   }
   const sign = (ans < 0n) ? '-' : '';
   let ost = ans % 10000000n;
   if (ost < 0n) {
      ost = -ost;
   }
   ost = '' + ost;
   while(ost.length < 7) {
      ost = '0' + ost;
   }
   write(sign + full + '.' + ost);
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e + e.stack);
   }
}

function modPow(a, n, mod) {
   let d = a;
   let curN = n;
   let ans = 1;
   while(curN) {
      if (curN & 1) {
         ans = modMul(ans, d, mod);
      }
      curN >>= 1;
      d = modMul(d, d, mod);
   }
   return ans;
}

function modMul(a, b, mod) {
   return (a * b) % mod;
}

function modSum(a, b, mod) {
   return (a + b) % mod;
}

function modDiff(a, b, mod) {
   return (a + mod - b) % mod;
}

function isZero(num) {
   if (typeof num === 'bigint') {
      return num === 0n;
   }
   return num === 0;
}
function div(a, b) {
   if (typeof a !== typeof b) {
      throw new Error('Different types on division');
   }
   if (typeof a === 'bigint') {
      return a / b;
   }
   return Math.floor(a / b);
}

function gcd(x, y) {
   if (isZero(y)) {
      return x;
   }
   return gcd(y, x % y);
}

function lcm(x, y) {
   return div(x * y, gcd(x, y));
}

function allIndexOf(arr, value) {
   var index = arr.indexOf(value)
   var ans = [];
   while (index !== -1) {
      ans.push(index);
      index = arr.indexOf(value, index + 1);
   }
   return ans;
}

function xor(a, b, k) {
   if (k === 2) {
      return a ^ b;
   }
}

function decToBin(num) {
   let n = num;
   const ans = [];
   while(n > 0) {
      ans.push(n & 1);
      n = (n >> 1);
   }
   return ans;
}

function binToDec(binN) {
   let ans = 0;
   for (let i = binN.length - 1; i >= 0; i--) {
      ans = ((ans << 1) | binN[i]);
   }
   return ans;
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

const stdin = process.openStdin();
let content = '';

stdin.addListener('data', (data) => {
          content += data;
})

stdin.addListener('end', () => {
          content = content.split('\n');
          content.shift();
          content = content.map((string) => string.substring(0, string.length - 1));
          content.pop();
          let arr = [];
          content.forEach((string, i) => {
                    if (i % 2 === 1) {
                              arr.push(content[i]);
                    }
          })
          arr = arr.map((string) => string.split(' '));
          arr = arr.map((newArr) => newArr.map(num => parseInt(num)));
          arr = arr.map((newArr) => newArr.sort((a, b) => b - a));
          const max = new Array(arr.length).fill(Number.MIN_SAFE_INTEGER);
          arr.forEach((nums, i) => {
                    const cacheSum = [nums[0]];
                    for (let j = 1; j < nums.length; j++) {
                             cacheSum.push(cacheSum[cacheSum.length - 1] + nums[j]);
                    }
                    for (let j = 1; j < nums.length; j++) {
                              max[i] = Math.max(mean(0, j, cacheSum) + mean(j, nums.length, cacheSum), max[i]);
                    }
                    console.log(max[i]);
          })
})

const mean = (start, end, cacheSum) => {
          let sum = start !== 0 ? cacheSum[end - 1] - cacheSum[start - 1] : cacheSum[end - 1];
          return sum / (end - start);
}

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const solve = (n, a) => {
    // pr(n, a)
    stin(a);
    let left = 0, right = sm(a), res = Number.MIN_SAFE_INTEGER;
    for (let i = 0; i < n - 1; i++) {
       left += a[i];
       right -= a[i];
       let nl = i + 1, nr = n - i - 1;
       // pr(left, nl, right, nr, left / nl + right / nr)
       res = mx(res, left / nl + right / nr)
    }
    pr(res.toFixed(9))
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i + 1]);
            i += 2;
        }
    });
};

main()

let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var t = lines[0];
    var e = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number).sort(function(a, b){return a - b});
            var ans = 0;
            for(j = 0; j < e - 1; j++){
                ans += k[j];
            }
            ans /= e - 1;
            ans += k[e - 1];
            console.log(ans);
        }
    }
});

const MOD = Math.pow(10, 9) + 7;

function solve() {
   const [n] = readArray(Number);
   const bigN = BigInt(n);
   const arr = readArray((x) => BigInt(x) * 10000000n);
   arr.sort(sortF);
   let sum = 0n;
   for (let i = 0; i < n; i++) {
      sum += arr[i];
   }

   let curSum = arr[0];
   let ans = curSum + (sum - curSum) / (bigN - 1n);
   for (let i = 1; i < n - 1; i++) {
      curSum += arr[i];
      const counter = BigInt(i + 1);
      const curAns = curSum / counter + (sum - curSum) / (bigN - counter);
      if (curAns > ans) {
         ans = curAns;
      }
   }

   const full = ans / 10000000n;
   if (full < 0n) {
      full = -full;
   }
   const sign = (ans < 0n) ? '0' : '';
   let ost = ans % 10000000n;
   if (ost < 0n) {
      ost = -ost;
   }
   ost = '' + ost;
   while(ost.length < 7) {
      ost = '0' + ost;
   }
   write(sign + full + '.' + ost);
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e + e.stack);
   }
}

function modPow(a, n, mod) {
   let d = a;
   let curN = n;
   let ans = 1;
   while(curN) {
      if (curN & 1) {
         ans = modMul(ans, d, mod);
      }
      curN >>= 1;
      d = modMul(d, d, mod);
   }
   return ans;
}

function modMul(a, b, mod) {
   return (a * b) % mod;
}

function modSum(a, b, mod) {
   return (a + b) % mod;
}

function modDiff(a, b, mod) {
   return (a + mod - b) % mod;
}

function isZero(num) {
   if (typeof num === 'bigint') {
      return num === 0n;
   }
   return num === 0;
}
function div(a, b) {
   if (typeof a !== typeof b) {
      throw new Error('Different types on division');
   }
   if (typeof a === 'bigint') {
      return a / b;
   }
   return Math.floor(a / b);
}

function gcd(x, y) {
   if (isZero(y)) {
      return x;
   }
   return gcd(y, x % y);
}

function lcm(x, y) {
   return div(x * y, gcd(x, y));
}

function allIndexOf(arr, value) {
   var index = arr.indexOf(value)
   var ans = [];
   while (index !== -1) {
      ans.push(index);
      index = arr.indexOf(value, index + 1);
   }
   return ans;
}

function xor(a, b, k) {
   if (k === 2) {
      return a ^ b;
   }
}

function decToBin(num) {
   let n = num;
   const ans = [];
   while(n > 0) {
      ans.push(n & 1);
      n = (n >> 1);
   }
   return ans;
}

function binToDec(binN) {
   let ans = 0;
   for (let i = binN.length - 1; i >= 0; i--) {
      ans = ((ans << 1) | binN[i]);
   }
   return ans;
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

const MOD = Math.pow(10, 9) + 7;

function solve() {
   const [n] = readArray(Number);
   const bigN = BigInt(n);
   const arr = readArray((x) => BigInt(x) * 10000000n);
   arr.sort(sortF);
   let sum = 0n;
   for (let i = 0; i < n; i++) {
      sum += arr[i];
   }

   let curSum = arr[0];
   let ans = curSum + (sum - curSum) / (bigN - 1n);
   for (let i = 1; i < n - 1; i++) {
      curSum += arr[i];
      const counter = BigInt(i + 1);
      const curAns = curSum / counter + (sum - curSum) / (bigN - counter);
      if (curAns > ans) {
         ans = curAns;
      }
   }

   const full = ans / 10000000n;
   let ost = ans % 10000000n;
   if (ost < 0) {
      ost = -ost;
   }
   ost = '' + ost;
   while(ost.length < 7) {
      ost = '0' + ost;
   }
   write(full + '.' + ost);
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e + e.stack);
   }
}

function modPow(a, n, mod) {
   let d = a;
   let curN = n;
   let ans = 1;
   while(curN) {
      if (curN & 1) {
         ans = modMul(ans, d, mod);
      }
      curN >>= 1;
      d = modMul(d, d, mod);
   }
   return ans;
}

function modMul(a, b, mod) {
   return (a * b) % mod;
}

function modSum(a, b, mod) {
   return (a + b) % mod;
}

function modDiff(a, b, mod) {
   return (a + mod - b) % mod;
}

function isZero(num) {
   if (typeof num === 'bigint') {
      return num === 0n;
   }
   return num === 0;
}
function div(a, b) {
   if (typeof a !== typeof b) {
      throw new Error('Different types on division');
   }
   if (typeof a === 'bigint') {
      return a / b;
   }
   return Math.floor(a / b);
}

function gcd(x, y) {
   if (isZero(y)) {
      return x;
   }
   return gcd(y, x % y);
}

function lcm(x, y) {
   return div(x * y, gcd(x, y));
}

function allIndexOf(arr, value) {
   var index = arr.indexOf(value)
   var ans = [];
   while (index !== -1) {
      ans.push(index);
      index = arr.indexOf(value, index + 1);
   }
   return ans;
}

function xor(a, b, k) {
   if (k === 2) {
      return a ^ b;
   }
}

function decToBin(num) {
   let n = num;
   const ans = [];
   while(n > 0) {
      ans.push(n & 1);
      n = (n >> 1);
   }
   return ans;
}

function binToDec(binN) {
   let ans = 0;
   for (let i = binN.length - 1; i >= 0; i--) {
      ans = ((ans << 1) | binN[i]);
   }
   return ans;
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

const MOD = Math.pow(10, 9) + 7;

function solve() {
   const [n] = readArray(Number);
   const arr = readArray(BigInt);
   let maxi = arr[0];
   let sum = 0n;
   for (let i = 0; i < n; i++) {
      sum += arr[i];
      if (arr[i] > maxi) {
         maxi = arr[i];
      }
   }
   const bigN = BigInt(n);
   sum -= maxi;
   const ans = sum * 100000000n / (bigN - 1n) + maxi * 100000000n;
   const full = ans / 100000000n;
   let ost = '' + (ans % 100000000n + (ans < 0n ? 100000000n : 0n));
   while(ost.length < 8) {
      ost = '0' + ost;
   }
   write(full + '.' + ost);
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e + e.stack);
   }
}

function modPow(a, n, mod) {
   let d = a;
   let curN = n;
   let ans = 1;
   while(curN) {
      if (curN & 1) {
         ans = modMul(ans, d, mod);
      }
      curN >>= 1;
      d = modMul(d, d, mod);
   }
   return ans;
}

function modMul(a, b, mod) {
   return (a * b) % mod;
}

function modSum(a, b, mod) {
   return (a + b) % mod;
}

function modDiff(a, b, mod) {
   return (a + mod - b) % mod;
}

function isZero(num) {
   if (typeof num === 'bigint') {
      return num === 0n;
   }
   return num === 0;
}
function div(a, b) {
   if (typeof a !== typeof b) {
      throw new Error('Different types on division');
   }
   if (typeof a === 'bigint') {
      return a / b;
   }
   return Math.floor(a / b);
}

function gcd(x, y) {
   if (isZero(y)) {
      return x;
   }
   return gcd(y, x % y);
}

function lcm(x, y) {
   return div(x * y, gcd(x, y));
}

function allIndexOf(arr, value) {
   var index = arr.indexOf(value)
   var ans = [];
   while (index !== -1) {
      ans.push(index);
      index = arr.indexOf(value, index + 1);
   }
   return ans;
}

function xor(a, b, k) {
   if (k === 2) {
      return a ^ b;
   }
}

function decToBin(num) {
   let n = num;
   const ans = [];
   while(n > 0) {
      ans.push(n & 1);
      n = (n >> 1);
   }
   return ans;
}

function binToDec(binN) {
   let ans = 0;
   for (let i = binN.length - 1; i >= 0; i--) {
      ans = ((ans << 1) | binN[i]);
   }
   return ans;
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

const MOD = Math.pow(10, 9) + 7;

function solve() {
   const [n] = readArray(Number);
   const arr = readArray(BigInt);
   let maxi = arr[0];
   let sum = 0n;
   for (let i = 0; i < n; i++) {
      sum += arr[i];
      if (arr[i] > maxi) {
         maxi = arr[i];
      }
   }
   const bigN = BigInt(n);
   sum -= maxi;
   const ans = sum * 10000000n / (bigN - 1n) + maxi * 10000000n;
   const full = ans / 10000000n;
   let ost = '' + (ans % 10000000n + (ans < 0n ? 10000000n : 0n));
   while(ost.length < 7) {
      ost = '0' + ost;
   }
   write(full + '.' + ost);
}

function init() {
   try {
      var T;
      T = 1;
      T = Number(read());
      for (var t = 0; t < T; t++) {
         solve();
      }
   } catch (e) {
      write(e + e.stack);
   }
}

function modPow(a, n, mod) {
   let d = a;
   let curN = n;
   let ans = 1;
   while(curN) {
      if (curN & 1) {
         ans = modMul(ans, d, mod);
      }
      curN >>= 1;
      d = modMul(d, d, mod);
   }
   return ans;
}

function modMul(a, b, mod) {
   return (a * b) % mod;
}

function modSum(a, b, mod) {
   return (a + b) % mod;
}

function modDiff(a, b, mod) {
   return (a + mod - b) % mod;
}

function isZero(num) {
   if (typeof num === 'bigint') {
      return num === 0n;
   }
   return num === 0;
}
function div(a, b) {
   if (typeof a !== typeof b) {
      throw new Error('Different types on division');
   }
   if (typeof a === 'bigint') {
      return a / b;
   }
   return Math.floor(a / b);
}

function gcd(x, y) {
   if (isZero(y)) {
      return x;
   }
   return gcd(y, x % y);
}

function lcm(x, y) {
   return div(x * y, gcd(x, y));
}

function allIndexOf(arr, value) {
   var index = arr.indexOf(value)
   var ans = [];
   while (index !== -1) {
      ans.push(index);
      index = arr.indexOf(value, index + 1);
   }
   return ans;
}

function xor(a, b, k) {
   if (k === 2) {
      return a ^ b;
   }
}

function decToBin(num) {
   let n = num;
   const ans = [];
   while(n > 0) {
      ans.push(n & 1);
      n = (n >> 1);
   }
   return ans;
}

function binToDec(binN) {
   let ans = 0;
   for (let i = binN.length - 1; i >= 0; i--) {
      ans = ((ans << 1) | binN[i]);
   }
   return ans;
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

const stdin = process.openStdin();
let content = '';

stdin.addListener('data', (data) => {
          content += data;
})

stdin.addListener('end', () => {
          content = content.split('\n');
          content.shift();
          content = content.map((string) => string.substring(0, string.length - 1));
          content.pop();
          let arr = [];
          content.forEach((string, i) => {
                    if (i % 2 === 1) {
                              arr.push(content[i]);
                    }
          })
          arr = arr.map((string) => string.split(' '));
          arr = arr.map((newArr) => newArr.map(num => parseInt(num)));
          arr = arr.map((newArr) => newArr.sort((a, b) => b - a));
          const max = new Array(arr.length).fill(Number.MIN_SAFE_INTEGER);
          arr.forEach((nums, i) => {
                    for (let j = 1; j < nums.length; j++) {
                              max[i] = Math.max(mean(nums.slice(0, j)) + mean(nums.slice(j)), max[i]);
                    }
          })
          console.log(arr, max)
})

const mean = (arr) => {
          if (arr.length === 0) return 0;
          let sum = 0;
          arr.forEach(num => {
                  sum += num;
          })
          return sum / arr.length;
}

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const solve = (n, a) => {
    // pr(n, a)
    let left = 0, right = sm(a), res = Number.MIN_SAFE_INTEGER;
    for (let i = 0; i < n - 1; i++) {
       left += a[i];
       right -= a[i];
       let nl = i + 1, nr = n - i - 1;
       // pr(left, nl, right, nr)
       res = mx(res, left / nl + right / nr)
    }
    pr(res.toFixed(9))
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i + 1]);
            i += 2;
        }
    });
};

main()

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const assert = (condition) => { if (!condition) throw new Error("Assertion failed"); }
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const int = parseInt;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg2 = Math.log2;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (n, m) => { let data = []; for (let i = 0; i < n; i++) { let tmp = Array(m).fill(0); data.push(tmp); } return data; };
const initialize3DArray = (n, m, p) => { let res = []; for (let i = 0; i < n; i++) { let data = []; for (let j = 0; j < m; j++) { let tmp = new Array(p).fill(0); data.push(tmp); } res.push(data); } return res; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
const ups = (s, i, c) => s.slice(0, i) + c + s.slice(i + 1);
const isSubsequence = (s, t) => { let sn = s.length; let tn = t.length; let i = j = 0; while (i < sn && j < tn) { if (s[i] == t[j]) { i++; j++; } else { i++; } } return j == tn; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const solve = (n, a) => {
    // pr(n, a)
    let left = 0, sum = sm(a), res = Number.MIN_SAFE_INTEGER;
    for (let i = 0; i < n; i++) {
       left += a[i];
       sum -= a[i];
       // pr(left / (i + 1), sum / (n - i - 1))
       if (n - i - 1 > 0) res = mx(res, left / (i + 1) + sum / (n - i - 1))
    }
    pr(res)
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i + 1]);
            i += 2;
        }
    });
};

main()