Given an array $$$a=[a_1,a_2,\dots,a_n]$$$ of $$$n$$$ positive integers, you can do operations of two types on it:  Add $$$1$$$ to every element with an odd index. In other words change the array as follows: $$$a_1 := a_1 +1, a_3 := a_3 + 1, a_5 := a_5+1, \dots$$$.  Add $$$1$$$ to every element with an even index. In other words change the array as follows: $$$a_2 := a_2 +1, a_4 := a_4 + 1, a_6 := a_6+1, \dots$$$.Determine if after any number of operations it is possible to make the final array contain only even numbers or only odd numbers. In other words, determine if you can make all elements of the array have the same parity after any number of operations.Note that you can do operations of both types any number of times (even none). Operations of different types can be performed a different number of times.

The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case contains an integer $$$n$$$ ($$$2 \leq n \leq 50$$$) — the length of the array. The second line of each test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \leq a_i \leq 10^3$$$) — the elements of the array. Note that after the performed operations the elements in the array can become greater than $$$10^3$$$.

Output $$$t$$$ lines, each of which contains the answer to the corresponding test case. As an answer, output "YES" if after any number of operations it is possible to make the final array contain only even numbers or only odd numbers, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

NoteFor the first test case, we can increment the elements with an even index, obtaining the array $$$[1, 3, 1]$$$, which contains only odd numbers, so the answer is "YES".For the second test case, we can show that after performing any number of operations we won't be able to make all elements have the same parity, so the answer is "NO".For the third test case, all elements already have the same parity so the answer is "YES".For the fourth test case, we can perform one operation and increase all elements at odd positions by $$$1$$$, thus obtaining the array $$$[1001, 1, 1001, 1, 1001]$$$, and all elements become odd so the answer is "YES".

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0; j < e; j += 2){
                if(k[j] % 2 != k[0] % 2){
                    ok = false;
                    break;
                }
            }
            for(j = 1; j < e; j += 2){
                if(k[j] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            console.log(ok ? 'YES' : 'NO');
        }
    }
});

let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0; j < e; j += 2){
                if(k[j] % 2 != k[0] % 2){
                    ok = false;
                    break;
                }
            }
            for(j = 1; j < e; j += 2){
                if(k[j] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            if(ok){
                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);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0; j < e; j += 2){
                if(k[j] % 2 != k[0] % 2){
                    ok = false;
                    break;
                }
            }
            for(j = 1; j < e; j += 2){
                if(k[j] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            if(ok){
                console.log('YES');
            }else{
                console.log('NO');
            }
        }
    }
});

//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] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}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 nextDoubleArray(size){return nextArray(size, 'double');}
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 nextDouble(){return parseFloat(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);
		var c = 0;
		for(var i = 0; i < N; i += 2){
			if(list[i] % 2 == 0){
				c |= 1;
			}else{
				c |= 2;
			}
		}
		if(c == 3){
			myout("NO");
			continue;
		}
		var c = 0;
		for(var i = 1; i < N; i += 2){
			if(list[i] % 2 == 0){
				c |= 1;
			}else{
				c |= 2;
			}
		}
		if(c == 3){
			myout("NO");
			continue;
		}
		myout("YES");
	}
}

'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() {
    let t = readline();
    while(t--) {
        const [n, arr] = [Number(readline()), readline().split(" ")];

        const typeOfevenIndex = arr[0] % 2, typeOfOddIndex = arr[1] % 2;

        let ans = "YES";

        loop:
        for(let i = 0; i < n; i++) {
            if(i % 2 === 0 && arr[i] % 2 !== typeOfevenIndex) {
                ans = "NO";
                break loop;
            }
            if(i % 2 === 1 && arr[i] % 2 !== typeOfOddIndex) {
                ans = "NO";
                break loop;
            }
        }
        console.log(ans);
    }
}

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

let input = [];
let ans = [];

readline.on('line', line => {
    input.push(line);
}).on('close', () => {
    for (let i = 2; i < input.length; i+=2) {
        let nums = input[i].split(' ').map(Number);

        let chkOdd = nums[0]%2;
        let chkEven = nums[1]%2;

        for (let j = 0; j < nums.length; j++) {
            if (j%2===0 && nums[j]%2!==chkOdd || j%2===1 && nums[j]%2!==chkEven) {
                ans.push('NO');
                break;
            }
            if (j === nums.length-1) ans.push('YES');
        }
    }

    console.log(ans.join('\n'));
});

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

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

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        let n = parseInt(readline(), 10);
        let arr = readline().split(' ').map(Number);

        let odd = arr.filter((v, i) => i % 2 === 0);
        let even = arr.filter((v, i) => i % 2 === 1);

        let no =false;
        for (let i = 0; i < odd.length; i++) {
            if (odd[i] % 2 !== odd[0] % 2) {
                no = true;
                break;
            }
        }

        for (let i = 0; i < even.length; i++) {
            if (even[i] % 2 !== even[0] % 2) {
                no = true;
                break;
            }
        }

        output(no ? 'NO' : 'YES');
    }
}

'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() {
    const T = readline();
    for (let i = 0; i < T; i++) {
        const n = readline()
        const A = readline().split(' ').map(x => +x)
        solve(A)
    }
}
function solve(A) {

    for (let i = 0; i < 2; i++) {
        let remain = A[i] % 2
        for (let j = i; j < A.length; j += 2) {
            if (A[j] % 2 !== remain) {
                console.log('NO')
                return
            }
        }
    }

    console.log('YES')
}

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

let lines = [];

async function main() {
  for await (let line of rl) {
	  lines.push(line);
  }

	let inputs = +lines[0]; // dirty javascript typecasting to number
  let arrays = [];

  for (let i = 0; i < inputs; i++) {
    let numOfElements = +lines[2 * i + 1];
    arrays.push([]);

    for (let j = 0; j < numOfElements; j++) {
      arrays[i].push(lines[2 * i + 2].split(" ")[j]);
    }
  }

  for (array of arrays) {
    let evenParity = array[0] % 2;
    let oddParity = array[1] % 2;

    let evenParitySuccess = true;
    let oddParitySuccess = true;

    for (let i = 0; i < array.length; i += 2) {
      evenParitySuccess = evenParitySuccess && array[i] % 2 == evenParity;
    }

    for (let i = 1; i < array.length; i += 2) {
      oddParitySuccess = oddParitySuccess && array[i] % 2 == oddParity;
    }

    if (evenParitySuccess && oddParitySuccess) console.log("YES");
    else console.log("NO");
  }
}

main();

const processData = (lines) => {
    let count = +lines[0]
    let cur = 0
    while(count--) {
        cur++
        // let [n] = lines[cur].split(' ').map(x => +x)
        cur++
        let nums = lines[cur].split(' ').map(x => +x)

        let patternBreak = false;
        for (const t of [0, 1]) {
            let pattern = nums[t] ? nums[t] %2 : 0;
            if (!patternBreak) {
                for (let i=t; i<nums.length; i+=2) {

                    if (nums[i]%2 !== pattern) {
                        patternBreak = true;
                        break;
                    }
                }
            }
        }

        console.log(patternBreak ? 'NO' : 'YES');
    }
}

let i = []
process.stdin.on('data', c => i.push(c))
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.join('').split(EOL) /*your input text, split by lines*/
    processData(lines)
})

'use strict';

var readline = require('readline');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);

function solve(n, a) {
  for (let i = 0; i < n; i++) {
    if (i > 1) {
      if ((a[i] & 1) !== (a[i - 2] & 1)) {
        console.log('NO');
        return;
      }
    }
  }
  console.log('YES');
}

async function main(read) {
  const t = Number(await read());
  for (let i = 0; i < t; i++) {
    const n = Number(await read());
    const a = (await read()).split(' ').map(Number);
    solve(n, a);
  }
}

const rl = readline__default["default"].createInterface({
  input: process.stdin,
  output: process.stdout
});
void async function () {
  const inputs = [];
  let i = 0;
  for await (const line of rl) {
    inputs.push(line.trim());
  }
  function read() {
    return inputs[i++];
  }
  await main(read);
}();

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

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

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const a = rna();

		let ok = 1;
		for (let i = 0; i < n; i++) {
			if (i - 2 >= 0 && (a[i] & 1) != (a[i - 2] & 1)) ok = 0;
		}

		console.log(ok ? 'YES' : 'NO');
	}
}

const lines = [];
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
rl.on('line', line => lines.push(line));
rl.on('close', main);
let rli = 0;
function readline() {
    return lines[rli++];
}

const ra = ()=>readline().split(' ').map(a=>+a);

function div(val, by){
    return (val - val % by) / by;
}

const calc = (n, a)=>{
    let parity0 = a[0] % 2;
    let parity1 = a[1] % 2;
    for (let i = 0; i < n; i++) {
        if (i % 2 === 0 && a[i] % 2 !== parity0) return 'NO';
        if (i % 2 === 1 && a[i] % 2 !== parity1) return 'NO';
    }

    return "YES";
};

function main() {
    let T = +readline();
    for (let t = 1; t <= T; t++){
        let n = +readline();
        let a = ra();
        console.log(`${calc(n, a)}`);
    }
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr) ? 'YES' : 'NO'
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const odd = arr[1] & 1
    const even = arr[0] & 1
    for (let i = 0; i < arr.length; i++) {
        const x = arr[i] & 1
        if (i & 1) {
            if (x !== odd) return false
        } else {
            if (x !== even) return false
        }
    }
    return true
}

'use strict';
 /*jslint node:true, browser:true, es6:true*/
const print = console.log
const E = {};
const lines = []
if (!process.env.JEST_WORKER_ID){
  const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
  rl.on('line', line => {
      lines.push(line);
  });
  rl.on('close', main)
}
let rli = 0;
function readline() {
    return lines[rli++];
}
const L = process.env.DEBUG ? console.log : ()=>{};

module.exports = E;
const ra = ()=>readline().split(' ').map(a=>+a)

const calc = (n, A)=>{
  let p1 = A[0]&1;
  for (let i=0; i<n; i+=2){
    if (p1!= (A[i]&1))
      return false;
  }
  let p2 = A[1]&1
  for (let i=1; i<n; i+=2){
    if (p2!= (A[i]&1))
      return false;
  }
  return true
};

function main() {
    let T = +readline()
    while (T--){
      let [n, m] = ra();
      let A = ra();
      L('Ans:')
      print(calc(n, A) ? 'yes' : 'no');
    }
}

E.calc = calc;

var t = +readline()

for(var i = 0; i< t; i ++) {
    var a = readline()
    var arr1 = readline().split(" ").map(x => +x);
    print(oddAndEven(arr1));
}

function oddAndEven(n){

   var evenIdx = n[0] % 2 === 0;
   var oddIdx = n[1] % 2 === 0;
   for(var i = 0; i<n.length;i++){
      if (i % 2 === 0 && ((n[i] % 2 === 0) != evenIdx)){
         return 'No';
      }
      else if (i % 2 === 1 && ((n[i] % 2 === 0) != oddIdx)){
         return 'No';
      }
   }

   return 'YES';

}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0; j < e; j++){
                if(k[j] % 2 != k[0] % 2 || k[j] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            console.log(ok ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split('').map(Number);
            var ok = true;
            for(j = 0; j < e; j++){
                if(k[j] % 2 != k[0] % 2 || k[j] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            console.log(ok ? 'YES' : 'NO');
        }
    }
});

let q = '';
process.stdin.on('data', c => q += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = q.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0, l = 1; j < e, l < e; j += 2, l += 2){
                if(k[j] % 2 != k[0] % 2 || k[l] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            if(ok){
                console.log('YES');
            }else{
                console.log('NO');
            }
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0; j < e; j++){
                if(k[j] % 2 != k[0] % 2 || k[j] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            console.log(!ok ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0; j < e; j ++){
                if(k[j] % 2 != k[0] % 2){
                    ok = false;
                    break;
                }
            }
            for(j = 1; j < e; j += 2){
                if(k[j] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            console.log(ok ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0; j < e; j += 2){
                if(k[j] % 2 != k[0] % 2){
                    ok = false;
                    break;
                }
            }
            for(j = 1; j < e; j ++){
                if(k[j] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            console.log(ok ? 'YES' : 'NO');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            n = Number(lines[i]);
        }else{
            var ar = lines[i].split(' ').map(Number);
            var a = 0, b = n - 1;
            var a1 = ar[0], b1 = ar[b];
            var ans = 0;
            while(a < b){
                if(a1 == b1){
                    ans = a + 1 + n - b;
                    a++;
                    a1 += ar[a];
                }else if(a1 > b1){
                    b--;
                    b1 += ar[b];
                }else if(a1 < b1){
                    a++;
                    a1 += ar[a];
                }
            }
            console.log(ans);
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var n = lines[0].split('').sort();
    var e = n[n.length - 1];
    var ans = '';
    for(i = 0; i < n.length; i++){
        if(n[i] == e){
            ans += n[i];
        }
    }
    console.log(ans);
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            n = lines[i], a = new Map(), flag = false;
        }else{
            k = lines[i].split(' ').map(Number);
            for(j = 0; j < n; j++){
                if(a.has(k[j])){
                    flag = true;
                    break;
                }else{
                    a.set(k[j]);
                }
            }
            console.log(flag === true ? 'NO' : 'YES');
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var a = lines[i].split('').map(Number);
        var x = 0;
        var y = 0;
        for(j = 0; j < 6; j++){
            if(j >= 3){
                x += a[j];
            }else{
                y += a[j];
            }
        }
        console.log(x == y ? 'YES' : 'NO');
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    var e = 0;
    for(i = 1; i <= n * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var ok = true;
            for(j = 0, l = 1; j < e, l < e; j += 2, l += 2){
                if(k[j] % 2 != k[0] % 2 || k[l] % 2 != k[1] % 2){
                    ok = false;
                    break;
                }
            }
            if(ok === true){
                console.log('YES');
            }else{
                console.log('NO');
            }
        }
    }
});

//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] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}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 nextDoubleArray(size){return nextArray(size, 'double');}
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 nextDouble(){return parseFloat(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);
		var c = 0;
		for(var i = 0; i < N; i += 2){
			if(list[i] % 2 == 0 && c == 0){
				c++;
			}else if(list[i] % 2 == 1 && c == 1){
				c++;
			}
		}
		if(c == 2){
			myout("NO");
			continue;
		}
		var c = 0;
		for(var i = 1; i < N; i += 2){
			if(list[i] % 2 == 0 && c == 0){
				c++;
			}else if(list[i] % 2 == 1 && c == 1){
				c++;
			}
		}
		if(c == 2){
			myout("NO");
			continue;
		}
		myout("YES");
	}
}


Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. Eleven wants her name to have exactly n characters.   Her friend suggested that her name should only consist of uppercase and lowercase letters 'O'. More precisely, they suggested that the i-th letter of her name should be 'O' (uppercase) if i is a member of Fibonacci sequence, and 'o' (lowercase) otherwise. The letters in the name are numbered from 1 to n. Fibonacci sequence is the sequence f where  f1 = 1,  f2 = 1,  fn = fn - 2 + fn - 1 (n > 2). As her friends are too young to know what Fibonacci sequence is, they asked you to help Eleven determine her new name.

The first and only line of input contains an integer n (1 ≤ n ≤ 1000).

Print Eleven's new name on the first and only line of output.

n = readline();

var i = 1, arr = [1, 1], resArr = [];

while (arr[i] < n) {
	arr.push(arr[i - 1] + arr[i]);

	i++;
};

for (var j = 1; j <= n; j++) {
	var count = 0;

	for (var k = 0; k < arr.length; k++) {
		if (j == arr[k]) {
			count++;
		};
	};

	if (count > 0) {
		resArr.push('O');
	} else {
		resArr.push('o');
	};
};

print(resArr.join(''));

//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↑入力 ↓出力');
	Main();
});
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 N = nextInt();
  var list = [0,1];
  var set = new Set(list);
  while(list[list.length - 1] < 1000){
    var add = list[list.length - 2] + list[list.length - 1];
    list.push(add);
    set.add(add);
  }
  var output = "";
  for(var i = 0; i < N; i++){
    if(set.has(i + 1)){
      output += "O";
    }else{
      output += "o";
    }
  }
  myout(output);
}

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

rl.on('line', (d) => {
  const seq = [1, 1];

  for (let i = 2; i <= d; i++) {
    seq[i] = seq[i - 1] + seq[i - 2];
  }

  let ans = '';

  for (let i = 1; i <= d; i++) {
    if (seq.includes(i)) {
      ans += 'O';
    }
    else {
      ans += 'o';
    }
  }

  console.log(ans);

  c++;
});

'use strict';

let n = parseInt(readline(), 10);
const isFibo = new Array(n + 1);
const fibo = [0, 1];
for (let i = 2; fibo[fibo.length - 1] <= n; i++) {
  fibo.push(fibo[i - 2] + fibo[i - 1]);
}

fibo.pop();

for (const i of fibo) {
  isFibo[i] = true;
}

for (let i = 1; i <= n; i++)
  write(isFibo[i] ? 'O' : 'o');
print()

const n = parseInt(readline());
var out = 'O' + Array(n).join('o');

String.prototype.replaceAt = function(index, replacement) {
  return this.substr(0, index) + replacement + this.substr(index + replacement.length);
}

var fibo = [0, 1, 1];
function f() {
  const i = fibo.length;
  fibo.push(fibo[i-1] + fibo[i-2]);
  if (fibo[i] <= n) {
    out = out.replaceAt(fibo[i]-1, 'O');
    f();
  }
}
f();

print(out);

var n = parseInt(readline());
var out = 'O' + Array(n).join('o');

String.prototype.replaceAt = function(index, replacement) {
  return this.substr(0, index) + replacement + this.substr(index + replacement.length);
}

var fibo = [0, 1, 1];
function f() {
  var i = fibo.length;
  fibo.push(fibo[i-1] + fibo[i-2]);
  if (fibo[i] <= n) {
    out = out.replaceAt(fibo[i]-1, 'O');
    f();
  }
}
f();

print(out);

function a(n) {
  return n % Math.sqrt(n) === 0;
}

function b(n) {
  return a(5 * n * n + 4) || a(5 * n * n - 4);
}

function main() {
  var n = readline();
  var x = '';

  for (var i = 1; i <= n; i++) {
    x = x + (b(i) ? 'O' : 'o');
  }

  print(x);
}

main();

n = +readline()
fib = []
fib.push(1)
fib.push(1)
for (i = 2; i < 20; i++)
  fib[i] = fib[i - 1] + fib[i - 2]
ans = ''
for (i = 1; i <= n; i++)
  ans += (fib.includes(i) ? 'O' : 'o')
print(ans)

var t = readline();
el(t);
function el(n){
  var a = 0;
  var b = 1;
  var c;
  var f = [];
  for(var i = 0;i <= n;i++){
    c = a + b;
    a = b;
    b = c;
    f.push(a);
    write(f.includes(i) ? 'O' : i > 0 ? 'o' : '');
  }
  return print();
}

var t = readline();
print(el(t));

function el(n){
  var a = 0;
  var b = 1;
  var c;
  var f = [];
  var s = [];
  for(var i = 0;i <= n;i++){
    c = a + b;
    a = b;
    b = c;
    f.push(a);
    if(f.includes(i)){
        s.push('O');
       }else if(i > 0){
         s.push('o');
       }
  }
  s = s.join('');
  return s;
}

var el = function(n){
  var a = 0;
  var b = 1;
  var c;
  var f = [];
  var s = [];
  for(var i = 0;i <= n;i++){
    c = a + b;
    a = b;
    b = c;
    f.push(a);
    if(f.includes(i)){
        s.push('O');
       }else if(i > 0){
         s.push('o');
       }
  }
  s = s.join('');
  return s;
};
el(8);

function el(n){
  var a = 0;
  var b = 1;
  var c;
  var f = [];
  var s = [];
  for(var i = 0;i <= n;i++){
    c = a + b;
    a = b;
    b = c;
    f.push(a);
    if(f.includes(i)){
        s.push('O');
       }else if(i > 0){
         s.push('o');
       }
  }
  s = s.join('');
  return s;
};
el(8);

'use strict';

let n = parseInt(readline(), 10);
const isFibo = new Array(n + 1);
const fibo = [0, 1];
for (let i = 2; fibo[fibo.length - 1] <= n; i++) {
  fibo.push(fibo[i - 2] + fibo[i - 1]);
}

fibo.pop();

for (const i of fibo) {
  isFibo[i] = true;
}

for (let i = 1; i <= n; i++)
  write(isFibo[i] ? '0' : 'o');
print()

var el = function(n){
  var a = 0;
  var b = 1;
  var c;
  var f = [];
  var s = [];
  for(var i = 0;i <= n;i++){
    c = a + b;
    a = b;
    b = c;
    f.push(a);
    if(f.includes(i)){
        s.push('O');
       }else if(i > 0){
         s.push('o');
       }
  }
  return s.join('');
};

function el(n){
  var a = 0;
  var b = 1;
  var c;
  var f = [];
  var s = [];
  for(var i = 0;i <= n;i++){
    c = a + b;
    a = b;
    b = c;
    f.push(a);
    if(f.includes(i)){
        s.push('O');
       }else if(i > 0){
         s.push('o');
       }
  }
  s = s.join('');
  return s;
}
print(el(8));


You are given an array $$$a$$$ of $$$n$$$ positive integers.You can use the following operation as many times as you like: select any integer $$$1 \le k \le n$$$ and do one of two things:   decrement by one $$$k$$$ of the first elements of the array.  decrement by one $$$k$$$ of the last elements of the array. For example, if $$$n=5$$$ and $$$a=[3,2,2,1,4]$$$, then you can apply one of the following operations to it (not all possible options are listed below):   decrement from the first two elements of the array. After this operation $$$a=[2, 1, 2, 1, 4]$$$;  decrement from the last three elements of the array. After this operation $$$a=[3, 2, 1, 0, 3]$$$;  decrement from the first five elements of the array. After this operation $$$a=[2, 1, 1, 0, 3]$$$; Determine if it is possible to make all the elements of the array equal to zero by applying a certain number of operations.

The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 30000$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case begins with a line containing one integer $$$n$$$ ($$$1 \le n \le 30000$$$) — the number of elements in the array. The second line of each test case contains $$$n$$$ integers $$$a_1 \ldots a_n$$$ ($$$1 \le a_i \le 10^6$$$). The sum of $$$n$$$ over all test cases does not exceed $$$30000$$$.

For each test case, output on a separate line:    YES, if it is possible to make all elements of the array equal to zero by applying a certain number of operations.  NO, otherwise.  The letters in the words YES and NO can be outputed in any case.

let input = ''

process.stdin.on('data', (x) => input += x)

process.stdin.on('end', () => {
  const lines = input.trim().split('\n')
  let curLine = 0
  const T = parseInt(lines[curLine++])
  for (let t = 0; t < T; t++) {
    let ans = 'YES'
    let delta = 0
    let last = 1e7
    curLine++
    parseIntArray(lines[curLine++]).forEach((x) => {
      if (ans === 'NO') {
        return
      }

      if (x + delta < 0) {
        ans = 'NO'
        return
      }

      if (x + delta > last) {
        delta -= x + delta - last
      }

      last = x + delta
    })
    console.log(ans)
  }
})

const parseIntArray = (line) => line.split(' ').map((x) => parseInt(x))

let input = ''

process.stdin.on('data', (x) => input += x)

process.stdin.on('end', () => {
  const lines = input.trim().split('\n')
  let curLine = 0
  const T = parseInt(lines[curLine++])
  for (let t = 0; t < T; t++) {
    let ans = 'YES'
    let delta = 0
    let last = 1e7
    curLine++
    parseIntArray(lines[curLine++]).forEach((x) => {
      if (ans === 'NO') {
        return
      }

      x += delta

      if (x < 0) {
        ans = 'NO'
        return
      }

      if (x > last) {
        delta -= x - last
      }

      last = x
    })
    console.log(ans)
  }
})

const parseIntArray = (line) => line.split(' ').map((x) => parseInt(x))


A PIN code is a string that consists of exactly $$$4$$$ digits. Examples of possible PIN codes: 7013, 0000 and 0990. Please note that the PIN code can begin with any digit, even with 0.Polycarp has $$$n$$$ ($$$2 \le n \le 10$$$) bank cards, the PIN code of the $$$i$$$-th card is $$$p_i$$$.Polycarp has recently read a recommendation that it is better to set different PIN codes on different cards. Thus he wants to change the minimal number of digits in the PIN codes of his cards so that all $$$n$$$ codes would become different.Formally, in one step, Polycarp picks $$$i$$$-th card ($$$1 \le i \le n$$$), then in its PIN code $$$p_i$$$ selects one position (from $$$1$$$ to $$$4$$$), and changes the digit in this position to any other. He needs to change the minimum number of digits so that all PIN codes become different.Polycarp quickly solved this problem. Can you solve it?

The first line contains integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases in the input. Then test cases follow. The first line of each of $$$t$$$ test sets contains a single integer $$$n$$$ ($$$2 \le n \le 10$$$) — the number of Polycarp's bank cards. The next $$$n$$$ lines contain the PIN codes $$$p_1, p_2, \dots, p_n$$$ — one per line. The length of each of them is $$$4$$$. All PIN codes consist of digits only.

Print the answers to $$$t$$$ test sets. The answer to each set should consist of a $$$n + 1$$$ lines In the first line print $$$k$$$ — the least number of changes to make all PIN codes different. In the next $$$n$$$ lines output the changed PIN codes in the order corresponding to their appearance in the input. If there are several optimal answers, print any of them.

const zero  = "0".charCodeAt(0);
const space = " ".charCodeAt(0);
var t = Number(readline());
for(var j=0;j<t;j++){
 var n = Number(readline());
 var p = [];
 var m = 0;
 var c = 0;
 for(var i=0;i<n;i++){
  p[i] = readline();
  m |= (1<<p[i].charCodeAt(0)-zero);
  for(var k=0;k<i;k++){
   if(p[i]==p[k]){
    p[i]=" "+p[i].substring(1);
    c++;
    break;
   }
  }
 }
 print(c);
 for(var i=0;i<n;i++){
  if(p[i].charCodeAt(0)==space){
   for(var k=0;k<10;k++){
    var q = 1<<k;
    if(m&q) continue;
    m |= q;
    print(String.fromCharCode(zero+k)+p[i].substring(1));
    break;
   }
  } else {
    print(p[i]);
  }
 }
}

const zero  = "0".charCodeAt(0);
const space = " ".charCodeAt(0);
var t = Number(readline());
for(var j=0;j<t;j++){
 var n = Number(readline());
 var p = [];
 var m = 0;
 var c = 0;
 for(var i=0;i<n;i++){
  p[i] = readline();
  m |= (1<<p[i].charCodeAt(0)-zero);
  for(var k=0;k<i;k++){
   if(p[i]==p[k]){
    p[i]=" "+p[i].substring(1);
    c++;
    break;
   }
  }
 }
 print(c);
 for(var i=0;i<n;i++){
  if(p[i].charCodeAt(0)==space){
   for(var k=0;k<i;k++){
    var q = 1<<k;
    if(m&q) continue;
    m |= q;
    print(String.fromCharCode(zero+k)+p[i].substring(1));
   }
  } else {
    print(p[i]);
  }
 }
}

const zero  = "0".charCodeAt(0);
const space = " ".charCodeAt(0);
var t = Number(readline());
for(var j=0;j<t;j++){
 var n = Number(readline());
 var p = [];
 var m = 0;
 var c = 0;
 for(var i=0;i<n;i++){
  p[i] = readline();
  m |= (1<<p[i].charCodeAt(0)-zero);
  for(var k=0;k<i;k++){
   if(p[i]==p[k]){
    p[i]=" "+p[i].substring(1);
    c++;
    break;
   }
  }
 }
 print(c);
 for(var i=0;i<n;i++){
  if(p[i].charCodeAt(0)==space){
   for(var k=0;k<10;k++){
    var q = 1<<k;
    if(m&q) continue;
    m |= q;
    print(String.fromCharCode(zero+k)+p[i].substring(1));
   }
  } else {
    print(p[i]);
  }
 }
}


Alicia has an array, $$$a_1, a_2, \ldots, a_n$$$, of non-negative integers. For each $$$1 \leq i \leq n$$$, she has found a non-negative integer $$$x_i = max(0, a_1, \ldots, a_{i-1})$$$. Note that for $$$i=1$$$, $$$x_i = 0$$$.For example, if Alicia had the array $$$a = \{0, 1, 2, 0, 3\}$$$, then $$$x = \{0, 0, 1, 2, 2\}$$$.Then, she calculated an array, $$$b_1, b_2, \ldots, b_n$$$: $$$b_i = a_i - x_i$$$.For example, if Alicia had the array $$$a = \{0, 1, 2, 0, 3\}$$$, $$$b = \{0-0, 1-0, 2-1, 0-2, 3-2\} = \{0, 1, 1, -2, 1\}$$$.Alicia gives you the values $$$b_1, b_2, \ldots, b_n$$$ and asks you to restore the values $$$a_1, a_2, \ldots, a_n$$$. Can you help her solve the problem?

The first line contains one integer $$$n$$$ ($$$3 \leq n \leq 200\,000$$$) – the number of elements in Alicia's array. The next line contains $$$n$$$ integers, $$$b_1, b_2, \ldots, b_n$$$ ($$$-10^9 \leq b_i \leq 10^9$$$). It is guaranteed that for the given array $$$b$$$ there is a solution $$$a_1, a_2, \ldots, a_n$$$, for all elements of which the following is true: $$$0 \leq a_i \leq 10^9$$$.

Print $$$n$$$ integers, $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 10^9$$$), such that if you calculate $$$x$$$ according to the statement, $$$b_1$$$ will be equal to $$$a_1 - x_1$$$, $$$b_2$$$ will be equal to $$$a_2 - x_2$$$, ..., and $$$b_n$$$ will be equal to $$$a_n - x_n$$$. It is guaranteed that there exists at least one solution for the given tests. It can be shown that the solution is unique.

var times = parseInt(readline());
var b = readline().split(" ").map(function(x) { return parseInt(x); });

var a =[];
var mx = 0;
for(var i = 0; i < times; i++)
{
    a.push(mx + b[i]);
    write(a[i] + " ");
    mx = Math.max(mx, a[i]);
}

var n = parseInt(readline());
var b = readline().split(" ").map(function(x) {
  return parseInt(x);
});
var a = []
var mx = 0;
for (var i = 0; i < n; i++) {
  a.push(b[i] + mx);
  print(a[i])
  mx = Math.max(mx, a[i]);
}

function main() {
    var n = parseInt(readline());
    var bs = readline().split(' ').map(x => parseInt(x));
    var as = Array(n).fill(0);
    as[0] = bs[0];
    var mx = bs[0];
    print(as[0])
    for(var i = 1; i < n; i++){
        as[i] = bs[i] + mx;
        mx = Math.max(mx, as[i]);
        print(as[i])
    }
}
main();

//var input = readline();
var T = parseInt(readline());

var s = 0, b = [];
var ar = readline().split(' ').map(x => parseInt(x));
for (var i = 0; i < T; i++) {
    b[i] = ar[i] + s;
    s = Math.max(s, b[i]);
    print(b[i]);
}

var t = Number(readline());
var inp = readline().split(' ').map(cur => Number(cur));

var out = []
var max = 0;
inp.forEach((cur, i) => {
    if(cur < 0)
        out.push(max+cur)
    else{
        max += cur;
    out.push(max);
    }

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

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

let input = ''
let ptr = 0
process.stdin.on('data', (i) => {
  input += i
})

process.stdin.on('end', () => {
  input = input.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main()
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt() {
  return parseInt(input[ptr++])
}

function readString() {
  return input[ptr++]
}

function readStrings() {
  return input[ptr++].split(' ')
}

function readInts() {
  return input[ptr++].split(' ').map(a => parseInt(a))
}

function main() {
  const n = readInt()
  const b = readInts()
  let m = 0
  const a = new Array(n)
  a[0] = b[0]
  m = a[0]
  for(let i = 1;i < n; i++) {
    m = Math.max(m, a[i - 1])
    // wr(a, m)
    a[i] = b[i] + m
  }
  wr(a.join(' '))
}

// Alternative
// https://www.npmjs.com/package/competitive-programming-js
"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 input() { return inputString[currentLine++]; }
const println = (x = "") => process.stdout.write(String(x) + "\n");
const print = x => { process.stdout.write(String(x)); }
// >>>>>>>>>>>>> Main starts here <<<<<<<<<<<<<<

function main() {
    let n = parseInt(input());
    let x = input().split(' ').map(v => parseInt(v));
    // let b = [], a = [];
    let b = new Array(n);
    let a = new Array(n);
    // b.push(0);
    // a.push(x[0]);
    b[0] = 0;
    a[0] = x[0];
    let mx = x[0];
    for (let i = 1; i < n; ++i) {
        // b.push(mx);
        b[i] = mx;
        a[i] = (b[i] + x[i]);
        mx = Math.max(a[i], mx);
    }
    a.forEach(v => print(v + ' '));
    println();
}

// Alternative
// https://www.npmjs.com/package/competitive-programming-js
"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 input() { return inputString[currentLine++]; }
const println = (x = "") => process.stdout.write(String(x) + "\n");
const print = x => { process.stdout.write(String(x)); }
// >>>>>>>>>>>>> Main starts here <<<<<<<<<<<<<<

function main() {
    let n = parseInt(input());
    let x = input().split(' ').map(v => parseInt(v));
    let b = [], a = [];
    b.push(0);
    a.push(x[0]);
    let mx = x[0];
    for (let i = 1; i < n; ++i) {
        b.push(mx);
        a.push(b[i] + x[i]);
        mx = Math.max(a[i], mx);
    }
    a.forEach(v => print(v + ' '));
    println();
}

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

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

  const arr = d.split(' ').map(Number);
  let curr = Math.max(0, arr[0]);
  const ans = [curr];

  for (let i = 1; i < arr.length; i++) {
    if (arr[i] <= 0) {
      ans.push(Math.max(0, curr + arr[i]));
    }
    else {
      curr += arr[i];
      ans.push(curr);
    }
  }

  console.log(ans.join(' '));

  c++;
});

process.stdin.resume();
process.stdin.setEncoding('utf-8')
let inputString = '';
let currentLine = 0;
process.stdin.on('data', input => { inputString += input; })
process.stdin.on('end', _ => { inputString = inputString.split('\n'); main(); })
const readline = () => { return inputString[currentLine++] }

function main() {
    let n = parseInt(readline());
    let bs = readline().split(' ').map(x => parseInt(x));
    let as = Array(n).fill(0);
    as[0] = bs[0];
    let mx = bs[0];
    for(let i = 1; i < n; i++){
        as[i] = bs[i] + mx;
        mx = Math.max(mx, as[i]);
    }
    console.log(as.join(' '));
}

const processData = (lines) => {
  const nums = lines[1].split(' ').map(x => +x)
  const res = []
  let curMax = 0
  for (let i=0; i<nums.length; i++) {
    res.push(nums[i] + curMax)
    curMax = Math.max(curMax, nums[i] + curMax)
  }
  console.log(res.join(' '))
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

var t = Number(readline());
var inp = readline().split(' ').map(cur => Number(cur));

var out = []
var max = 0;
inp.forEach((cur, i) => {
    if(i !== inp.length-1){
    if(cur >= 0)
    max += cur;
    }else max += cur;

    out.push(max);
});
print(out.join(' '));

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

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

  const arr = d.split(' ').map(Number);
  let curr = Math.max(0, arr[0]);
  const ans = [curr];

  for (let i = 1; i < arr.length; i++) {
    if (arr[i] <= 0) {
      ans.push(0);
    }
    else {
      curr += arr[i];
      ans.push(curr);
    }
  }

  console.log(ans.join(' '));

  c++;
});


Santa has $$$n$$$ candies and he wants to gift them to $$$k$$$ kids. He wants to divide as many candies as possible between all $$$k$$$ kids. Santa can't divide one candy into parts but he is allowed to not use some candies at all.Suppose the kid who recieves the minimum number of candies has $$$a$$$ candies and the kid who recieves the maximum number of candies has $$$b$$$ candies. Then Santa will be satisfied, if the both conditions are met at the same time:  $$$b - a \le 1$$$ (it means $$$b = a$$$ or $$$b = a + 1$$$);  the number of kids who has $$$a+1$$$ candies (note that $$$a+1$$$ not necessarily equals $$$b$$$) does not exceed $$$\lfloor\frac{k}{2}\rfloor$$$ (less than or equal to $$$\lfloor\frac{k}{2}\rfloor$$$). $$$\lfloor\frac{k}{2}\rfloor$$$ is $$$k$$$ divided by $$$2$$$ and rounded down to the nearest integer. For example, if $$$k=5$$$ then $$$\lfloor\frac{k}{2}\rfloor=\lfloor\frac{5}{2}\rfloor=2$$$.Your task is to find the maximum number of candies Santa can give to kids so that he will be satisfied.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 5 \cdot 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The $$$i$$$-th test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^9$$$) — the number of candies and the number of kids.

For each test case print the answer on it — the maximum number of candies Santa can give to kids so that he will be satisfied.

NoteIn the first test case, Santa can give $$$3$$$ and $$$2$$$ candies to kids. There $$$a=2, b=3,a+1=3$$$.In the second test case, Santa can give $$$5, 5, 4$$$ and $$$4$$$ candies. There $$$a=4,b=5,a+1=5$$$. The answer cannot be greater because then the number of kids with $$$5$$$ candies will be $$$3$$$.In the third test case, Santa can distribute candies in the following way: $$$[1, 2, 2, 1, 1, 2, 1]$$$. There $$$a=1,b=2,a+1=2$$$. He cannot distribute two remaining candies in a way to be satisfied.In the fourth test case, Santa can distribute candies in the following way: $$$[3, 3]$$$. There $$$a=3, b=3, a+1=4$$$. Santa distributed all $$$6$$$ candies.

'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 readALine() {
    return inputString[currentLine++];
}

function printALine(str) {
    console.log(str);
}

function stringArrayToNumbers(str) {
    var array = str.split(" ");
    var result = [];
    for( var i = 0; i < array.length; i++ ) {
        result.push( parseInt(array[i]) );
    }
    return result;
}

function stringArrayToBigInts(str) {
    var array = str.split(" ");
    var result = [];
    for( var i = 0; i < array.length; i++ ) {
        result.push( BigInt(array[i]) );
    }
    return result;
}

// ======================================================
// B. Candies Division
// http://codeforces.com/problemset/problem/1283/B
// ======================================================

function doIt( numOfCandies, numOfKids ) {

    var candiesPerKid = Math.floor(numOfCandies/numOfKids);
    var candiesLeft = (numOfCandies % numOfKids);
    var extra = candiesLeft;
    if( extra > numOfKids / 2 ) {
        extra = Math.floor(numOfKids / 2);
    }
    var result = candiesPerKid * numOfKids + extra;
    printALine(result);

}

function main() {

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        doIt( arr[0], arr[1] );
    }

}

'use strict';

const fs = require('fs');

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main(inputString);
});

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    return sharedCandies + min(remainedCandies, parseInt(kids / 2));
}

function min(value1, value2) {
    return value1 < value2 ? value1 : value2;
}

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').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))

  const t = readInt(arr)

  for(let j = 0; j < t; j++) {
    const [n, k] = readInts(arr, j)

    let rem = n % k
    let a = Math.floor(n / k)
    let ans = k * a + Math.min(Math.floor(k / 2), rem)

    wr(ans)
  }
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}
function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

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

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

  const [n, k] = d.split(' ').map(Number);
  const ans = Math.min(n, Math.floor(n / k) * k + Math.floor(k / 2));
  console.log(ans);

  c++;
});

var n = parseInt(readline());
while(n--){
  var z = readline();
  var t = z.split(' ').map(e => parseInt(e));
  print(Math.min(t[0], t[0] - t[0]%t[1] + Math.floor(t[1]/2)));
}

'use strict'

const problem = (n, k) => (n - n % k) + Math.min(k >> 1, n % k)
let q = +readline();
while(q--) print(problem(...readline().split(' ').map(Number)))

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var nchilds = readline().split(' ').map(Number);
    var n = nchilds[0];
    var childs = nchilds[1];
    var base = Math.floor(n / childs);
    var other = Math.min(n - childs * base, Math.floor(childs / 2))
    print(childs * base + other);
  }
}

main();

"use strict";

let numberOfInputs = +readline();

let arrayOfInputs = [];
let nk = [];

for (let i = 0; i < numberOfInputs; i++) {
	arrayOfInputs[i] = readline();
	nk[i] = arrayOfInputs[i].split(' ').map(function(item) {
		return +item;
	});
}

function getGoodCandyNumber(n, k) {
	let goodCelNumber = 0;
	let goodOst = 0;
	let ost = n % k;

	// goodCelNumber = (n - n%k)/k;

	if (ost > Math.floor(k / 2)) {
		goodOst = Math.floor(k / 2);
		return n - (ost - goodOst);
	} else {
		goodOst = ost;
		return n;
	}
}

for (let i = 0; i < numberOfInputs; i++) {
	print(getGoodCandyNumber(nk[i][0], nk[i][1]));
}

var print = this.print || require('lol-io').print; //print --> outputs result and adds (enter)
var write = this.write || require('lol-io').write; //write --> creates output.txt with output
var readline = this.readline || require('lol-io').readline; //readline --> reads unread line of input.txt

var t, arr, ans, candy, children;

t = Number(readline());

for (i = 0; i < t; i++) {

    arr = readline().replace(/\r$/, '').split(' ').map(Number);
    ans = 0;
    candy = arr[0];
    children = arr[1];

    ans = (Math.floor(candy / children)) * children;
    candy -= ans;

    if (candy > Math.floor(children / 2)) {

        ans += Math.floor(children / 2)
    } else {

        ans += candy;
    }

    print(ans)
}

var t = readline();
while(t--) {
    var a = readline().split(" ").map(function(num) {
        return parseInt(num);
    });
    var modest = Math.floor(a[0] / a[1]);
    var remainder = a[0] % a[1];
    var border = Math.floor(a[1] / 2);
    if(remainder > border) {
        remainder = border;
    }
    var ans = modest * a[1] + remainder;
    print(ans);
}

var cant = readline();

for (var i=0; i < cant; i++) {
   var num = readline().split(" ").map(x => parseInt(x));
   var k = num[1];
   var n = num[0];
   var full = n - n % k;
   full+= Math.min(n%k, k/2);
   print(Math.floor(full));
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var totalCandy;
    if (restCandy) {
        var halfChildren = Math.floor(childrenCount / 2);
        if (restCandy > halfChildren) {
            restCandy = halfChildren;
        }
        totalCandy = firstCandy + restCandy;
    } else {
        totalCandy = firstCandy;
    }
    print(totalCandy);
}

'use strict';

const fs = require('fs');

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main(inputString);
});

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    if (remainedCandies > (parseInt(kids / 2) - 1)) {
        sharedCandies += parseInt(kids / 2);
    }

    return sharedCandies;
}

'use strict';

const fs = require('fs');

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main(inputString);
});

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    if (remainedCandies >= (parseInt(kids / 2) - 1)) {
        sharedCandies += parseInt(remainedCandies / 2) + 1;
    }

    return sharedCandies;
}

'use strict';

const fs = require('fs');

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main(inputString);
});

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    if (remainedCandies >= (parseInt(kids / 2) - 1)) {
        sharedCandies += parseInt(kids / 2) + 1;
    }

    return sharedCandies;
}

'use strict';

const fs = require('fs');

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main(inputString);
});

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    if (remainedCandies >= (parseInt(kids / 2) - 1)) {
        sharedCandies += parseInt(kids / 2);
    }

    return sharedCandies;
}

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').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))

  const t = readInt(arr)

  for(let j = 0; j < t; j++) {
    const [n, k] = readInts(arr, j)

    let rem = n % k
    let a = Math.floor(n / k)
    let ans = k * a + Math.floor(k / 2)

    wr(ans)
  }
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}
function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

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

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

  const [n, k] = d.split(' ').map(Number);

  if (n % k === 0) {
    ans += `${Math.floor(n / k) * k}\n`;
  }
  else {
    ans += `${Math.floor(n / k) * k + Math.floor(k / 2)}\n`;
  }
  c++;
});

rl.on('close', () => {
  console.log(ans);
});

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

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

  const [n, k] = d.split(' ').map(Number);

  if (n <= k) {
    ans += `${n}\n`;
  }
  else if (n % k === 0) {
    ans += `${Math.floor(n / k) * k}\n`;
  }
  else {
    ans += `${Math.min(n, Math.floor(n / k) * k + Math.floor(k / 2))}\n`;
  }
  c++;
});

rl.on('close', () => {
  console.log(ans);
});

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

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

  const [n, k] = d.split(' ').map(Number);

  if (n <= k) {
    ans += `${n}\n`;
  }
  else if (n % k === 0) {
    ans += `${Math.floor(n / k) * k}\n`;
  }
  else {
    ans += `${Math.floor(n / k) * k + Math.floor(k / 2)}\n`;
  }
  c++;
});

rl.on('close', () => {
  console.log(ans);
});

'use strict';

let friendsNumber = +readline(); //!
let wishString = readline(); //!
let arrayOfWishNumbers = wishString.split(" ").map(function(item) {
	return +item;
});

let sortedWish = [];
let zeroIndexes = [];
let zeroValues = [];

for (let i = 0; i < arrayOfWishNumbers.length; i++) {
	if (arrayOfWishNumbers[i] === 0) {
		zeroIndexes.push(i);
	}
	sortedWish[i] = 0;
}

for (let i = 0; i < sortedWish.length; i++) {
	if (arrayOfWishNumbers[i] !== 0) {
		sortedWish[arrayOfWishNumbers[i] - 1] = arrayOfWishNumbers[i];
	}
}

for (let i = 0; i < sortedWish.length; i++) {
	if (sortedWish[i] === 0) {
		zeroValues.push(i + 1);
	}
}

let goodSortedZeroValues = [];
//

// zeroValues = zeroValues.reverse();
// if (zeroValues.length % 2 == 1) {
// 	let tempValue = zeroValues[Math.floor(zeroValues.length / 2)];
// 	zeroValues[Math.floor(zeroValues.length / 2)] = zeroValues[Math.floor(zeroValues.length / 2) + 1];
// 	zeroValues[Math.floor(zeroValues.length / 2) + 1] = tempValue;
// }

// let badSortedValues = [];

// for (let i = 0; i < zeroValues.length; i++) {
// 	if (zeroValues[i] = zeroIndexes[i] + 1) {
// 		badSortedValues.push(zeroValues[i]);
// 	}
// }

// for (let i = 0; i < badSortedValues.length; i++) {
// 	for (let j = 0; j < zeroValues.length; j++) {
// 		if (zeroValues[j] === badSortedValues[i]) {
// 			let tempValue = zeroValues[j];
// 			for (let k = 0; k < zeroValues.length; k++) {
// 				if (zeroValues[k] !== 0;)
// 			}
// 		}
// 	}
// }

for (let i = 0; i < zeroValues.length; i++) {
	if (zeroValues[i] === zeroIndexes[i] + 1) {
		for (let j = 0; j < zeroValues.length; j++) {
			let tempValue = zeroValues[i];
			if (zeroValues[i] !== zeroValues[j]) {
				zeroValues[i] = zeroValues[j];
				zeroValues[j] = tempValue;
				break;
			}
		}
	}
}

//
if (zeroValues.length === zeroIndexes.length) {

	for (let i = 0; i < zeroIndexes.length; i++) {
		arrayOfWishNumbers[zeroIndexes[i]] = zeroValues[i];
	}
}

let result = arrayOfWishNumbers.join(" ");

print(result);

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    if (candyCount < childrenCount) {
        print(candyCount);
        continue;
    }
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var totalCandy;
    if (restCandy) {
        var halfChildren = Math.floor(childrenCount / 2);
        if (restCandy > halfChildren) {
            restCandy = Math.floor(restCandy/halfChildren) * halfChildren;
        }
        totalCandy = firstCandy + restCandy;
    } else {
        totalCandy = firstCandy;
    }
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var totalCandy;
    if (restCandy) {
        var halfChildren = Math.floor(childrenCount / 2);
        if (restCandy > halfChildren) {
            restCandy = Math.floor(restCandy/halfChildren) * halfChildren;
        }
        totalCandy = firstCandy + restCandy;
    } else {
        totalCandy = firstCandy;
    }
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount);
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.floor(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.floor(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.ceil(candyCount / childrenCount);
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.ceil(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.floor(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    } else {
        restCandy = Math.floor(restCandy/halfChildren) * halfChildren;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.floor(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    } else {
        restCandy = Math.floor(restCandy/halfChildren) * childrenCount;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var totalCandy;
    if (restCandy) {
        var halfChildren = Math.floor(childrenCount / 2);
        if (restCandy <= halfChildren) {
            restCandy = halfChildren;
        } else {
            restCandy = Math.floor(restCandy/halfChildren) * halfChildren;
        }
        totalCandy = firstCandy + restCandy;
    } else {
        totalCandy = firstCandy;
    }
    print(totalCandy);
}


Little Vasya loves orange juice very much. That's why any food and drink in his kitchen necessarily contains orange juice. There are n drinks in his fridge, the volume fraction of orange juice in the i-th drink equals pi percent.One day Vasya decided to make himself an orange cocktail. He took equal proportions of each of the n drinks and mixed them. Then he wondered, how much orange juice the cocktail has.Find the volume fraction of orange juice in the final drink.

The first input line contains a single integer n (1 ≤ n ≤ 100) — the number of orange-containing drinks in Vasya's fridge. The second line contains n integers pi (0 ≤ pi ≤ 100) — the volume fraction of orange juice in the i-th drink, in percent. The numbers are separated by a space.

Print the volume fraction in percent of orange juice in Vasya's cocktail. The answer will be considered correct if the absolute or relative error does not exceed 10  - 4.

NoteNote to the first sample: let's assume that Vasya takes x milliliters of each drink from the fridge. Then the volume of pure juice in the cocktail will equal  milliliters. The total cocktail's volume equals 3·x milliliters, so the volume fraction of the juice in the cocktail equals , that is, 66.(6) percent.

let lines = [];
require('readline').createInterface({input: process.stdin,output: process.stdout})
				.on('line', line => {lines.push(line);})
				.on('close', () => {main(lines)});

const main = (input) => {
	var n = parseInt(input[0]);
	var percentages = input[1].split(" ").map(num => parseInt(num));
	var sum = 0;
	for (var i = 0; i < n; i++) {
		sum += percentages[i];
	}
	console.log(sum/n);
}

function main() {
    // write code here:
    const n = Number(stdin[0]);
    var arr = stdin[1].split(' ').map(Number);
    var percent=0.0;
    for(let i=0;i<n;i++){
        //parseFloat()这一函数很管用，解决小数点后0的问题
        percent+=parseFloat(arr[i]/100);
    }
    percent=(percent/n)*100;
    console.log(percent.toFixed(12));
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {
    stdin.push(line);
});
rl.on('close', main);

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}
function main() {
  const len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  const avg = arr.reduce((avg, num) => {
    avg = avg + num / len;
    return avg;
  }, 0);
  console.log(avg);
}

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

let input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
    const all = parseInt(input[0], 10)
    const percent = input[1].split(' ')
    let all_percent = 0
    percent.forEach(el => {
        all_percent += parseInt(el, 10) / 100
    })
    let _result = (all_percent / all) * 100
    console.log(_result.toFixed(12))
})

//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 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 N = nextInt();
  var list = nextIntArray();
  var sum = 0;
  for(var i = 0; i < N; i++){
    var tmp = list[i] / 100;
    sum += tmp;
  }
  myout((sum / N) * 100);
}

// http://codeforces.com/problemset/problem/977/A
module.exports = solve;
function solve(line) {
    let i = line.split(' ').map(n => parseInt(n, 10));
    return i.reduce((acc, c)=> acc + c, 0)/i.length;
}

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

let i = 0;
rl.on('line', (line) => {
    if (i++) {
        console.log(solve(line))
        rl.close();
    }
});

//Drinks

const {EOL} = require('os');

let inp = '';

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

process.stdin.on('end', () => {
    let lines = inp.split(EOL)[1].split(' ').map(c => +c);

    process.stdout.write((lines.reduce((a, b) => a + b) / lines.length) + '');

    return;
});

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

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

  const total = n * 100;
  const values = d.split(' ').map(Number);
  const v = values.reduce((acc, curr) => acc + curr, 0);
  const ans = v / total * 100;

  console.log(ans);

  c++;
});

const input = [];

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

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

RL.on('close', () => {
  const nums = input[1].split(' ').map(x => parseInt(x));
  let answer = 0.0;
  nums.forEach(i => answer += i);

  console.log( (answer / nums.length).toPrecision(12) );
});

let inputString = '';
let currentLine = 0;
process.stdin.on('data', data => {
	inputString += data;
});
process.stdin.on('end', function () {
	inputString = inputString
		.trim()
		.split('\n')
		.map(str => str.trim());
	main();
});

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

function isPrime(x) {
	let s = Math.sqrt(x);
	let i = 2;
	while (i <= s) {
		if (x % i === 0) {
			return false;
		}
		i++;
	}
	return true;
}

function main() {
	let n = readLine() >> 0;
	let arr = readLine()
		.split(' ')
		.map(x => x >> 0);

	let x = 0;

	arr.forEach(item => (x += item / 100));
	x /= n;
	x *= 100;
	console.log(x.toFixed(12));
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', (inputStd) => {
    inputString += inputStd;
});
process.stdin.on('end', function () {
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => {
            return str.trim();
        });
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    let n = parseInt(readLine());
    let portions = readLine().split(' ').map(Number);
    let orangePortions = 0;

    for (let i = 0; i < portions.length; i++) {
        orangePortions = orangePortions + portions[i] / 100;
    }

    let orangeValue = orangePortions / n;

    console.log(orangeValue * 100);
}

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

const input = [];
readline.on('line', line => { input.push(line); });

readline.on('close', () => {
    const [n] = input[0].split(' ').map(Number);
    const arr = input[1].split(' ').map(Number);
    console.log(arr.reduce((acc, curr) => acc + curr) / n);
});

const readline = require('readline');

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

var count = 0;
var total = 0.0;
var mix = 0;

rl.on('line', (data) => {

    if(count!=0) {
        data = data .trim();

        var splitted = data.split(" ");
        var len = splitted.length;

        for(var idx = 0; idx<len; idx++) {
            total = total + (parseFloat(splitted[idx])/100);
        }

        var vardict = total/mix;
        vardict*=100;
        console.log(vardict.toFixed(12));

        count = 0, total = 0.0, mix = 0;

    } else {
        data = data .trim();
        mix = parseInt(data);
        ++count;
    }
});

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    let totalDrinksInFridge = parseInt(lines[0]);
    let orangePercentagePerDrink = lines[1].split(" ").map( value => {
        return parseInt(value)
    });

    let totalOragePercentage = 0
    orangePercentagePerDrink.forEach( singleDrinkPercentage => {
        totalOragePercentage = totalOragePercentage + singleDrinkPercentage
    })

    let orangeVolumeInCoktail = (totalOragePercentage / totalDrinksInFridge)

    console.log(orangeVolumeInCoktail.toPrecision(14))
})

let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split("\n").filter(data => data.length > 0);
for (let i = 0; i < txt.length; i += 2) {
    doit(txt[i] * 1, txt[i + 1].split(" ").filter(data => data.length > 0).map(data => data * 1));
}

function doit(num, tab) {
    let sum = 0;
    tab.forEach(data => {
        sum += data / 100;
    });
    console.log(sum / num * 100);
}

// Sample code to perform I/O:

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

function main(input) {
    let output = nameLookUp(input);
    process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {
    let inputs = str.trim().replace(/\r/g, '').split('\n');
    let percentageDrinks = inputs[1].split(' ');
    let sum = 0;
    for (let i = 0; i < +inputs[0]; i++) {
        if (percentageDrinks[i] != 0) {
            let denominator = Number(100 / percentageDrinks[i]).toFixed(2);
            sum += +Number(1 / denominator).toFixed(2);
        }
    }
    sum = (sum / inputs[0]) * 100;

    return sum.toString();
}

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

const input = [];
readLine.on('line', line => input.push(line));
const orange = () => {
    let ar = input[1].split(' ').map(x => +x);
    let q = ar.reduce((a, b) =>( a + b));
    console.log(q / +input[0]);
};
readLine.on('close', orange);

'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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main() {
    let n = parseInt(readLine());
    let arr = readLine().split(' ').map(value => parseInt(value));
    let total = arr.reduce((sum, value) => {
        return sum + value;
    }, 0)

    console.log(total / n.toFixed(12));
}

var n=readline();
var sum=readline().split(' ').reduce(function(a,b){return a+ +b;}, 0);

print( sum/n );

function sum(array){
	var result = 0;
	for(var i = 0; i < array.length; i++){
		result += +array[i];
	}
	return result;
}

var n = +readline(), p = readline().split(" ").map(Number),
ans = 0;

print((sum(p)/n).toFixed(12));

counter = 0
x = parseInt(readline())
d = readline().split(" ")
for (i=0 ; i<x;i++){
  counter += parseInt(d[i])
}
print(counter/x)

var input = parseInt(readline());
var orange = readline().split(" ").map(x=> parseInt(x));
var total = 0;
var total_orange = 0;
orange.forEach(o=>{
    total+=100;
    total_orange +=o;
    }
    );
    print((total_orange/total)*100);

;(function () {

	var n = +readline();
	var t = readline().split(' ').reduce(function (p, e) { return p + 1/(100/(+e)); }, 0);
	print(100 * t / n);

}).call(this);

var res = sol(readline(), readline());
print(res);

function sol(line, orange) {
    var input = line.split(" ");
    var percent = orange.split(" ").map((x) => Number(x));

    var n = Number(input[0]);

    var o = 0;

    for (var i = 0; i < n; i++) {
        o += (percent[i] / 100);
    }

    return o / n * 100;
}

(function() {
    'use strict';
    const n = readline();
    const z = readline().split(' ').map(Number);
    let x = 0;
    for (let i =0; i < n; ++i) {
        x += z[i] / 100;
    }
    let y = x / n * 100;
    print(y);
}());

var ingredientes = readline();
var porcentajes = readline().split(" ");
var suma_porcentajes = 0;

for (i=0;i<porcentajes.length;i++){
	suma_porcentajes=suma_porcentajes+parseInt(porcentajes[i]);
}

var total = suma_porcentajes/ingredientes;

print(total);

var n=readline().split(' ').map(function(x){return parseInt(x);});
var p=readline().split(' ').map(function(x){return parseInt(x);});
var ans=0;
for(var i=0;i<n;i++)
{
    ans+=(1/n)*p[i];
}
print(ans);

'use strict'
readline();
String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let array = readline().getNumArray(),
    ml = 0;

for (let i = 0; i < array.length; i++) {
  ml += array[i]/100;
}

write(((ml/array.length) * 100).toFixed(4));

var total=0;
// var drinkNumber=prompt();
var drinkNumber=readline();
// var drink=prompt().split(" ");
var drink=readline().split(" ");
// drink=parseInt(drink);
// print(drink);
for(var i=0;i<drinkNumber;i++){
    total=(total+parseInt(drink[i]));
}
// print(total);
// console.log(total/drinkNumber);
print(total/drinkNumber);

var n = readline();
var a = readline().split(' ');
var sum = 0;
for(i = 0; i < n; i++){
    sum += +a[i];
}
var res = (sum/100)/(n)*100;
print(res.toFixed(12));

var n = readline();
var rost = readline().split(" ");
var c = 0;
	for (var i=0; i<n; i++){
		c+=Number(rost[i]);
	}
print(c/n);

var x ,arr=[];
x=parseInt(readline());
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=parseInt(arr[i]);
}
ans=ans/100;
ans=(ans/x)*100;
print(ans);

var x ,arr=[];
x=parseInt(readline());
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=parseInt(arr[i]);
}

print(ans/x);

var n = Number(readline());
var s = readline().split(' ').map(Number);

var sum = 0;

for (var i = 0; i<n; i++) {
    sum+=s[i];
}
print(sum/n);

var computeSpace = function(arr)
    {
       var sum = 0;
        for (var counter = 0; counter <= arr.length - 1; counter++)
        {
            sum += arr[counter];
        }
        return ((sum * 100) / (arr.length * 100)).toFixed(12);
    }
var toNumArr = function(str)
    {
        str = str.split(' ');
        for (var i = 0; i <= str.length - 1; i++)
        {
            str[i] = +str[i];
        }
        return str;
    }
var num = readline();
var input = readline();
print(computeSpace(toNumArr(input)));

var n = parseInt(readline(), 10);
var p = readline().split(' ');

for(var i=0; i<p.length; i++) {
    p[i] = parseInt(p[i], 10);
}

print(p.reduce((a,b) => a+b) / n);

(function main() {
    var n = +readline(),
        result = readline()
            .split(" ")
            .map(function(a) {
                return +a;
            })
            .reduce(function(a, b) {
                return a + b;
            });

    print(result / n);

})();

// 200B   Напитки
/*
function main_1(){
    var n = parseInt(readline());
    var ans = 0;
    while (n--) {
        var nums = readline().split(' ').map(Number);
        ans += (nums[2] - nums[0] + 1) * (nums[3] - nums[1] + 1);
    }
    print(ans);
}

function main(){
    var line  = readline();
    //var line = prompt();
    var n = line.length;
    //alert(line);
    var m = 0;
    for(i=0;i<n;i+=2){
        for(j=i+1;j<n;j+=2){
            var ex = [line.slice(0, i), '(', line.slice(i,j) , ')' , line.slice(j)].join('');
            m = Math.max(m,eval(ex));
        }
    }
    print(m);
}
*/

var n = parseInt(readline());
var arrP = readline().split(' ').map(Number);

var sum = 0;
arrP.forEach(function(item, i, arrP) {
  sum += item;
});

var out = sum / n;

print(out);

var n=readline();
var x= readline().split(' ').map(Number);
var s = 0;
for(var i=0; i<n;i++){
    s += x[i];
}
print(s/n);

var n = readline();
var a = readline().split(' ').map(Number);
var ans = 0;
for(i = 0; i < n; i++) ans += a[i];
print(ans / n);

var numberOfDrinks = readline();
var percentages = readline().split(' ');

var sum = percentages.reduce((acc, percentage) => {
    return acc + parseInt(percentage);
}, 0);

print(sum > 0 ? sum/numberOfDrinks : sum);

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => Number(acc)+Number(cur) ,0);
var answer = result/drinks.length;
print(answer)

var o = readline();
var d = readline().split(' ');
var h = [];
for (i = 0; i <= d.length - 1; i++) {
    h.push(d[i] / 100);
}
function all(total, num) {
    return total + num;
}
var out =  (h.reduce(all) / o ) * 100;
print(out);

var x = readline();
var z = readline().split(" ").map((a)=>(+a));
var y = 0; for (var i = 0; i <z.length; i++){y+=z[i]}
print(y/x)

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

let input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
    const all = parseInt(input[0], 10)
    const percent = [...input.slice(1)]
    let all_percent = 0
    percent.forEach(el => {
        all_percent += parseInt(el, 10) / 100
    })
    let _result = (all_percent / all) * 100
    console.log(_result.toFixed(12))
})

counter = 0
x = parseInt(readline())
d = readline().split(" ")
for (i=0 ; i<x;i++){
  counter += parseInt(d[i])
}
print(counter/3)

var ingredientes = readline();
var porcentajes = readline().split(" ");
var suma_porcentajes = 0;

for (i=0;i<porcentajes.length;i++){
	suma_porcentajes=suma_porcentajes+porcentajes[i];
}

var total = suma_porcentajes/ingredientes;

print(total);

var ingredientes = readline();
var porcentajes = readline().split(" ");
var suma_porcentajes = 0;

for (i=0;i<porcentajes.length;i++){
	suma_porcentajes+=porcentajes[i];
}

var total = suma_porcentajes/ingredientes;

print(total);

var x ,arr=[];
arr=readline().split(' ');
x=parseInt(readline);
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=+arr[i];
}
ans=ans/100;
ans=(ans/x)*100;
print(ans);

var x ,arr=[];
x=Number(readline());
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}

print(ans/x);

var x ,arr=[];
arr=readline().split(' ');
x=readline;
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
ans=ans/100;
ans=(ans/x)*100;
print(ans);

var x ,arr=[];
arr=readline().split(' ');
x=parseInt(readline());
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
var absl=ans/100;
absl=(absl/x);
print(absl*100);

var x ,arr=[];
x=readline().split('');
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
ans=ans/100;
ans=ans/x;
print(ans*100);

var x ,arr=[];
arr=readline().split(' ');
x=readline().split('');
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
print(ans/x);

var x ,arr=[];
x=readline().split('');
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
print(ans/x);

var x;
var arr=readline().split(' ');
x=readline().split('');
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
print(ans/x);

var x= readline().split(' ').map(Number);
var n=readline();
var s = 0;
for(var i=0; i<n;i++){
    s += x[i];
}
print(s/n);

var n = readline();
var a = readline().split(' ');
var ans = 0;
for(i = 0; i < n; i++) ans += a[i];
print(ans / n);

var numberOfDrinks = readline();
var percentages = readline().split(' ');

var sum = percentages.map((acc, percentage) => {
    return acc + percentage;
}, 0);

print(sum > 0 ? sum/numberOfDrinks : sum);

var numberOfDrinks = readline();
var percentages = readline().split(' ');

var sum = percentages.reduce((acc, percentage) => {
    return acc + percentage;
}, 0);

print(sum > 0 ? sum/numberOfDrinks : sum);

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+Number(cur) ,0);
var answer = result/drinks.length;
print(answer)

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+cur ,0);
print(result/drinks.length)

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+(+cur) ,0);
print(result/drinks.length)

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+cur ,0);
var answer = result/drinks.length;
print(answer)

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+cur ,0);
var answer = result/drinks.length;
print("Here", drinks, "   ", result, "   ", answer);
print(answer)

var o = readline();
var d = [0, 25, 50, 75];
var h = [];
for (i = 0; i <= d.length - 1; i++) {
    h.push(d[i] / 100);
}
function all(total, num) {
    return total + num;
}
var out =  (h.reduce(all) / o ) * 100;
print(out);