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

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var k = nextInt();
		var s = next();
		var p = [];
		var output = "";
		for(var i = 0; i < k; i++){
			if(s[i] == "1" || s[i] == "4" || s[i] == "6" || s[i] == "8" || s[i] == "9"){
				output = "1\n" + s[i];
				break;
			}else if(p.indexOf(s[i]) != -1){
				output = "2\n" + s[i] + s[i];
			}else{
				p.push(s[i]);
			}
		}

		if(output == ""){
			for(var i = 0; i < (1 << p.length); i++){
				var v = 0;
				for(var j = 0; j < p.length; j++){
					if((i & (1 << j)) != 0){
						v *= 10;
						v += myconv(p[j], 1);
					}
				}
				if(v >= 10 && !isPrime(v)){
					output = "2\n" + v;
					break;
				}
			}
		}
		myout(output);
	}
}
function isPrime(val){
	if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
		return false;
	}else if(val == 2){
		return true;
	}
	var root = Math.floor(Math.sqrt(val));
	for(var i = 3; i <= root; i += 2){
		if(val % i == 0){
			return false;
		}
	}
	return true;
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const MAX = 100;
const prime = Array.from({ length: MAX }).fill(true);
const nonprime = [];
function sieve() {
    nonprime.push('1'); // neither prime nor composite
    prime[0] = prime[1] = false;
    for (let i = 2; i < MAX; i++) {
        if (prime[i]) {
            for (let j = i; i * j < MAX; j++) {
                prime[i * j] = false;
            }
        }
        else {
            let j = i;
            let t = [];
            while (j > 0) {
                t.push(String(j % 10));
                j = Math.trunc(j / 10);
            }
            t.reverse();
            nonprime.push(t.join(''));
        }
    }
}
function solve(n, s) {
    for (let t of nonprime) {
        let ok = true;
        let from = 0;
        for (let i = 0; i < t.length; i++) {
            let nl = s.indexOf(t[i], from);
            if (nl == INIT) {
                ok = false;
                break;
            }
            from = nl + 1;
        }
        // printf("s %s t %s ok %d\n", s, t, ok);
        if (ok) {
            printf("%d\n%s\n", t.length, t);
            return;
        }
    }
}
function main() {
    sieve();
    // for (let x of nonprime) {
    //   printf("x %d\n", x);
    // }
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        solve(n, s);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const MAX = 1000;
const prime = Array.from({ length: MAX }).fill(true);
const nonprime = [];
function sieve() {
    nonprime.push('1'); // neither prime nor composite
    prime[0] = prime[1] = false;
    for (let i = 2; i < MAX; i++) {
        if (prime[i]) {
            for (let j = i; i * j < MAX; j++) {
                prime[i * j] = false;
            }
        }
        else {
            let j = i;
            let t = [];
            while (j > 0) {
                t.push(String(j % 10));
                j = Math.trunc(j / 10);
            }
            t.reverse();
            nonprime.push(t.join(''));
        }
    }
}
function solve(n, s) {
    for (let t of nonprime) {
        let ok = true;
        let from = 0;
        for (let i = 0; i < t.length; i++) {
            let nl = s.indexOf(t[i], from);
            if (nl == INIT) {
                ok = false;
                break;
            }
            from = nl + 1;
        }
        // printf("s %s t %s ok %d\n", s, t, ok);
        if (ok) {
            printf("%d\n%s\n", t.length, t);
            return;
        }
    }
}
function main() {
    sieve();
    // for (let x of nonprime) {
    //   printf("x %d\n", x);
    // }
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        solve(n, s);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const MAX = 1000;
const prime = Array.from({ length: MAX }).fill(true);
const comp = [];
function sieve() {
    prime[0] = prime[1] = false;
    for (let i = 2; i < MAX; i++) {
        if (prime[i]) {
            for (let j = i; i * j < MAX; j++) {
                prime[i * j] = false;
            }
        }
        else {
            let j = i;
            let t = [];
            while (j > 0) {
                t.push(String(j % 10));
                j = Math.trunc(j / 10);
            }
            t.reverse();
            comp.push(t.join(''));
        }
    }
}
function solve(n, s) {
    const has = af(10).fill(INIT);
    for (let i = 0; i < n; i++) {
        let d = s.charCodeAt(i) - '0'.charCodeAt(0);
        if (has[d] == INIT) {
            has[d] = i;
        }
    }
    const singles = [1, 4, 6, 8, 9];
    for (let d of singles) {
        if (has[d] != INIT) {
            printf("1\n%d\n", d);
            return;
        }
    }
    for (let t of comp) {
        let ok = true;
        let from = 0;
        for (let i = 0; i < t.length; i++) {
            let nl = s.indexOf(t[i], from);
            if (nl == INIT) {
                ok = false;
                break;
            }
            from = nl + 1;
        }
        // printf("s %s t %s ok %d\n", s, t, ok);
        if (ok) {
            printf("%d\n%s\n", t.length, t);
            return;
        }
    }
}
function main() {
    sieve();
    // for (let x of comp) {
    //   printf("x %d\n", x);
    // }
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        solve(n, s);
    }
}

"use strict";
const { checkPrime } = require("crypto");
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const prime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split("")
      .map((cur) => parseInt(cur));
    let obj = { 2: 1, 3: 1, 5: 1, 7: 1 },
      flag = 0;
    for (let i = 0; i < n; i++) {
      if (!obj[arr[i]]) {
        flag = 1;
        console.log(1);
        console.log(arr[i]);
        break;
      }
    }
    if (flag === 1) continue;
    for (let i = 0; i < n; i++) {
      let r = arr[i] + "";
      for (let j = i + 1; j < n; j++) {
        let k = r + arr[j];
        if (!prime(parseInt(k))) {
          console.log(k.length);
          console.log(k);
          flag = 1;
          break;
        }
      }
      if (flag === 1) break;
    }
    if (flag === 1) continue;
    console.log(arr.length);
    console.log(arr.join(""));
  }
};
solve();

'use strict'
var os = require('os')
function createInput(t) {
  const n = t.stdin || process.stdin,
    e = /-?\d+/g,
    r = /-?\d+(?:\.\d+)?/g
  let u = [],
    o = 0
  return {
    init: async function () {
      const t = []
      ;(u = await new Promise(e => {
        n.on('data', n => t.push(n)),
          n.on('end', function () {
            const n = t.join('').split(os.EOL)
            e(n)
          })
      })),
        (o = 0)
    },
    dried: function () {
      return o >= u.length
    },
    readLine: c,
    readLineAsNumber: function () {
      return Number(c())
    },
    readIntegersOfLine: function () {
      const t = c().match(e)
      return null == t ? [] : t.map(t => Number(t))
    },
    readNumsOfLine: function () {
      const t = c().match(r)
      return null == t ? [] : t.map(t => Number(t))
    },
  }
  function c() {
    return u[o++]
  }
}
function createOutput(t) {
  const n = t.stdout || process.stdout,
    e = t.encoding || 'ascii',
    r = t.outputBufferThreshold || 1 << 24,
    u = Buffer.alloc(r)
  let o = 0
  return {
    flush: c,
    print: function (t) {
      i('string' == typeof t ? t : t.toString())
    },
    println: function (t) {
      i(('string' == typeof t ? t : t.toString()).concat('\n'))
    },
  }
  function c() {
    n.write(u.toString(e, 0, o)), (o = 0)
  }
  function i(t) {
    const i = Buffer.byteLength(t, e)
    r - o < i && (c(), i >= r) ? n.write(t) : (u.write(t, o, e), (o += i))
  }
}
function createInputAndOutput(t) {
  return {
    ...createInput({ stdin: t.stdin, encoding: t.encoding }),
    ...createOutput({
      stdout: t.stdout,
      encoding: t.encoding,
      outputBufferThreshold: t.outputBufferThreshold,
    }),
  }
}
async function __main__(t, n, e = {}) {
  const r = createInputAndOutput(e)
  await Promise.all([r.init(), Promise.resolve(n && n())]),
    await t(r),
    r.flush()
}
__main__(function (t) {
  const n = t.readLineAsNumber()
  for (let r = 1; r <= n; ++r) {
    const n = e(t.readLineAsNumber(), t.readLine().trim())
    t.println(n.length), t.println(n)
  }
  function e(t, n) {
    for (let e = 0; e < t; ++e) {
      const t = n[e]
      if ('1' === t || '4' === t || '6' === t || '8' === t || '9' === t)
        return t
    }
    const e = [],
      r = [],
      u = new Array(10).fill(!1)
    for (let o = 0; o < t; ++o) {
      const t = n[o],
        c = Number(t)
      if (o > 0) {
        if (2 === c || 5 === c) return n.slice(o - 1, o + 1)
        if (u[c]) return t.concat(t)
      }
      switch (((u[c] = !0), c % 3)) {
        case 1:
          if (r.length > 0) {
            const [e] = r
            return n[e].concat(t)
          }
          e.push(o)
          break
        case 2:
          if (e.length > 0) {
            const [r] = e
            return n[r].concat(t)
          }
          r.push(o)
      }
    }
    for (let u = 0; u < t; ++u) {
      switch (Number(n[u]) % 3) {
        case 1:
          if ((e.push(u), 3 === e.length)) {
            const [t, r, u] = e
            return n[t].concat(n[r]).concat(n[u])
          }
          break
        case 2:
          if ((r.push(u), 3 === r.length)) {
            const [t, e, u] = r
            return n[t].concat(n[e]).concat(n[u])
          }
      }
    }
    return ''
  }
})

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var m=0;m<k;m++){
        for(var j=m+1;j<k;j++){
            var number=(n[m]-'0')*10+(n[j]-'0')
            if(!prime.includes(number)){
                print('2');
                print(n[m]+n[j]);
                return;
            }
        }
    }
}

}

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

let edge = true;
let k;

rl.on('line', function(line){
   if(edge) {
     edge = false;
     return;
   }

   if(line.length === 0) {
     return;
   }

   if(!k) {
     k = parseInt(line);
     return;
   }

   const nonPrimeDigit = getNonPrimeDigit(line);
   if(nonPrimeDigit) {
    printAnswer(nonPrimeDigit)

     return;
   }

   const repeated = findRepeatedDigit(line);
   if(repeated) {
     printAnswer(repeated)
     return;
   }

   const twoAndFive = getDivisibleAlways(line);
   if(twoAndFive) {
    printAnswer(twoAndFive)
    return;
  }

  const _27 = findPattern(line, "27")
  if(_27) {
    printAnswer(_27)
    return;
  }

  const _57 = findPattern(line, "57")
  if(_57) {
    printAnswer(_57)
    return;
  }

  console.log(".")

  k = undefined;
})

function printAnswer(ans) {
  console.log(ans.length)
  console.log(ans)
  k = undefined
}

function getNonPrimeDigit(num) {
  for(let i = 0; i < num.length; i++) {
    if(num[i] === "1" || num[i] === "4" || num[i] === "6" || num[i] === "8" || num[i] === "9") {
      return num[i]
    }
  }

  return undefined;
}

function findRepeatedDigit(num) {
  const found = [false, false, false, false, false, false, false, false, false, false];
  for(let i = 0; i < num.length; i++) {
    const index = parseInt(num[i]);
    if(found[index]) {
      return num[i] + num[i];
    }

    found[index] = true;
  }

  return undefined;
}

function getDivisibleAlways(num) {
  for(let i = 1; i < num.length; i++) {
    if(num[i] === "2" || num[i] === "5") {
      return num[i - 1] + num[i];
    }
  }

  return undefined;
}

function findPattern(num, pattern) {
  let indexPattern = 0
  for(let i = 0; i < num.length; i++) {
    if(num[i] === pattern[indexPattern]) {
      indexPattern++
    }

    if(indexPattern === pattern.length) {
      return pattern
    }
  }

  return undefined
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const ZERO = '0'.charCodeAt(0);
function solve(n, s) {
    const has = af(10).fill(0);
    for (let i = 0; i < n; i++) {
        let d = s.charCodeAt(i) - ZERO;
        has[d]++;
    }
    //  printf("s %s\nhas %j\n", s, has);
    // case I
    const singles = [1, 4, 6, 8, 9];
    for (let d of singles) {
        if (has[d] > 0) {
            return String(d);
        }
    }
    // case II
    for (let i = 1; i <= 9; i++) {
        if (has[i] > 1) {
            return String([i, i].join(''));
        }
    }
    // case III
    let twopos = s.indexOf('2');
    if (twopos > 0) {
        return s.substring(twopos - 1, twopos + 1);
    }
    let fivepos = s.indexOf('5');
    if (fivepos > 0) {
        return s.substring(fivepos - 1, fivepos + 1);
    }
    // case IV
    for (let i = 0; i < n; i++) {
        for (let j = i + 1; j < n; j++) {
            let x = s.charCodeAt(i) - ZERO;
            let y = s.charCodeAt(j) - ZERO;
            if ((x + y) % 3 == 0) {
                return String([x, y].join(''));
            }
        }
    }
    printf("failed on %s\n", s);
    check(false);
    return 'XXX'; // not reached
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        let ans = solve(n, s);
        printf("%d\n", ans.length);
        printf("%s\n", ans);
    }
}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();
    print(prime);
    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var m=0;m<k-1;m++){
        for(var j=m+1;j<k;j++){
            var number=(n[m]-'0')*10+(n[j]-'0')
            if(!prime.includes(number)){
                print('2');
                print(n[m]+n[j]);
                return;
            }
        }
    }
}

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();
    print(prime);
    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var m=0;m<k-1;m++){
        for(var j=m+1;j<k;j++){
            var number=(n[m]-'0')*10+(n[j]-'0')
            if(!prime.includes(number)){
                print('2');
                print(n[m]+''+n[j]);
                return;
            }
        }
    }
}

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();
    print(prime);
    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var m=0;m<k-1;m++){
        for(var j=m+1;j<k;j++){
            print((n[m]-'0')*10+(n[j]-'0'));
            var number=(n[m]-'0')*10+(n[j]-'0')
            if(!prime.includes(number)){
                print('2');
                print(n[m]+''+n[j]);
                return;
            }
        }
    }
}

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {
 var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j===0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+''+n[j]);
                return;
            }
        }
    }
}

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+''+n[j]);
                return;
            }
        }
    }
}

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+n[j]);
                return;
            }
        }
    }
}

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

function main() {

  var prime=[];
for(var i=2;i<542;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    solution(k,n);

}

function solution(k,n){
    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+n[j]);
                return;
            }
        }
    }
}

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************

 var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

function main() {

var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+n[j]);
                return;
            }
        }
    }

}

}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ************************ Code Start ***************************
var prime=[];
for(var i=2;i<100;i++){
    var primeTrue=true
    for(var j=2;j<=Math.sqrt(i);j++){
        if(i%j==0){
            primeTrue=false;
        }
    }
    if(primeTrue){
        prime.push(i);
    }
}

function main() {

 var t=parseInt(readline());

while(t--){
    var k=parseInt(readline());
    var n=readline();

    for(var i=0;i<k;i++){
        if(n[i]=='1' || n[i]=='4'||n[i]=='6' ||n[i]=='8' || n[i]=='9'){
            print('1');
            print(n[i]);
            return 0;
        }
    }

    for(var i=0;i<k;i++){
        for(var j=i+1;j<k;j++){
            if(!prime[(n[i]-'0')*10+(n[j]-'0')]){
                print('2');
                print(n[i]+n[j]);
                return 0;
            }
        }
    }

}

}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const ZERO = '0'.charCodeAt(0);
function solve(n, s) {
    const has = af(10).fill(0);
    for (let i = 0; i < n; i++) {
        let d = s.charCodeAt(i) - ZERO;
        has[d]++;
    }
    printf("s %s\nhas %j\n", s, has);
    // case I
    const singles = [1, 4, 6, 8, 9];
    for (let d of singles) {
        if (has[d] > 0) {
            return String(d);
        }
    }
    // case II
    for (let i = 1; i <= 9; i++) {
        if (has[i] > 1) {
            return String([i, i].join(''));
        }
    }
    // case III
    let twopos = s.indexOf('2');
    if (twopos > 0) {
        return s.substring(twopos - 1, twopos + 1);
    }
    let fivepos = s.indexOf('5');
    if (fivepos > 0) {
        printf("fivepos %d\n", fivepos);
        return s.substring(fivepos - 1, fivepos + 1);
    }
    // case IV
    for (let i = 0; i < n; i++) {
        for (let j = i + 1; j < n; j++) {
            let x = s.charCodeAt(i) - ZERO;
            let y = s.charCodeAt(j) - ZERO;
            if ((x + y) % 3 == 0) {
                return String([x, y].join(''));
            }
        }
    }
    printf("failed on %s\n", s);
    check(false);
    return 'XXX'; // not reached
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        let ans = solve(n, s);
        printf("%d\n", ans.length);
        printf("%s\n", ans);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const ZERO = '0'.charCodeAt(0);
function solve(n, s) {
    const has = af(10).fill(0);
    for (let i = 0; i < n; i++) {
        let d = s.charCodeAt(i) - ZERO;
        has[d]++;
    }
    //  printf("s %s\nhas %j\n", s, has);
    // case I
    const singles = [1, 4, 6, 8, 9];
    for (let d of singles) {
        if (has[d] > 0) {
            return String(d);
        }
    }
    // case II
    let twopos = s.indexOf('2');
    if (twopos > 0) {
        return s.substring(twopos - 1, 2);
    }
    let fivepos = s.indexOf('5');
    if (fivepos > 0) {
        return s.substring(fivepos - 1, 2);
    }
    // case II
    for (let i = 0; i <= 9; i++) {
        if (has[i] > 1) {
            return String([i, i].join(''));
        }
    }
    // case IV
    for (let i = 0; i < n; i++) {
        for (let j = i + 1; j < n; j++) {
            let x = s.charCodeAt(i) - ZERO;
            let y = s.charCodeAt(j) - ZERO;
            if ((x + y) % 3 == 0) {
                return String([x, y].join(''));
            }
        }
    }
    printf("failed on %s\n", s);
    check(false);
    return 'XXX'; // not reached
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        let ans = solve(n, s);
        printf("%d\n", ans.length);
        printf("%s\n", ans);
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
const MAX = 1000;
const prime = Array.from({ length: MAX }).fill(true);
const comp = [];
function sieve() {
    prime[0] = prime[1] = false;
    for (let i = 2; i < MAX; i++) {
        if (prime[i]) {
            for (let j = i; i * j < MAX; j++) {
                prime[i * j] = false;
            }
        }
        else {
            let j = i;
            let t = [];
            while (j > 0) {
                t.push(String(j % 10));
                j = Math.trunc(j / 10);
            }
            t.reverse();
            comp.push(t.join(''));
        }
    }
}
function solve(n, s) {
    for (let t of comp) {
        let ok = true;
        let from = 0;
        for (let i = 0; i < t.length; i++) {
            let nl = s.indexOf(t[i], from);
            if (nl == INIT) {
                ok = false;
                break;
            }
            from = nl + 1;
        }
        // printf("s %s t %s ok %d\n", s, t, ok);
        if (ok) {
            printf("%d\n%s\n", t.length, t);
            return;
        }
    }
}
function main() {
    sieve();
    // for (let x of comp) {
    //   printf("x %d\n", x);
    // }
    let tc = nextInt();
    while (tc-- > 0) {
        let n = nextInt();
        let s = nextStr();
        solve(n, s);
    }
}

"use strict";
const { checkPrime } = require("crypto");
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const prime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split("")
      .map((cur) => parseInt(cur));
    let obj = { 2: 1, 3: 1, 5: 1, 7: 1 },
      flag = 0;
    for (let i = 0; i < n; i++) {
      if (!obj[arr[i]]) {
        flag = 1;
        console.log(1);
        console.log(arr[i]);
        break;
      }
    }
    if (flag === 1) continue;
    arr.sort((a, b) => a - b);
    for (let i = 0; i < n; i++) {
      let r = arr[i] + "";
      for (let j = i + 1; j < n; j++) {
        let k = r + arr[j];
        if (!prime(parseInt(k))) {
          console.log(k.length);
          console.log(k);
          flag = 1;
        }
      }
      if (flag === 1) break;
    }
  }
};
solve();

"use strict";
const { checkPrime } = require("crypto");
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const prime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split("")
      .map((cur) => parseInt(cur));
    let obj = { 2: 1, 3: 1, 5: 1, 7: 1 },
      flag = 0;
    for (let i = 0; i < n; i++) {
      if (!obj[arr[i]]) {
        flag = 1;
        console.log(1);
        console.log(arr[i]);
        break;
      }
    }
    if (flag === 1) continue;
    let r = "";
    for (let i = 0; i < n; i++) {
      r += arr[i];
      for (let j = i + 1; j < n; j++) {
        let k = r + arr[j];
        if (!prime(parseInt(k))) {
          console.log(k.length);
          console.log(k);
          flag = 1;
          break;
        }
      }
      if (flag === 1) break;
    }
    if (flag === 1) continue;
    console.log(arr.length);
    console.log(arr.join(""));
  }
};
solve();

"use strict";
const { checkPrime } = require("crypto");
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const prime = (n) => {
    for (let i = 2; i * i <= n; i++) {
      if (n % i === 0) return false;
    }
    return true;
  };
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    let arr = readline()
      .trim()
      .split("")
      .map((cur) => parseInt(cur));
    let obj = { 2: 1, 3: 1, 5: 1, 7: 1 },
      flag = 0;
    for (let i = 0; i < n; i++) {
      if (!obj[arr[i]]) {
        flag = 1;
        console.log(1);
        console.log(arr[i]);
        break;
      }
    }
    if (flag === 1) continue;
    let r = arr[0] + "";
    for (let i = 1; i < n; i++) {
      r += arr[i];
      if (!prime(parseInt(r))) {
        console.log(r.length);
        console.log(r);
        flag = 1;
      }
    }
    if (flag === 1) continue;
    console.log(arr.length);
    console.log(arr.join(""));
  }
};
solve();

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

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var k = nextInt();
		var s = next();
		var p = [];
		var output = "";
		for(var i = 0; i < k; i++){
			if(s[i] == "1" || s[i] == "4" || s[i] == "6" || s[i] == "8" || s[i] == "9"){
				output = "1\n" + s[i];
				break;
			}else if(p.indexOf(s[i]) != -1){
				output = "2\n" + s[i] + s[i];
				break;
			}else{
				p.push(s[i]);
			}
		}
		if(output == ""){
			for(var i = 1; i < (1 << p.length); i++){
				var v = 0;
				for(var j = 0; j < p.length; j++){
					if((i & (1 << j)) != 0){
						v *= 10;
						v += myconv(p[j], 1);
					}
				}
				if(v >= 10 && !isPrime(v)){
					output = "2\n" + v;
					break;
				}
			}
		}
		myout(output);
	}
}
function isPrime(val){
	if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
		return false;
	}else if(val == 2){
		return true;
	}
	var root = Math.floor(Math.sqrt(val));
	for(var i = 3; i <= root; i += 2){
		if(val % i == 0){
			return false;
		}
	}
	return true;
}

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

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var k = nextInt();
		var s = next();
		var p = [];
		var output = "";
		for(var i = 0; i < k; i++){
			if(s[i] == "1" || s[i] == "4" || s[i] == "6" || s[i] == "8" || s[i] == "9"){
				output = "1\n" + s[i];
				break;
			}else if(p.indexOf(s[i]) != -1){
				output = "2\n" + s[i] + s[i];
				break;
			}else{
				p.push(myconv(s[i], 1));
			}
		}
		if(output == ""){
			for(var i = 1; i < (1 << p.length); i++){
				var v = 0;
				for(var j = 0; j < p.length; j++){
					if((i & (1 << j)) != 0){
						v *= 10;
						v += p[j];
					}
				}
				if(!isPrime(v)){
					output = "2\n" + v;
					break;
				}
			}
		}
		myout(output);
	}
}
function isPrime(val){
	if(val == null || val <= 1 || (val != 2 && val % 2 == 0)){
		return false;
	}else if(val == 2){
		return true;
	}
	var root = Math.floor(Math.sqrt(val));
	for(var i = 3; i <= root; i += 2){
		if(val % i == 0){
			return false;
		}
	}
	return true;
}

'use strict'
var os = require('os')
function createInput(n) {
  const t = n.stdin || process.stdin,
    e = /-?\d+/g,
    r = /-?\d+(?:\.\d+)?/g
  let u = [],
    i = 0
  return {
    init: async function () {
      const n = []
      ;(u = await new Promise(e => {
        t.on('data', t => n.push(t)),
          t.on('end', function () {
            const t = n.join('').split(os.EOL)
            e(t)
          })
      })),
        (i = 0)
    },
    dried: function () {
      return i >= u.length
    },
    readLine: o,
    readLineAsNumber: function () {
      return Number(o())
    },
    readIntegersOfLine: function () {
      const n = o().match(e)
      return null == n ? [] : n.map(n => Number(n))
    },
    readNumsOfLine: function () {
      const n = o().match(r)
      return null == n ? [] : n.map(n => Number(n))
    },
  }
  function o() {
    return u[i++]
  }
}
function createOutput(n) {
  const t = n.stdout || process.stdout,
    e = n.encoding || 'ascii',
    r = n.outputBufferThreshold || 1 << 24,
    u = Buffer.alloc(r)
  let i = 0
  return {
    flush: o,
    print: function (n) {
      s('string' == typeof n ? n : n.toString())
    },
    println: function (n) {
      s(('string' == typeof n ? n : n.toString()).concat('\n'))
    },
  }
  function o() {
    t.write(u.toString(e, 0, i)), (i = 0)
  }
  function s(n) {
    const s = Buffer.byteLength(n, e)
    r - i < s && (o(), s >= r) ? t.write(n) : (u.write(n, i, e), (i += s))
  }
}
function createInputAndOutput(n) {
  return {
    ...createInput({ stdin: n.stdin, encoding: n.encoding }),
    ...createOutput({
      stdout: n.stdout,
      encoding: n.encoding,
      outputBufferThreshold: n.outputBufferThreshold,
    }),
  }
}
async function __main__(n, t, e = {}) {
  const r = createInputAndOutput(e)
  await Promise.all([r.init(), Promise.resolve(t && t())]),
    await n(r),
    r.flush()
}
__main__(function (n) {
  const t = n.readLineAsNumber()
  for (let r = 1; r <= t; ++r) {
    const t = e(n.readLineAsNumber(), n.readLine().trim())
    n.println(t.length), n.println(t.join(''))
  }
  function e(n, t) {
    const e = new Array(10).fill(!1),
      r = [],
      u = []
    for (let i = 0; i < n; ++i) {
      const n = Number(t[i])
      if (1 === n || 4 === n || 6 === n || 8 === n || 9 === n) return [n]
      if (i > 0) {
        if (2 === n || 5 === n) return [Number(t[i - 1]), n]
        if (e[n]) return [n, n]
      }
      switch (((e[n] = !0), n % 3)) {
        case 1:
          if ((r.push(i), 3 === r.length)) {
            const [n, e, u] = r
            return [Number(t[n]), Number(t[e]), Number(t[u])]
          }
          if (u.length > 0) {
            const [e] = u
            return [Number(t[e]), n]
          }
          break
        case 2:
          if ((u.push(i), 3 === u.length)) {
            const [n, e, r] = u
            return [Number(t[n]), Number(t[e]), Number(t[r])]
          }
          if (r.length > 0) {
            const [e] = r
            return [Number(t[e]), n]
          }
      }
    }
    return []
  }
})


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;
  }

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

  const arr = d.split(" ").map(Number);
  const sum = arr.reduce((prev, curr) => prev + curr, 0);

  if (sum < arr.length) {
    console.log(1);
  } else {
    console.log(sum - arr.length);
  }
  c++;
});

rl.on("close", () => {});

'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 x = readline();
    // console.log(x);
    // var line2 = readline();
    // console.log(line2);
    // print(x);
    // print(line2);
 	let testCaseNum = readline();
	testCaseNum = +testCaseNum;

	while (testCaseNum > 0) {
		readline();

		let arr = readline().split(' ');
		let total = arr.reduce((total, item) => total + +item, 0);
		if (total == arr.length) {
			// return
			console.log(0);
		} else if (total < arr.length) {
			console.log(1);
		} else {
			console.log(total - arr.length);
		}

		testCaseNum --;
	}
}

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

var matr = 'haha';

function create(str) {
   var hahaIndexArr = [];
   for (var i = 0; i < str.length; i++) {
      var hasWrong = false;
      for (var j = 0; j < matr.length; j++) {
         if (str[i + j] !== matr[j]) {
            hasWrong = true;
            break;
         }
      }
      if (!hasWrong) {
         hahaIndexArr.push(i);
      }
   }
   if (hahaIndexArr.length === 0) {
      if (str.length < 8) {
         return [str, -1, str];
      }
      return [str.substr(0, 4), 0, str.substr(str.length - 4, 0)];
   }
   var preff = str.substr(0, Math.min(4, hahaIndexArr[0])) || 'ha';
   var suff = str.substr(Math.max(hahaIndexArr[hahaIndexArr.length - 1] + 4, str.length - 4)) || 'ha';
   return [preff, hahaIndexArr.length, suff];
}
function summ(a, b) {
   var createMiddle = create(a[2] + b[0]);
   if (a[1] === -1 && b[1] === -1) {
      return createMiddle;
   }
   var preff = a[1] === -1 ? createMiddle[0] : a[0];
   var suff = b[1] === -1 ? createMiddle[2] : b[2];
   var asum = a[1] === -1 ? 0 : a[1];
   var bsum = b[1] === -1 ? 0 : b[1];
   var midSum = createMiddle[1] === -1 ? 0 : createMiddle[1];
   return [preff, asum + bsum + midSum, suff];
}

function solve() {
   var n = Number(read());
   var arr = readArray(Number);
   var sum = 0;
   for (var i = 0; i < n; i++) {
      sum += arr[i];
   }
   if (n <= sum) {
      write(sum - n);
      return;
   }
   write(1);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

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

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

let solve = async () => {
    const nsc = parseInt(await getLine());
    for(let sc = 0; sc < nsc; sc++) {
        const n = parseInt(await getLine());
        const a = (await getLine()).split(' ').map(num => parseInt(num));
        const sum = a.reduce((acc, cur) => acc + cur, 0);
        if (sum == a.length){
            console.log(0);
        }
        else if (sum < a.length) {
            console.log(1);
        } else {
            console.log(sum - a.length);
        }
    }
}

solve();

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        var n = +lines[l++]
        var arr = lines[l++].split(' ').map(Number)
        console.log(solve(n, arr));
    }
});

function solve(n, arr) {
    const sum = arr.reduce((s, x) => s + x, 0)
    if (sum < n) {
        return 1
    } else if (sum > n) {
        return sum - n
    } else {
        return 0
    }
}

var cases = +readline();
const average = (array) => array.reduce((a, b) => a + b) / array.length;
for (var i = 1; i<=cases; i++){
    len = +readline();
    arr = readline().split(' ').map(x=>+x);
    sum = arr.reduce((a, b) => a + b);
    avg = sum / arr.length;

    if (avg < 1){
        print(1);
    } else if (avg == 1) {
        print(0);
    } else {
        print(sum-arr.length);
    }
}

var t = Number(readline());

while (t--) {
    var len = Number(readline());
    var arr = readline().split(" ");
    var sum = 0;

    for (var i = 0; i < len; i++) {
        arr[i] = Number(arr[i]);
        sum += Number(arr[i]);

    }

    if (sum <= 0 || sum - len < 0)
        print(1);
    else {
        print(sum - len);
    }
}

var t = +readline();

for (var q = 0; q < t; ++q) {
    var n = +readline();
    var a = readline().split(' ').map(ai => +ai);

    var sum = a.reduce((sum, ai) => sum + ai);

    if (sum >= n) {
        print(sum - n);
    } else {
        print(1);
    }
}

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

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

main()

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

const solve = (n, a) => {
    let sum = cnt = 0;
    for (const x of a) {
        if (x != 0) cnt++;
        sum += x;
    }
    if (sum <= n) return pr(1);
    // pr(sum, n)
    pr(abs(sum) - cnt);
};

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

main()

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

const solve = (n, a) => {
    let sum = sm(a);
    if (sum < 1) return pr(1);
    pr(abs(sum) - n);
};

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

main()

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

const solve = (n, a) => {
    let tmp = [];
    for (const x of a) {
        if (a != 0) tmp.push(x);
    }
    // pr(a);
    // pr(tmp)
    pr(cal(tmp));
};

const cal = (a) => {
    let n = a.length;
    let sum = sm(a);
    return abs(sum) - n;
};

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

main()

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

const solve = (n, a) => {
    let sum = sm(a);
    if (sum == 0) return pr(n);
    let fL = abs(sum);
    pr(fL - n);
};

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

main()

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

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

main()

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

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

main()

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

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

main()

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;
  }

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

  const arr = d.split(" ").map(Number);
  const sum = arr.reduce((prev, curr) => prev + curr, 0);

  if (sum === 0) {
    console.log(0);
  } else {
    if (sum < arr.length) {
      console.log(1);
    } else {
      console.log(sum - arr.length);
    }
  }
  c++;
});

rl.on("close", () => {});

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;
  }

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

  const arr = d.split(" ").map(Number);
  const sum = arr.reduce((prev, curr) => prev + curr, 0);

  if (sum < 0) {
    console.log(1);
  } else if (sum === 0) {
    console.log(0);
  } else if (sum - arr.length === 0) {
    console.log(0);
  } else {
    if (sum < arr.length) {
      console.log(1);
    } else {
      console.log(sum - arr.length);
    }
  }
  c++;
});

rl.on("close", () => {});

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;
  }

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

  const arr = d.split(" ").map(Number);
  const sum = arr.reduce((prev, curr) => prev + curr, 0);

  if (sum < 0) {
    console.log(1);
  } else if (sum === 0) {
    console.log(0);
  } else if (sum - arr.length === 0) {
    console.log(0);
  } else {
    console.log(Math.max(1, sum - arr.length));
  }
  c++;
});

rl.on("close", () => {});

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;
  }

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

  const arr = d.split(" ").map(Number);
  const sum = arr.reduce((prev, curr) => prev + curr, 0);

  if (sum < 0) {
    console.log(1);
  } else if (sum === 0) {
    console.log(0);
  } else {
    console.log(Math.max(0, sum - arr.length));
  }
  c++;
});

rl.on("close", () => {});

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;
  }

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

  const arr = d.split(" ").map(Number);
  const sum = arr.reduce((prev, curr) => prev + curr, 0);

  if (sum < 0) {
    console.log(1);
  } else if (sum === 0) {
    console.log(0);
  } else {
    console.log(Math.max(1, sum - arr.length));
  }
  c++;
});

rl.on("close", () => {});

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;
  }

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

  const arr = d.split(" ").map(Number);
  const sum = arr.reduce((prev, curr) => prev + curr, 0);

  if (sum < 0) {
    console.log(1);
  } else if (sum === 0) {
    console.log(0);
  } else {
    console.log(sum - arr.length);
  }
  c++;
});

rl.on("close", () => {});

var cases = +readline();
const average = (array) => array.reduce((a, b) => a + b) / array.length;
for (var i = 1; i<=cases; i++){
    len = +readline();
    arr = readline().split(' ').map(x=>+x);
    sum = arr.reduce((a, b) => a + b);
    avg = sum / arr.length;

    if (avg <= 1){
        print(1);
    } else if (avg == 1) {
        print(0);
    } else {
        print(sum-arr.length);
    }
}

var t = Number(readline());

while (t--) {
    var len = Number(readline());
    var arr = readline().split(" ");
    var sum = 0;

    for (var i = 0; i < len; i++) {
        arr[i] = Number(arr[i]);
        sum += Number(arr[i]);

    }

    if (sum <= 0)
        print(1);
    else {
        print(sum - len);
    }
}