Let's say you are standing on the $$$XY$$$-plane at point $$$(0, 0)$$$ and you want to reach point $$$(n, n)$$$.You can move only in two directions:   to the right, i. e. horizontally and in the direction that increase your $$$x$$$ coordinate,  or up, i. e. vertically and in the direction that increase your $$$y$$$ coordinate. In other words, your path will have the following structure:   initially, you choose to go to the right or up;  then you go some positive integer distance in the chosen direction (distances can be chosen independently);  after that you change your direction (from right to up, or from up to right) and repeat the process. You don't like to change your direction too much, so you will make no more than $$$n - 1$$$ direction changes.As a result, your path will be a polygonal chain from $$$(0, 0)$$$ to $$$(n, n)$$$, consisting of at most $$$n$$$ line segments where each segment has positive integer length and vertical and horizontal segments alternate.Not all paths are equal. You have $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ where $$$c_i$$$ is the cost of the $$$i$$$-th segment.Using these costs we can define the cost of the path as the sum of lengths of the segments of this path multiplied by their cost, i. e. if the path consists of $$$k$$$ segments ($$$k \le n$$$), then the cost of the path is equal to $$$\sum\limits_{i=1}^{k}{c_i \cdot length_i}$$$ (segments are numbered from $$$1$$$ to $$$k$$$ in the order they are in the path).Find the path of the minimum cost and print its cost.

The first line contains the single integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. The first line of each test case contains the single integer $$$n$$$ ($$$2 \le n \le 10^5$$$). The second line of each test case contains $$$n$$$ integers $$$c_1, c_2, \dots, c_n$$$ ($$$1 \le c_i \le 10^9$$$) — the costs of each segment. It's guaranteed that the total sum of $$$n$$$ doesn't exceed $$$10^5$$$.

For each test case, print the minimum possible cost of the path from $$$(0, 0)$$$ to $$$(n, n)$$$ consisting of at most $$$n$$$ alternating segments.

NoteIn the first test case, to reach $$$(2, 2)$$$ you need to make at least one turn, so your path will consist of exactly $$$2$$$ segments: one horizontal of length $$$2$$$ and one vertical of length $$$2$$$. The cost of the path will be equal to $$$2 \cdot c_1 + 2 \cdot c_2 = 26 + 176 = 202$$$.In the second test case, one of the optimal paths consists of $$$3$$$ segments: the first segment of length $$$1$$$, the second segment of length $$$3$$$ and the third segment of length $$$2$$$.The cost of the path is $$$1 \cdot 2 + 3 \cdot 3 + 2 \cdot 1 = 13$$$.In the third test case, one of the optimal paths consists of $$$4$$$ segments: the first segment of length $$$1$$$, the second one — $$$1$$$, the third one — $$$4$$$, the fourth one — $$$4$$$. The cost of the path is $$$1 \cdot 4 + 1 \cdot 3 + 4 \cdot 2 + 4 \cdot 1 = 19$$$.

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

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

const INF = 2e14;

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

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

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

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

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

			sm += c[l];

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

		console.log(ans);
	}
}

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

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

const INF = 1e20 + 1;

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

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

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

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

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

			sm += c[l];

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

		console.log(ans);
	}
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

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

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

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

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

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

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

  });
}

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

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

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

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

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

    return res;
}

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

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

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

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

const INF = 1e14 + 1;

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

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

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

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

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

			sm += c[l];

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

		console.log(ans);
	}
}

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

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

const INF = 1e9+1;

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

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

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

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

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

			sm += c[l];

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

		console.log(ans);
	}
}

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

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

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

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

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

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

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

    return res;
}

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

    res -= min;

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

    return res;
}

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

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

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

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

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

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

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

    return res;
}

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

    res -= min;

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

    return res;
}


You are both a shop keeper and a shop assistant at a small nearby shop. You have $$$n$$$ goods, the $$$i$$$-th good costs $$$a_i$$$ coins.You got tired of remembering the price of each product when customers ask for it, thus you decided to simplify your life. More precisely you decided to set the same price for all $$$n$$$ goods you have.However, you don't want to lose any money so you want to choose the price in such a way that the sum of new prices is not less than the sum of the initial prices. It means that if you sell all $$$n$$$ goods for the new price, you will receive at least the same (or greater) amount of money as if you sell them for their initial prices.On the other hand, you don't want to lose customers because of big prices so among all prices you can choose you need to choose the minimum one.So you need to find the minimum possible equal price of all $$$n$$$ goods so if you sell them for this price, you will receive at least the same (or greater) amount of money as if you sell them for their initial prices.You have to answer $$$q$$$ independent queries.

The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains one integer $$$n$$$ ($$$1 \le n \le 100)$$$ — the number of goods. The second line of the query contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^7$$$), where $$$a_i$$$ is the price of the $$$i$$$-th good.

For each query, print the answer for it — the minimum possible equal price of all $$$n$$$ goods so if you sell them for this price, you will receive at least the same (or greater) amount of money as if you sell them for their initial prices.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  c++;
});

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

});

const input = [];

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

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

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

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

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

});

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

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

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

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

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

'use strict'

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

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

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

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

}

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

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

var queriesCount = parseInt(readline());

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

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

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

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

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

//var input = readline()

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

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

//

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

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

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

res.forEach(print)

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

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

var queriesCount = parseInt(readline());

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

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

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

var queriesCount = parseInt(readline());

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

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

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

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


You are given an array $$$a_1, a_2, \ldots, a_n$$$.In one operation you can choose two elements $$$a_i$$$ and $$$a_j$$$ ($$$i \ne j$$$) and decrease each of them by one.You need to check whether it is possible to make all the elements equal to zero or not.

The first line contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the size of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array.

Print "YES" if it is possible to make all elements zero, otherwise print "NO".

NoteIn the first example, you can make all elements equal to zero in $$$3$$$ operations:   Decrease $$$a_1$$$ and $$$a_2$$$,  Decrease $$$a_3$$$ and $$$a_4$$$,  Decrease $$$a_3$$$ and $$$a_4$$$ In the second example, one can show that it is impossible to make all elements equal to zero.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions:  The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct.  No two neighbouring letters of a string coincide; that is, if we represent a string as s = s1s2... sn, then the following inequality holds, si ≠ si + 1(1 ≤ i < n).  Among all strings that meet points 1 and 2, the required string is lexicographically smallest. Help him find such string or state that such string doesn't exist.String x = x1x2... xp is lexicographically less than string y = y1y2... yq, if either p < q and x1 = y1, x2 = y2, ... , xp = yp, or there is such number r (r < p, r < q), that x1 = y1, x2 = y2, ... , xr = yr and xr + 1 < yr + 1. The characters of the strings are compared by their ASCII codes.

A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters.

In a single line print the required string. If there isn't such string, print "-1" (without the quotes).

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

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

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

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

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

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

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

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

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

main();

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

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

	var str = 'a';

	var l = n - k + 2;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

main();

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

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

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

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

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

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

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

	var str = 'a';

	var l = n - k + 2;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volume v (1 ≤ v ≤ ai; v is an integer) both on the piano and the guitar. They should retain harmony, so the total volume with which the i-th note was played on the guitar and the piano must equal bi. If Dima and Inna cannot play a note by the described rules, they skip it and Sereja's joy drops by 1. But if Inna and Dima play the i-th note at volumes xi and yi (xi + yi = bi) correspondingly, Sereja's joy rises by xi·yi. Sereja has just returned home from the university and his current joy is 0. Help Dima and Inna play the song so as to maximize Sereja's total joy after listening to the whole song!

The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).

In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.

NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. Sereja's total joy equals -1.

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

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

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

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

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

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

main();

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

let n, lp = 0, a, b;

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

});

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

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

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

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

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

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

main();

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

let n, lp = 0, a, b;

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

});

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

let n, lp = 0, a, b;

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

});

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

let n, lp = 0, a, b;

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

});


Let's define the cost of a string $$$s$$$ as the number of index pairs $$$i$$$ and $$$j$$$ ($$$1 \le i < j < |s|$$$) such that $$$s_i = s_j$$$ and $$$s_{i+1} = s_{j+1}$$$.You are given two positive integers $$$n$$$ and $$$k$$$. Among all strings with length $$$n$$$ that contain only the first $$$k$$$ characters of the Latin alphabet, find a string with minimum possible cost. If there are multiple such strings with minimum cost — find any of them.

The only line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 26$$$).

Print the string $$$s$$$ such that it consists of $$$n$$$ characters, each its character is one of the $$$k$$$ first Latin letters, and it has the minimum possible cost among all these strings. If there are multiple such strings — print any of them.

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

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

'use strict';

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

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

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

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

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

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

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

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

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

	console.log(ans);
}

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

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

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

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

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

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

	console.log(ans);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

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

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

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

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

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

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

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

'use strict';

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

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

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

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

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

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

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

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