package main

import (
	"bufio"
	"os"
	"fmt"
	"runtime"
	"sync"
	"math"
	"strconv"
)

var p []uint64

var mp map[int]bool

func main() {

	r := bufio.NewReader(os.Stdin)

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

	mp = make(map[int]bool)

	p = Primes(10000)
	for i := 0; i < len(p); i++ {
		mp[int(p[i])] = true
	}

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

		var s string
		fmt.Fscan(r, &s)

		f1, f2 := solve(k, s)
		fmt.Println(f1)
		fmt.Println(f2)
	}
}

func solve(k int, s string) (int, int) {

	for i := 0; i < len(s); i++ {
		d, _ := strconv.Atoi(string(s[i]))

		if _, ok := mp[d]; ok {
			continue
		}
		return 1, d
	}

	for i := 0; i < len(s); i++ {
		for j := i + 1; j < len(s); j++ {
			v := string(s[i]) + string(s[j])
			d, _ := strconv.Atoi(v)

			if _, ok := mp[d]; ok {
				continue
			}
			return 2, d

		}
	}

	for i := 0; i < len(s); i++ {
		for j := i + 1; j < len(s); j++ {
			for k := j + 1; k < len(s); k++ {
				v := string(s[i]) + string(s[j]) + string(k)
				d, _ := strconv.Atoi(v)

				if _, ok := mp[d]; ok {
					continue
				}
				return 3, d
			}
		}
	}
	return -1, -1
}

func fill(nums []bool, i uint64, max uint64) {
	a := 3 * i
	for a <= max {
		nums[a/2] = true
		a = a + 2*i
	}
}

func goFill(nums []bool, i uint64, max uint64, next chan bool) {
	fill(nums, i, max)
	<-next
}

// SieveOfEratosthenes returns a slice of all prime numbers equal or lower than max using Sieve Of Eratosthenes.
// This is without segmenting.
func SieveOfEratosthenes(n uint64) []uint64 {
	cores := runtime.NumCPU()
	next := make(chan bool, cores)

	var nums = make([]bool, n/2+1)
	m := uint64(math.Sqrt(float64(n)))

	for i := uint64(3); i <= m; i = i + 2 {
		if nums[i/2] == false {
			go goFill(nums, i, n, next)
			next <- true
		}
	}

	for i := 0; i < cores; i++ {
		next <- true
	}

	var ps []uint64
	if n >= 2 {
		ps = append(ps, 2)
	}
	for i := uint64(3); i <= n; i = i + 2 {
		if nums[i/2] == false {
			ps = append(ps, i)
		}
	}
	return ps
}

var csegPool sync.Pool

func fillSegments(n uint64, basePrimes []uint64, allPrimes *[]uint64, segSize uint64, segNum uint64, next chan bool, nextTurn []chan bool) {
	cseg := (csegPool.Get()).([]bool)
	for i := uint64(0); i < segSize; i++ {
		cseg[i] = false
	}
	for i := 0; i < len(basePrimes); i++ {
		jMax := segSize * (segNum + 1) / basePrimes[i]
		for j := (segSize * segNum) / basePrimes[i]; j < jMax; j++ {
			sn := (j + 1) * basePrimes[i]
			cseg[sn-segSize*segNum-1] = true
		}
	}

	// This waiting for turn is to avoid sorts at the end.
	// Sorts are much more expensive than this wait even for a
	// mostly sorted list.
	if segNum > 1 {
		<-nextTurn[segNum]
	}

	for i := uint64(0); i < segSize; i++ {
		if !cseg[i] && segSize*segNum+i+1 <= n {
			*allPrimes = append(*allPrimes, segSize*segNum+i+1)
		}
	}

	<-next
	if int(segNum)+1 < len(nextTurn) {
		nextTurn[segNum+1] <- true
	}

	csegPool.Put(cseg)
}

// Primes is using Segmented sieve. This method will reduce memory usae of Sieve of Eratosthenes considerably.
// besides memory allocation for Prime numbers slice, there is only O(sqrt(n)) extra memory required for the operation
// You can learn more about it in https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes.
func Primes(n uint64) (allPrimes []uint64) {
	if uint64(math.Log(float64(n))-1) == 0 {
		return SieveOfEratosthenes(n)
	}

	// There is a function pi(x) in math that will returns approximate number of prime numbers below n.
	allPrimes = make([]uint64, 0, n/uint64(math.Log(float64(n))-1))
	segSize := uint64(math.Sqrt(float64(n)))

	csegPool.New = func() interface{} {
		return make([]bool, segSize)
	}

	basePrimes := SieveOfEratosthenes(segSize)
	allPrimes = append(allPrimes, basePrimes...)

	cores := runtime.NumCPU()
	next := make(chan bool, cores)
	var nextTurn []chan bool
	nextTurn = make([]chan bool, n/segSize+1)
	for i := uint64(0); i < n/segSize+1; i++ {
		nextTurn[i] = make(chan bool)
	}
	for segNum := uint64(1); segNum <= n/segSize; segNum++ {
		go fillSegments(n, basePrimes, &allPrimes, segSize, segNum, next, nextTurn)
		next <- true
	}
	for i := 0; i < cores; i++ {
		next <- true
	}

	return allPrimes
}

package main

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

func sieve(isPrime []bool) {
	n := 10001

	for i := 0; i < n; i++ {
		isPrime[i] = true
	}
	for i := 2; i < n; i++ {
		if isPrime[i] {
			for j := i * i; j < n; j += i {
				isPrime[j] = false
			}
		}
	}
}

var best, bestNum int

func gen(s string, i int, num int, k int, isPrime []bool) {
	if k >= best {
		return
	}
	if !isPrime[num] {
		best, bestNum = k, num
		return
	}

	for j := i; j < len(s); j++ {
		gen(s, j+1, num*10+int(s[j]-'0'), k+1, isPrime)
	}
}

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

	var isPrime = make([]bool, 100001)
	sieve(isPrime)
	isPrime[1] = false

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

	for t := 0; t < T; t++ {
		var n int
		s := ""
		fmt.Fscanf(r, "%d\n", &n)
		fmt.Fscanf(r, "%s\n", &s)
		best = 5
		bestNum = 0

		gen(s, 0, 0, 0, isPrime)

		fmt.Println(best)
		fmt.Println(bestNum)
	}
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	notPrime := make([]bool, 15)
	notPrime[1] = true
	for i := 2; i < len(notPrime); i++ {
		if !notPrime[i] {
			for j := 2 * i; j < len(notPrime); j += i {
				notPrime[j] = true
			}
		}
	}
	table := map[int][]int{
		2 : []int{2, 5, 7},
		3 : []int{3, 5, 2},
		5 : []int{5, 2, 7},
		7 : []int{7, 5, 2},
	}
	var t int
	for Fscan(in, &t); t > 0; t-- {
		var k int
		var n string
		Fscan(in, &k, &n)

		solve := func() {
			for _, c := range n {
				if notPrime[int(c - '0')] {
					Fprintln(out, 1)
					Fprintln(out, string(c))
					return
				}
			}
			for i := 0; i < len(n); i++ {
				for j := i+1; j < len(n); j++ {
					for _, val := range table[int(n[i] - '0')] {
						if val == int(n[j] - '0') {
							Fprintln(out, 2)
							Fprint(out, string(n[i]), val, "\n")
							return
						}
					}
				}
			}
		}
		solve()
	}
}

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

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	notPrime := make([]bool, 1000005)
	notPrime[1] = true
	for i := 2; i < len(notPrime); i++ {
		if !notPrime[i] {
			for j := 2 * i; j < len(notPrime); j += i {
				notPrime[j] = true
			}
		}
	}
	table := map[int][]int{
		2 : []int{2, 5, 7},
		3 : []int{3, 5, 2},
		5 : []int{5, 2, 7},
		7 : []int{7, 5, 2},
	}
	var t int
	for Fscan(in, &t); t > 0; t-- {
		var k int
		var n string
		Fscan(in, &k, &n)

		solve := func() {
			for _, c := range n {
				if notPrime[int(c - '0')] {
					Fprintln(out, 1)
					Fprintln(out, string(c))
					return
				}
			}
			for i := 0; i < len(n); i++ {
				for j := i+1; j < len(n); j++ {
					for _, val := range table[int(n[i] - '0')] {
						if val == int(n[j] - '0') {
							Fprintln(out, 2)
							Fprint(out, string(n[i]), val, "\n")
							return
						}
					}
				}
			}
		}
		solve()
	}
}

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

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

// 00
package main

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

type Anything interface {
	int64 | float64 | int | string | float32 | byte
}

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

func print_two(f *bufio.Writer, n1 int, n2 int) {
	write(f, n1)
	write(f, "\n")
	write(f, n2)
	write(f, "\n")
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var k int
		var s string
		fmt.Fscan(reader, &k, &s)
		m := map[byte]bool{'1': true, '4': true, '6': true, '8': true, '9': true}
		found_two := false
		found_three := false
		found_five := false
		found_seven := false
		ok := false
		for i := 0; i < k; i++ {
			if m[s[i]] {
				ok = true
				print_two(f, 1, int(s[i]-'0'))
				break
			}
		}
		if !ok {

			for i := 0; i < k; i++ {
				if found_two {
					if s[i] == '5' {
						print_two(f, 2, 25)
						break
					}
					if s[i] == '2' {
						print_two(f, 2, 22)
						break
					}
					if s[i] == '7' {
						print_two(f, 2, 27)
						break
					}
				}
				if found_three {
					if s[i] == '2' {
						print_two(f, 2, 32)
						break
					}
					if s[i] == '3' {
						print_two(f, 2, 33)
						break
					}
					if s[i] == '5' {
						print_two(f, 2, 35)
						break
					}

				}
				if found_five {
					if s[i] == '2' {
						print_two(f, 2, 52)
						break
					}
					if s[i] == '5' {
						print_two(f, 2, 55)
						break
					}
					if s[i] == '7' {
						print_two(f, 2, 57)
						break
					}
				}
				if found_seven {
					if s[i] == '2' {
						print_two(f, 2, 72)
						break
					}
					if s[i] == '5' {
						print_two(f, 2, 75)
						break
					}
					if s[i] == '7' {
						print_two(f, 2, 77)
						break
					}
				}
				if s[i] == '2' {
					found_two = true
				}
				if s[i] == '3' {
					found_three = true
				}
				if s[i] == '5' {
					found_five = true
				}
				if s[i] == '7' {
					found_seven = true
				}
			}
		}
	}
}

package main

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

func IsPrime(n int) bool {
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return n != 1
}

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N := 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		n, s, found := 0, "", true
		fmt.Fscan(f, &n, &s)
		for j := 0; j < n; j++ {
			p, _ := strconv.Atoi(string(s[j]))
			if !IsPrime(p) {
				fmt.Fprintln(w, 1)
				fmt.Fprintln(w, p)
				found = false
				break
			}
		}
		if found {
			ok := false
			for j := 0; j < n; j++ {
				for k := j + 1; k < n; k++ {
					a, _ := strconv.Atoi(string(s[j]) + string(s[k]))
					if !IsPrime(a) {
						fmt.Fprintln(w, 2)
						fmt.Fprintln(w, a)
						ok = true
						break
					}
				}
				if ok {
					break
				}
			}
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a int
		var num string
		fmt.Scan(&a, &num)
		iszhi(num)
	}
}

func iszhi(n string) {
	t := n
	dd := []int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
		41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}
	arr := map[int]bool{}
	for _, v := range dd {
		arr[v] = true
	}
	str := []byte(t)
	//一位数的时候
	for _, v := range str {

		if !arr[int(v-'0')] {
			fmt.Println("1")
			fmt.Println(v - '0')
			return
		}
	}
	//两位数的时候

	// fmt.Println(str)
	for i := 0; i+1 < len(str); i++ {
		for j := i + 1; j < len(str); j++ {
			s := string(str[i]) + string(str[j])
			num, _ := strconv.Atoi(s)
			if !arr[num] {
				fmt.Println("2")
				fmt.Println(num)
				return
			}
		}
	}
}

package main

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

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

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

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

		}
		return m
	}
}

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

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

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

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

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

	return
}

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

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

	return num
}

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

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

func BITAND(x, y int64) int64 {
	var ans int64
	begin := x
	sec := y
	var count int64 = 1
	for 1 == 1 {
		if (begin%2)*(sec%2) == 1 {
			ans = ans + count
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}

		} else {
			count = count * 2
			begin = int64(begin / 2)
			sec = int64(sec / 2)
			if begin*sec == 0 {
				break
			}
		}
	}
	return ans
}

func Sum(n, m int) int {
	var ans int

	if n == 1 {
		return 0
	} else {
		for i := 2; i < n; i++ {
			ans = (ans + Sum(i, m)) % m
		}
		for j := 2; j < n+1; j++ {
			ans = (ans + Sum(n/j, m)) % m
		}
		return ans
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)
	for o := 0; o < t; o++ {
		var k int
		fmt.Fscan(input, &k)
		ARR := make([]int, 10)
		STRING := make([]byte, 0)
		fmt.Fscan(input, &STRING)

		for i := 0; i < k; i++ {
			q := int(STRING[i]) - 48
			ARR[q]++
		}
		if ARR[1] != 0 {
			fmt.Println(1)
			fmt.Println(1)
		} else {

			if ARR[4] != 0 {
				fmt.Println(1)
				fmt.Println(4)
			} else {
				if ARR[6] != 0 {
					fmt.Println(1)
					fmt.Println(6)
				} else {
					if ARR[8] != 0 {
						fmt.Println(1)
						fmt.Println(8)
					} else {
						if ARR[9] != 0 {
							fmt.Println(1)
							fmt.Println(9)
						} else {
							r := 0
							for i := 2; i < 8; i++ {
								if ARR[i] > 1 {
									e := 11 * i
									fmt.Println(2)
									fmt.Println(e)
									r = 1
									break

								}
							}
							if r == 0 {
								if k == 2 {
									fmt.Println(2)
									fmt.Println(string(STRING))
								} else {
									fmt.Println(2)
									if string(STRING[0]) == "2" {
										for i := 5; i < 8; {
											if ARR[i] != 0 {
												e := 20 + i
												fmt.Println(e)
												break
											}
											i = i + 2
										}
									}

									if string(STRING[0]) == "3" {
										for i := 2; i < 6; {
											if ARR[i] != 0 {
												e := 30 + i
												fmt.Println(e)
												break
											}
											i = i + 3
										}
									}

									if string(STRING[0]) == "5" {
										for i := 2; i < 8; {
											if ARR[i] != 0 {
												e := 50 + i
												fmt.Println(e)
												break
											}
											i = i + 5
										}
									}
									if string(STRING[0]) == "7" {
										for i := 2; i < 6; {
											if ARR[i] != 0 {
												e := 70 + i
												fmt.Println(e)
												break
											}
											i = i + 3
										}
									}

								}

							}

						}
					}
				}

			}
		}

	}
}

package main

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

func ScenesFromAMemory() {
	sc := bufio.NewScanner(os.Stdin)
	for tcs := ScanPosInt(sc); tcs > 0; tcs-- { // 1 <= tcs <= 1E3
		k := ScanPosInt(sc) // k  (1≤k≤50) the number of digits in the number.
		// positive integer n, which doesn't contain zeros in decimal notation (10^k−1≤n<10^k) (what's the point?)
		// It is guaranteed that it is always possible to remove less than k digits to make the number not prime.
		sc.Scan()
		nString := sc.Text()
		// max number of digits that can be removed to obtain a non-prime
		digits := make([]int, k)
		for i := range digits {
			digits[i] = int(nString[i] - '0')
		}
		for i := 1; i <= k; i++ {
			b := SubInts(digits, i, func(ds []int) bool {
				d := IntOfDigits(ds)
				if !IsPrime(d) {
					fmt.Println(i)
					fmt.Println(d)
					return true
				}
				return false
			})
			if b {
				break
			}
		}
	}
}

func main() {
	ScenesFromAMemory()
}

func ScanPosInt(scanner *bufio.Scanner) (n int) {
	scanner.Scan()
	buf := scanner.Bytes()
	for _, v := range buf {
		n = n*10 + int(v-'0')
	}
	return
}

func IsPrime(x int) bool {
	return big.NewInt(int64(x)).ProbablyPrime(0)
}

func IntOfDigits(d []int) int {
	result := 0
	pow := 1
	for i := len(d) - 1; i >= 0; i-- {
		result += d[i] * pow
		pow *= 10
	}
	return result
}

func SubInts(xs []int, n int, f func([]int) bool) bool {
	var subInts func(xs, ints []int, n int, f func([]int) bool) bool
	subInts = func(xs, ints []int, n int, f func([]int) bool) bool {
		if n == 0 {
			return f(ints)
		}
		for i := 0; i < len(xs); i++ {
			ints = append(ints, xs[i])
			b := subInts(xs[i+1:], ints, n-1, f)
			if b {
				return true // stop
			}
			ints = ints[:len(ints)-1]
		}
		return false
	}
	ints := make([]int, 0, len(xs))
	return subInts(xs, ints, n, f)
}

package main

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

type Scanner struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) *Scanner {
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	return &Scanner{scanner}
}

func (s *Scanner) Word() string {
	s.Scan()
	return s.Text()
}

func (s *Scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *Scanner) Int64() int64 {
	s.Scan()
	n, _ := strconv.ParseInt(s.Text(), 10, 64)
	return n
}

func (s *Scanner) Ints(count int) []int {
	ints := make([]int, count)
	for i := range ints {
		ints[i] = s.Int()
	}
	return ints
}

func (s *Scanner) Int64s(count int) []int64 {
	int64s := make([]int64, count)
	for i := range int64s {
		int64s[i] = s.Int64()
	}
	return int64s
}

func isPrime(num int) bool {
	if num < 2 {
		return true
	}

	for i := 2; int64(i) * int64(i) <= int64(num); i++ {
		if num % i == 0 {
			return false
		}
	}
	return true
}

func buildNum(mask int, b []byte) (int, int) {
	num := 0
	digits := 0

	for i := 0; i < len(b); i++ {
		if (mask & (1 << i)) > 0 {
			num = num * 10 + int(b[i] - '0')
			digits += 1
		}
	}
	return num, digits
}

func solve(w string) string {
	bw := []byte(w)
	count := make(map[byte]int)
	for _, ch := range bw {
		count[ch]++
	}

	if count['1'] > 0 {
		return "1"
	}
	if count['4'] > 0 {
		return "4"
	}
	if count['6'] > 0 {
		return "6"
	}
	if count['8'] > 0 {
		return "8"
	}
	if count['9'] > 0 {
		return "9"
	}
	if count['2'] > 1 {
		return "22"
	}
	if count['3'] > 1 {
		return "33"
	}
	if count['5'] > 1 {
		return "55"
	}
	if count['7'] > 1 {
		return "77"
	}
	if count['5'] > 0 && bw[0] != '5' {
		return string(bw[0]) + "5"
	}

	res := w
	for i := 1; i < (1 << len(bw)); i++ {
		num, digits := buildNum(i, bw)
		if !isPrime(num) && digits < len(res) {
			res = fmt.Sprintf("%v", num)
		}
	}
	return res
}

func main() {
	stdin := NewWordScanner(os.Stdin)
	tests := stdin.Int()

	for i := 0; i < tests; i++ {
		_, w := stdin.Int(), stdin.Word()
		res := solve(w)
		fmt.Println(len(res))
		fmt.Println(res)
	}
}

package main

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

func sieve(isPrime []bool) {
	n := len(isPrime)

	for i := 0; i < n; i++ {
		isPrime[i] = true
	}
	for i := 2; i < n; i++ {
		if isPrime[i] {
			for j := i * i; j < n; j += i {
				isPrime[j] = false
			}
		}
	}
}

var best, bestNum int

func gen(s string, i int, num int, k int, isPrime []bool) {
	if k >= best {
		return
	}
	if !isPrime[num] {
		best, bestNum = k, num
		return
	}

	for j := i; j < len(s); j++ {
		gen(s, j+1, num*10+int(s[j]-'0'), k+1, isPrime)
	}
}

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

	var isPrime = make([]bool, 100001)
	//sieve(isPrime)
	isPrime[1] = false

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

	for t := 0; t < T; t++ {
		var n int
		s := ""
		fmt.Fscanf(r, "%d\n", &n)
		fmt.Fscanf(r, "%s\n", &s)
		best = 5
		bestNum = 0

		gen(s, 0, 0, 0, isPrime)

		fmt.Println(best)
		fmt.Println(bestNum)
	}
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	notPrime := make([]bool, 1000005)
	notPrime[1] = true
	for i := 2; i < len(notPrime); i++ {
		if !notPrime[i] {
			for j := 2 * i; j < len(notPrime); j += i {
				notPrime[j] = true
			}
		}
	}
	table := map[int][]int{
		2 : []int{2, 5, 7},
		3 : []int{3, 5, 2},
		5 : []int{5, 2, 7},
		7 : []int{7, 5, 2},
	}
	var t int
	for Fscan(in, &t); t > 0; t-- {
		var k int
		var n string
		Fscan(in, &k, &n)

		solve := func() {
			for _, c := range n {
				if notPrime[int(c - '0')] {
					Fprintln(out, 1)
					Fprintln(out, string(c))
					return
				}
			}
			for i := 1; i < len(n); i++ {
				for _, val := range table[int(n[0] - '0')] {
					if val == int(n[i] - '0') {
						Fprintln(out, 2)
						Fprint(out, string(n[0]), val, "\n")
						return
					}
				}
			}
		}
		solve()
	}
}

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

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

package main

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

func run(r io.Reader, w io.Writer) {
	in := bufio.NewReader(r)
	out := bufio.NewWriter(w)
	defer out.Flush()

	notPrime := make([]bool, 1000005)
	notPrime[1] = true
	for i := 2; i < len(notPrime); i++ {
		if !notPrime[i] {
			for j := 2 * i; j < len(notPrime); j += i {
				notPrime[j] = true
			}
		}
	}
	table := map[int][]int{
		2 : []int{2, 5, 7},
		3 : []int{3, 5, 2},
		5 : []int{5, 2, 7},
		7 : []int{7, 5, 2},
	}
	var t int
	for Fscan(in, &t); t > 0; t-- {
		var k int
		var n string
		Fscan(in, &k, &n)

		solve := func() {
			for _, c := range n {
				if notPrime[int(c - '0')] {
					Fprintln(out, 1)
					Fprintln(out, string(c))
					return
				}
			}
			for i := 1; i < len(n); i++ {
				for _, val := range table[int(n[0] - '0')] {
					if val == int(n[i] - '0') {
						Fprintln(out, 2)
						Fprint(out, string(n[0]), val, "\n")
					}
				}
			}
		}
		solve()
	}
}

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

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

// 00
package main

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

type Anything interface {
	int64 | float64 | int | string | float32 | byte
}

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

func print_two(f *bufio.Writer, n1 int, n2 int) {
	write(f, n1)
	write(f, "\n")
	write(f, n2)
	write(f, "\n")
}

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	f := bufio.NewWriter(os.Stdout)
	defer f.Flush()
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var k int
		var s string
		fmt.Fscan(reader, &k, &s)
		m := map[byte]bool{'1': true, '4': true, '6': true, '8': true, '9': true}
		found_two := false
		found_three := false
		found_five := false
		found_seven := false
		for i := 0; i < k; i++ {
			if m[s[i]] {
				print_two(f, 1, int(s[i]-'0'))
				break
			}
			if found_two {
				if s[i] == '5' {
					print_two(f, 2, 25)
					break
				}
				if s[i] == '2' {
					print_two(f, 2, 22)
					break
				}
				if s[i] == '7' {
					print_two(f, 2, 27)
					break
				}
			}
			if found_three {
				if s[i] == '2' {
					print_two(f, 2, 32)
					break
				}
				if s[i] == '3' {
					print_two(f, 2, 33)
					break
				}
				if s[i] == '5' {
					print_two(f, 2, 35)
					break
				}

			}
			if found_five {
				if s[i] == '2' {
					print_two(f, 2, 52)
					break
				}
				if s[i] == '5' {
					print_two(f, 2, 55)
					break
				}
				if s[i] == '7' {
					print_two(f, 2, 57)
					break
				}
			}
			if found_seven {
				if s[i] == '2' {
					print_two(f, 2, 72)
					break
				}
				if s[i] == '5' {
					print_two(f, 2, 75)
					break
				}
				if s[i] == '7' {
					print_two(f, 2, 77)
					break
				}
			}
			if s[i] == '2' {
				found_two = true
			}
			if s[i] == '3' {
				found_three = true
			}
			if s[i] == '5' {
				found_five = true
			}
			if s[i] == '7' {
				found_seven = true
			}
		}

	}
}

package main

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

func IsPrime(n int) bool {
	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return n != 1
}

func solve() {
	f := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	N := 0
	fmt.Fscan(f, &N)
	for i := 0; i < N; i++ {
		n, s, found, o := 0, "", true, map[int]int{}
		fmt.Fscan(f, &n, &s)
		for j := 0; j < n; j++ {
			p, _ := strconv.Atoi(string(s[j]))
			if !IsPrime(p) {
				fmt.Fprintln(w, 1)
				fmt.Fprintln(w, p)
				found = false
				break
			} else {
				o[p]++
			}
		}
		if found {
			ok := false
			for k, v := range o {
				if v > 1 {
					fmt.Fprintln(w, 2)
					fmt.Fprintln(w, k*10+k)
					ok = true
				}
			}
			if !ok {
				fmt.Fprintln(w, len(s))
				fmt.Fprintln(w, s)
			}
		}
	}
	w.Flush()
}

func main() {
	solve()
}

package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, num int
		fmt.Scan(&a, &num)
		iszhi(num)
	}
}

func iszhi(n int) {
	t := n
	dd := []int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
		41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}
	arr := map[int]bool{}
	for _, v := range dd {
		arr[v] = true
	}
	//一位数的时候
	for n > 0 {
		if n%10 > 2 && !arr[n%10] {
			fmt.Println("1")
			fmt.Println(n % 10)
			return
		}
		n = n / 10
	}

	//两位数的时候
	str := []byte(strconv.Itoa(t))
	// fmt.Println(str)
	for i := 0; i+1 < len(str); i++ {
		for j := i + 1; j < len(str); j++ {
			s := string(str[i]) + string(str[j])
			num, _ := strconv.Atoi(s)
			if !arr[num] {
				fmt.Println("2")
				fmt.Println(num)
				return
			}
		}
	}
}


package main

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

var out = bufio.NewWriter(os.Stdout)

func run(c, n int) {
	switch (n) {
	case 1:
		fmt.Fprintln(out, c)
	case 2:
		fmt.Fprintln(out, c, 2*c)
	case 3:
		fmt.Fprintln(out, c, c, 3*c)
	default:
		for i := n - n/2; i > 0; i-- {
			fmt.Fprintf(out, "%d ", c)
		}
		run(2*c, n/2)
	}
}

func main() {
	var n int
	fmt.Scan(&n)
	run(1, n)
	out.Flush()
}

package main

import (
	"bytes"
	"fmt"
	"strconv"
)

func main() {
	n := 0
	fmt.Scan(&n)
	res, level := []int{}, 1

	for n > 0 {
		if n == 3 {
			res = append(res, []int{level, level, level * 3}...)
			break
		}
		reduce := 0
		for i := 1; i <= n; i++ {
			if i%2 == 1 {
				res, reduce = append(res, level), reduce+1
			}
		}
		n, level = n-reduce, level*2
	}

	buffer := []byte{}
	output := bytes.NewBuffer(buffer)
	output.WriteString(strconv.Itoa(res[0]))

	for i := 1; i < len(res); i++ {
		output.WriteString(" " + strconv.Itoa(res[i]))
	}

	fmt.Println(output.String())
}

package main

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

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

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

var seqN int

func printGcds(base, n int) {
	if n == 1 {
		printf("%d\n", base*1)
		return
	} else if n == 2 {
		printf("%d\n%d\n", base, base*2)
		return
	} else if n == 3 {
		printf("%d\n%d\n%d\n", base, base, base*3)
		return
	}
	for i := 0; i < ((n + 1) / 2); i++ {
		printf("%d\n", base)
	}
	printGcds(base*2, n/2)
}

func main() {
	defer writer.Flush()
	scanf("%d", &seqN)

	printGcds(1, seqN)
}

package main

import (
	"fmt"
	"os"
)

func main() {
	n := 0
	fmt.Scan(&n)
	if n == 3 {
		fmt.Println("1 1 3")
		os.Exit(0)
	}

	res, twoCounter := "1", n/2
	for i := 1; i < (n - twoCounter); i++ {
		res += " 1"
	}
	for i := 0; i < twoCounter; i++ {
		res += " 2"
	}
	fmt.Println(res)
}

package main

import (
	"fmt"
	"os"
)

func main() {
	n := 0
	fmt.Scan(&n)
	if n == 3 {
		fmt.Println("1 1 3")
		os.Exit(0)
	}

	res, nums := "1", make([]int, n-1)
	for i := 1; i < n; i++ {
		nums[i-1] = i + 1
	}
	level := 1
	for len(nums) > 0 {
		newNums := []int{}
		for _, num := range nums {
			if num%2 == 1 {
				res += fmt.Sprintf(" %d", level)
			} else {
				newNums = append(newNums, num/2)
			}
		}
		nums, level = newNums, level*2
	}
	fmt.Println(res)
}


package main

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

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

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

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

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

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

/**
 Run solve the problem CF1537A
 Date: 21/08/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1529/A
 Problem: CF1537A
**/
func (in *CF1537A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		size := in.NextInt()
		sum := 0
		for i := 0; i < size; i++ {
			num := in.NextInt()
			sum += num
		}
		ans := 0

		if size > sum {
			ans = 1
		} else if size < sum {
			ans = sum - size
		}

		fmt.Println(ans)
	}

}

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

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

package main

import "fmt"

func main() {
	var n, m, k, l, val int
	fmt.Scanf("%d\n", &n)

	for i:= 0; i < n; i++ {
		fmt.Scanf("%d\n", &m)
		k = 0
		l = 0
		for j := 0; j < m; j++ {
			fmt.Scanf("%d", &val)
			k++
			l += val
		}
		fmt.Scanln()

		if k <= l {
			fmt.Println(l - k)
		} else {
			fmt.Println(1)
		}
	}
}

package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	i := 0
	for scanner.Scan() {
	    m := scanner.Text()
	    if i!=0 && i%2 == 0{
	        res2 := strings.Split(m, " ")
	        var length int64
	        length = int64(len(res2))
		var add int64
		for _,j:= range res2 {
		    i,_ := strconv.ParseInt(j, 10, 64)
		    add+=i
		}
		if add >= length{
		    fmt.Println(add-length)
		}else{
		    fmt.Println(1)
		}
	    }
	    i++
	}

}

package main

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

func main() {
	var (
		t int
		n int
	)
	fmt.Scanf("%d\n", &t)
	scanner := bufio.NewScanner(os.Stdin)
	for i := 0; i < t; i++ {
		sum := 0
		scanner.Scan()
		n, _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		as := strings.Split(scanner.Text(), " ")
		for j := 0; j < n; j++ {
			tn, _ := strconv.Atoi(as[j])
			sum += tn
		}
		if sum < n {
			fmt.Println(1)
		} else if sum > n {
			fmt.Println(sum - n)
		} else {
			fmt.Println(0)
		}
	}
}

package main

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

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

	for test, _ := strconv.ParseInt(getString(reader), 10, 32); test > 0; test-- {
		n, _ := strconv.ParseInt(getString(reader), 10, 32)
		A := getIntln(reader)
		var sum int64
		for _, v := range A {
			sum += v
		}
		if sum == n {
			writer.WriteString("0\n")
		} else if sum > n {
			writer.WriteString(fmt.Sprintln(sum - n))
		} else {
			writer.WriteString("1\n")
		}
	}
	writer.Flush()
}

func getString(in *bufio.Reader) string {
	res, _ := in.ReadString('\n')
	res = strings.ReplaceAll(res, "\n", "")
	res = strings.ReplaceAll(res, "\r", "")
	res = strings.TrimSpace(res)
	return res

}

func getIntln(in *bufio.Reader) []int64 {
	b := strings.Split(getString(in), " ")
	res := make([]int64, len(b))
	for k, v := range b {
		res[k], _ = strconv.ParseInt(v, 10, 32)
	}
	return res
}

package main

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

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

func solve(n int, a []int) int {
	var sum int
	for _, x := range a {
		sum += x
	}
	if sum > n {
		return sum - n
	}
	if sum < n {
		return 1
	}
	return 0
}

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

package main

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

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

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

func process() {
	var n int64
	var sum int64

	scanf("%d\n", &n)

	for i := int64(0); i < n; i++ {
		var num int64
		scanf("%d", &num)
		sum += num
	}
	scanf("\n")
	// printf("Sum = %d\n", sum)
	if sum < n {
		printf("1\n")
	} else {
		printf("%d\n", sum-n)
	}
}

func main() {
	defer writer.Flush()

	var t int
	scanf("%d\n", &t)

	for i := 0; i < t; i++ {
		process()
	}

}

package main

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

type IO struct {
	in  io.Reader
	out io.Writer
}

func NewIO(in io.Reader, out io.Writer) *IO {
	return &IO{in: bufio.NewReader(in), out: bufio.NewWriter(out)}
}

func (io *IO) ReadInt64() int64 {
	var res int64
	fmt.Fscanf(io.in, "%d\n", &res)
	return res
}

func (io *IO) ReadInt() int {
	var res int
	fmt.Fscanf(io.in, "%d\n", &res)
	return res
}

func (io *IO) ReadPairInt64() (int64, int64) {
	var a, b int64
	fmt.Fscanf(io.in, "%d %d\n", &a, &b)
	return a, b
}

func (io *IO) ReadPairInt() (int, int) {
	var a, b int
	fmt.Fscanf(io.in, "%d %d\n", &a, &b)
	return a, b
}

func (io *IO) ReadString() string {
	var res string
	fmt.Fscanf(io.in, "%s\n", &res)
	return res
}

func (io *IO) ReadIntSlice(n int) []int64 {
	var t int64
	res := make([]int64, 0, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(io.in, "%d", &t)
		res = append(res, t)
	}
	fmt.Fscanf(io.in, "\n")
	return res
}

func main() {
	io := NewIO(os.Stdin, os.Stdout)
	t := io.ReadInt()
	for ; t > 0; t-- {
		n := io.ReadInt()
		a := io.ReadIntSlice(n)
		var sum int
		for _, v := range a {
			sum += int(v)
		}
		if sum >= len(a) {
			fmt.Fprintln(os.Stdout, sum - len(a))
		} else {
			fmt.Fprintln(os.Stdout, 1)
		}
	}
}

package main

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

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

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

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

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

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

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

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

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

		}
		return initial
	}
}

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

	}
	return m
}

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

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

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

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

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

	return
}

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

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

	return num
}

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

var t int

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

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

		}
		if sum == n {
			fmt.Println(0)
		}
		if sum > n {
			fmt.Println(sum - n)
		}
		if sum < n {
			fmt.Println(1)
		}

	}

}

package main

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

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

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

	var n, a int
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n)
		sum := 0
		for i := 0; i < n; i++ {
			fmt.Fscan(reader, &a)
			sum += a
		}

		if sum < n {
			fmt.Fprintln(writer, 1)
			continue
		}

		if sum == n {
			fmt.Fprintln(writer, 0)
			continue
		}

		fmt.Fprintln(writer, sum-n)
	}
}

package main

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

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

	var t int

	fmt.Fscan(in, &t)

	for ; t > 0; t -= 1 {
		var n int
		fmt.Fscan(in, &n)

		a := make([]int, n)

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

		var sum int = 0

		for i := 0; i < n; i += 1 {
			sum += a[i]
		}

		if sum == n {
			fmt.Fprintln(out, 0)
			continue
		}

		if sum > n {
			fmt.Fprintln(out, sum - n)
		} else {
			fmt.Fprintln(out, 1)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"log"
	"os"
)

func init() {
	log.SetFlags(0)
	log.SetOutput(ioutil.Discard)
}

func solve(a []int) int {
	log.Printf("a = %#v\n", a)
	sum := 0
	for _, v := range a {
		sum += v
	}
	if sum >= len(a) {
		return sum - len(a)
	}
	return 1
}

func main() {
	log.Println("start")

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

	num := 0
	fmt.Fscan(in, &num)
	for i := 0; i < num; i++ {
		size := 0
		fmt.Fscan(in, &size)
		a := make([]int, size)
		for i := 0; i < size; i++ {
			fmt.Fscan(in, &a[i])
		}
		fmt.Printf("%d\n", solve(a))

	}
	log.Println("__end__")
}

package main

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

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

	var t int

	fmt.Fscan(r, &t)

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

		a := make([]int, n)

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

		fmt.Println(solve(a, n))
	}
}

func solve(a []int, n int) int {
	var s int

	for i := 0; i < n; i++ {
		s += a[i]
	}

	if s >= 0 {
		if s >= (n) {
			return s - n

		} else {
			return 1
		}
	} else {
		return 1
	}
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)

    scanner.Scan()
    tests, _ := strconv.Atoi(scanner.Text())

    for i := 0; i < tests; i += 1 {
        scanner.Scan()
        n, _ := strconv.Atoi(scanner.Text())

        sum := 0
        for j := 0; j < n; j += 1 {
            scanner.Scan()
            num, _ := strconv.Atoi(scanner.Text())
            sum += num
        }

        if sum < n {
            fmt.Println(1)
        } else {
            fmt.Println(sum - n)
        }
    }
}

package main
import (
    "os"
    "fmt"
    "bufio"
)
func sum(a []int) int {
    s := 0
    for i := range a {
        s += a[i]
    }
    return s
}
var rd = bufio.NewReader(os.Stdin)
func main() {
    q := 0
    fmt.Fscan(rd, &q)
    for t := 0; t < q; t++ {
        n := 0
        fmt.Fscan(rd, &n)
        a := make([]int, n)
        for i := range a {
            fmt.Fscan(rd, &a[i])
        }
        if sum(a) < n {
            fmt.Println(1)
       } else {
            fmt.Println(sum(a) - n)
       }
    }
}

package main
import (
    "os"
    "fmt"
    "bufio"
)
func sum(a []int) int {
    s := 0
    for i := range a {
        s += a[i]
    }
    return s
}
var rd = bufio.NewReader(os.Stdin)
func main() {
    q := 0
    fmt.Fscan(rd, &q)
    for t := 0; t < q; t++ {
        n := 0
        fmt.Fscan(rd, &n)
        a := make([]int, n)
        for i := range a {
            fmt.Fscan(rd, &a[i])
        }
        s:= sum(a)
        if s < n {
            fmt.Println(1)
       } else {
            fmt.Println(s - n)
       }
    }
}

package main
import (
    "os"
    "fmt"
    "bufio"
)
var rd = bufio.NewReader(os.Stdin)
func main() {
    q := 0
    fmt.Fscan(rd, &q)
    for t := 0; t < q; t++ {
        n, s := 0, 0
        fmt.Fscan(rd, &n)
        a := make([]int, n)
        for i := range a {
            fmt.Fscan(rd, &a[i])
            s += a[i]
        }
        if s < n {
            fmt.Println(1)
       } else {
            fmt.Println(s - n)
       }
    }
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(r, "%d\n", &t)

	for t > 0 {
		var n int64
		fmt.Fscanf(r, "%d\n", &n)
		s := make([]int64, n)
		for i := 0; int64(i) < n; i++ {
			fmt.Fscanf(r, "%d ", &s[i])
		}
		fmt.Fscanf(r, "\n")
		fmt.Println(solve(s))
		t--
	}
}

func solve(s []int64) int64 {
	var sum int64
	for _, v := range s {
		sum += v
	}
	if float64(sum)/float64(len(s)) == 1 {
		return 0
	}
	if sum <= 0 {
		return 1
	}
	if sum <= int64(len(s)) {
		return 1
	}
	return sum - int64(len(s))
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n,sum int
		fmt.Scan(&n)
		var list []int = make([]int,n)
		for j:=0;j<n;j++{
			fmt.Scan(&list[j])
			sum+=list[j]
		}
		if sum-n < 0 {
			fmt.Println(1)
		}else{
			fmt.Println(sum-n)
		}
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}

package main

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

func sum(arr []int32) int32 {
	total := int32(0)
	for _, value := range arr {
		total += value
	}
	return total
}

func solve(n int32, arr []int32) int32 {
	total := sum(arr)
	if total < n {
		return 1
	} else {
		return total - n
	}
}

func arrayScanf(in *bufio.Reader, n int32, arr *[]int32) {
	m := int32(0)
	for i := int32(0); i < n; i++ {
		if i > 0 {
			fmt.Fscanf(in, " ")
		}
		fmt.Fscanf(in, "%d", &m)
		*arr = append(*arr, m)
	}
	fmt.Fscanf(in, "\n")
}

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

	tt := int32(0)
	fmt.Fscanf(in, "%d\n", &tt)
	for tt > 0 {
		n := int32(0)
		a := []int32{}
		fmt.Fscanf(in, "%d\n", &n)
		arrayScanf(in, n, &a)
		fmt.Fprintf(out, "%d\n", solve(n, a))
		tt--
	}
	out.Flush()
}

package main

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

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

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

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

			sum += temp
		}

		if sum == n {
			fmt.Println(0)
			continue
		}

		if sum < n {
			fmt.Println(1)
			continue
		}

		fmt.Println(sum - n)
	}
}

package main

import "fmt"

var t int
var n int

func main() {
	fmt.Scan(&t)
	for t > 0 {
		sum := 0
		var x int
		fmt.Scan(&n)
		for i := 1; i <= n; i++ {
			fmt.Scan(&x)
			sum += x
		}
		if sum == n {
			fmt.Println(0)
		} else {
			if sum <= 0 {
				fmt.Println(1)
			} else {
				if sum > n {
					fmt.Println(sum - n)
				} else {
					fmt.Println(1)
				}
			}
		}
		t--
	}
}

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

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

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		s := 0
		for _, v := range a {
			s += v
		}
		if s >=n {Fprintln(out, s-n)
		} else {Fprintln(out, 1)}
	}

	T := 1
	Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

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

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

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

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		s := 0
		for _, v := range a {
			s += v
		}
		if s >=n {
			Fprintln(out, s-n)
		} else {
			Fprintln(out, 1)
		}
	}

	T := 1
	Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

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

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"strings"
)

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

	solve := func(Case int) {
		var n int
		Fscan(in, &n)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		sum := 0
		for _, v := range a {
			sum += v
		}
		if sum >=n {
			Fprintln(out, sum-n)
		} else {
			Fprintln(out, 1)
		}
	}

	T := 1
	Fscan(in, &T) //
	for Case := 1; Case <= T; Case++ {
		solve(Case)
	}

	_leftData, _ := ioutil.ReadAll(in)
	if _s := strings.TrimSpace(string(_leftData)); _s != "" {
		panic("有未读入的数据：\n" + _s)
	}
}

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

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, b int
		fmt.Scan(&a)
		sum := 0
		for j := 0; j < a; j++ {
			fmt.Scan(&b)
			sum += b
		}
		if sum-a < 0 {
			fmt.Println("1")
		} else {
			fmt.Println(sum - a)
		}
	}
}

package main

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

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

    var tests int
    fmt.Fscanf(reader, "%d ", &tests)

    for i := 0; i < tests; i += 1 {
        var n int
        fmt.Fscanf(reader, "%d ", &n)

        sum := 0
        for j := 0; j < n; j += 1 {
            var num int
            fmt.Fscanf(reader, "%d ", &num)
            sum += num
        }

        fmt.Fprintln(writer, "SUM IS", sum)

        if sum < n {
            fmt.Fprintln(writer, 1)
        } else {
            fmt.Fprintln(writer, sum - n)
        }
    }
}

package main

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

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

    var tests int
    fmt.Fscanf(reader, "%d ", &tests)

    for i := 0; i < tests; i += 1 {
        var n int
        fmt.Fscanf(reader, "%d ", &n)

        sum := 0
        for j := 0; j < n; j += 1 {
            var num int
            fmt.Fscanf(reader, "%d ", &num)
            sum += num
        }

        if sum < n {
            fmt.Fprintln(writer, 1)
        } else {
            fmt.Fprintln(writer, sum - n)
        }
    }
}

package main

import (
    "fmt"
)

func main() {
    var tests int
    fmt.Scanf("%d\n", &tests)

    for i := 0; i < tests; i += 1 {
        var n int
        fmt.Scanf("%d\n", &n)

        sum := 0
        for j := 0; j < n; j += 1 {
            var num int
            fmt.Scanf("%d", &num)
            sum += num
        }

        var needed int
        if sum < n {
            needed = 1
        } else {
            needed = sum - n
        }
        fmt.Println(needed)
    }
}

package main

import (
    "fmt"
)

func main() {
    var tests int
    fmt.Scanf("%d", &tests)

    for i := 0; i < tests; i += 1 {
        var n int
        fmt.Scanf("%d", &n)

        sum := 0
        for j := 0; j < n; j += 1 {
            var num int
            fmt.Scanf("%d", &num)
            fmt.Println("read", num)
            sum += num
        }

        var needed int
        if sum < n {
            needed = 1
        } else {
            needed = sum - n
        }
        fmt.Println(needed)
    }
}

package main

import (
    "fmt"
)

func main() {
    var tests int
    fmt.Scanf("%d", &tests)

    for i := 0; i < tests; i += 1 {
        var n int
        fmt.Scanf("%d", &n)

        sum := 0
        for j := 0; j < n; j += 1 {
            var num int
            fmt.Scanf("%d", &num)
            sum += num
        }

        var needed int
        if sum < n {
            needed = 1
        } else {
            needed = sum - n
        }
        fmt.Println(needed)
    }
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(r, "%d\n", &t)

	for t > 0 {
		var n int64
		fmt.Fscanf(r, "%d\n", &n)
		s := make([]int64, n)
		for i := 0; int64(i) < n; i++ {
			fmt.Fscanf(r, "%d ", &s[i])
		}
		fmt.Fscanf(r, "\n")
		fmt.Println(solve(s))
		t--
	}
}

func solve(s []int64) int64 {
	var sum int64
	for _, v := range s {
		sum += v
	}
	if float64(sum)/float64(len(s)) == 1 {
		return 0
	}
	if sum == 0 {
		return 1
	}
	if sum < 0 {
		return 1
	}
	return sum - int64(len(s))
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(r, "%d\n", &t)

	for t > 0 {
		var n int
		fmt.Fscanf(r, "%d\n", &n)
		s := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(r, "%d ", &s[i])
		}
		fmt.Fscanf(r, "\n")
		fmt.Println(solve(s))
		t--
	}
}

func solve(s []int) int {
	sum := 0
	for _, v := range s {
		sum += v
	}
	if float64(sum)/float64(len(s)) == 1 {
		return 0
	}
	if sum == 0 {
		return 1
	}
	if sum < 0 {
		return 1
	}
	return sum - len(s)
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(r, "%d\n", &t)

	for t > 0 {
		var n int
		fmt.Fscanf(r, "%d\n", &n)
		s := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(r, "%d ", &s[i])
		}
		fmt.Fscanf(r, "\n")
		fmt.Println(solve(s))
		t--
	}
}

func solve(s []int) int {
	sum := 0
	for _, v := range s {
		sum += v
	}
	if float64(sum)/float64(len(s)) == 1 {
		return 0
	}
	if sum == 0 {
		return 0
	}
	if sum < 0 {
		return 1
	}
	v := math.Abs(float64(sum))
	return int(v) - len(s)
}

package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var t int
	fmt.Fscanf(r, "%d\n", &t)

	for t > 0 {
		var n int
		fmt.Fscanf(r, "%d\n", &n)
		s := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscanf(r, "%d ", &s[i])
		}
		fmt.Fscanf(r, "\n")
		fmt.Println(solve(s))
		t--
	}
}

func solve(s []int) int {
	sum := 0
	for _, v := range s {
		sum += v
	}
	if float64(sum)/float64(len(s)) == 1 {
		return 0
	}
	v := math.Abs(float64(sum))
	return int(v) - len(s)
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n,sum int
		fmt.Scan(&n)
		var list []int = make([]int,n)
		for j:=0;j<n;j++{
			fmt.Scan(&list[j])
			sum+=list[j]
		}
		if sum <= 0 {
			fmt.Println(1)
		}else{
			fmt.Println(sum-n)
		}
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n,sum int
		fmt.Scan(&n)
		var list []int = make([]int,n)
		for j:=0;j<n;j++{
			fmt.Scan(&list[j])
			sum+=list[j]
		}
		if sum-n <= 0 {
			fmt.Println(1)
		}else{
			fmt.Println(sum-n)
		}
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n,sum int
		fmt.Scan(&n)
		var list []int = make([]int,n)
		for j:=0;j<n;j++{
			fmt.Scan(&list[j])
			sum+=list[j]
		}
		fmt.Println(abs(sum)-n)
	}
}
func abs(x int) int {
	var result int
	if x > 0 {
		result = x
	} else {
		if x < 0 {
			result = x*-1
		}
	}
	return result
}

package main

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

func sum(arr []int32) int32 {
	total := int32(0)
	for _, value := range arr {
		total += value
	}
	return total
}

func solve(n int32, arr []int32) int32 {
	total := sum(arr)
	if total < n {
		total = n - total
		if total%10000 != 0 {
			return total/10000 + 1
		} else {
			return total / 10000
		}
	} else {
		return total - n
	}
}

func arrayScanf(in *bufio.Reader, n int32, arr *[]int32) {
	m := int32(0)
	for i := int32(0); i < n; i++ {
		if i > 0 {
			fmt.Fscanf(in, " ")
		}
		fmt.Fscanf(in, "%d", &m)
		*arr = append(*arr, m)
	}
	fmt.Fscanf(in, "\n")
}

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

	tt := int32(0)
	fmt.Fscanf(in, "%d\n", &tt)
	for tt > 0 {
		n := int32(0)
		a := []int32{}
		fmt.Fscanf(in, "%d\n", &n)
		arrayScanf(in, n, &a)
		fmt.Fprintf(out, "%d\n", solve(n, a))
		tt--
	}
	out.Flush()
}

package main

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

func sum(arr []int32) int32 {
	total := int32(0)
	for _, value := range arr {
		total += value
	}
	return total
}

func solve(n int32, arr []int32) int32 {
	total := sum(arr)
	if total <= 0 {
		total = 0 - total
		if total%10000 != 0 {
			return total/10000 + 1
		} else {
			return total / 10000
		}
	} else {
		return total - n
	}
}

func arrayScanf(in *bufio.Reader, n int32, arr *[]int32) {
	m := int32(0)
	for i := int32(0); i < n; i++ {
		if i > 0 {
			fmt.Fscanf(in, " ")
		}
		fmt.Fscanf(in, "%d", &m)
		*arr = append(*arr, m)
	}
	fmt.Fscanf(in, "\n")
}

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

	tt := int32(0)
	fmt.Fscanf(in, "%d\n", &tt)
	for tt > 0 {
		n := int32(0)
		a := []int32{}
		fmt.Fscanf(in, "%d\n", &n)
		arrayScanf(in, n, &a)
		fmt.Fprintf(out, "%d\n", solve(n, a))
		tt--
	}
	out.Flush()
}

package main

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

func sum(arr []int32) int32 {
	total := int32(0)
	for _, value := range arr {
		total += value
	}
	return total
}

func solve(n int32, arr []int32) int32 {
	total := sum(arr)
	if total <= 0 {
		return 1
	} else {
		return total - n
	}
}

func arrayScanf(in *bufio.Reader, n int32, arr *[]int32) {
	m := int32(0)
	for i := int32(0); i < n; i++ {
		if i > 0 {
			fmt.Fscanf(in, " ")
		}
		fmt.Fscanf(in, "%d", &m)
		*arr = append(*arr, m)
	}
	fmt.Fscanf(in, "\n")
}

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

	tt := int32(0)
	fmt.Fscanf(in, "%d\n", &tt)
	for tt > 0 {
		n := int32(0)
		a := []int32{}
		fmt.Fscanf(in, "%d\n", &n)
		arrayScanf(in, n, &a)
		fmt.Fprintf(out, "%d\n", solve(n, a))
		tt--
	}
	out.Flush()
}

package main

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

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

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

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

			sum += temp
		}

		if sum == n {
			fmt.Println(0)
			continue
		}

		if sum < 1 {
			fmt.Println(1)
			continue
		}

		fmt.Println(sum - n)
	}
}

package main

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

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

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

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

			sum += temp
		}

		if sum/n == 1 && sum%n == 0 {
			fmt.Println(0)
			continue
		}

		if sum < 1 {
			fmt.Println(1)
			continue
		}

		fmt.Println(sum - n)
	}
}

package main

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

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

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

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

			sum += temp
		}

		if sum == 1 {
			fmt.Println(0)
			continue
		}

		if sum < 1 {
			fmt.Println(1)
			continue
		}

		fmt.Println(sum - n)
	}
}

package main

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

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

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

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

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

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

/**
 Run solve the problem CF1537A
 Date: 21/08/21
 User: pepradere
 URL: https://codeforces.com/problemset/problem/1529/A
 Problem: CF1537A
**/
func (in *CF1537A) Run() {
	t := in.NextInt()
	for ; t > 0; t-- {
		n := in.NextInt()
		sum := 0
		for i := 0; i < n; i++ {
			num := in.NextInt()
			sum += num
		}
		size := n

		ans := 0
		if sum < 0 {
			ans = 1
			sum = size
		}
		if size > sum {
			ans = size - sum
		} else if size < sum {
			ans = sum - size
		}

		fmt.Println(ans)
	}

}

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

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

package main

import "fmt"

var t int
var n int

func main() {
	fmt.Scan(&t)
	for t > 0 {
		sum := 0
		var x int
		fmt.Scan(&n)
		for i := 1; i <= n; i++ {
			fmt.Scan(&x)
			sum += x
		}
		if sum == n {
			fmt.Println(0)
		} else {
			if sum <= 0 {
				fmt.Println(1)
			} else {
				fmt.Println(sum - n)
			}
		}
		t--
	}
}

package main

import "fmt"

var t int
var n int

func main() {
	fmt.Scan(&t)
	for t > 0 {
		sum := 0
		var x int
		fmt.Scan(&n)
		for i := 1; i <= n; i++ {
			fmt.Scan(&x)
			sum += x
		}
		if sum == n {
			fmt.Println(0)
		} else {
			if sum < 0 {
				fmt.Println(1)
			} else {
				fmt.Println(sum - n)
			}
		}
		t--
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var a, b int
		fmt.Scan(&a)
		sum := 0
		for j := 0; j < a; j++ {
			fmt.Scan(&b)
			sum += b
		}
		if sum-b < 0 {
			fmt.Println("1")
		} else {
			fmt.Println(sum - b)
		}
	}
}

package main

import "fmt"

func main() {
	var n, m, k, l, val int
	fmt.Scanf("%d", &n)

	for i:= 0; i < n; i++ {
		fmt.Scanf("%d", &m)
		k = 0
		l = 0
		for j := 0; j < m; j++ {
			fmt.Scanf("%d", &val)
			k++
			l += val
		}

		if k <= l {
			fmt.Println(l - k)
		} else {
			fmt.Println(1)
		}
	}
}

package main

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

func main() {
	var test int
	fmt.Scanf("%d", &test)
	scanner := bufio.NewScanner(os.Stdin)
	i := 0
	for scanner.Scan() {
	    m := scanner.Text()
	    if i%2 != 0{
	        res2 := strings.Split(m, " ")
	        var length int64
	        length = int64(len(res2))
		var add int64
		for _,j:= range res2 {
		    i,_ := strconv.ParseInt(j, 10, 64)
		    add+=i
		}
		if add >= length{
		    fmt.Println(add-length)
		}else{
		    fmt.Println(1)
		}
	    }
	    i++
	}

}


// 262A-mic
package main

import (
	"fmt"
)

func main() {
	var n, k, cou, m int
	var num string
	fmt.Scan(&n, &k)
	for i := 0; i < n; i++ {
		fmt.Scan(&num)
		for s := 0; s < len(num); s++ {
			if num[s] == '4' || num[s] == '7' {
				cou++
			}
		}
		if cou <= k {
			m++
		}
		cou = 0
	}
	fmt.Println(m)
}

package main

import (
	"fmt"
)

func get_lucky_digits_num(num string) int {
	ret := 0
	for i := 0; i < len(num); i++ {
		if num[i] == '4' || num[i] == '7' {
			ret++
		}
	}

	return ret
}

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	var num string
	ans := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&num)
		if get_lucky_digits_num(num) <= k {
			ans++
		}
	}

	fmt.Println(ans)
}

package main
import (
    "fmt"
    //"unicode/utf8"
    //"strconv"
)

func main() {
    var n,k,a,cnt int
    ans:=0
    fmt.Scan(&n,&k)
    for i:=0;i<n;i++ {
        cnt=0
        fmt.Scan(&a)
        for ;a>0; {
            if( a%10==4 || a%10==7) {
                cnt++
            }
            a/=10
        }
        if cnt<=k {
            ans++
        }
    }
    fmt.Println(ans)
}

package main

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

func main() {
	var n, k int
	if _, err := fmt.Scanf("%d %d\n", &n, &k); err != nil {
		return
	}

	var result int = 0

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}
		if no_more_than_k(a, k) {
			result++
		}
	}

	fmt.Println(result)
}

func no_more_than_k(a, k int) bool {
	cnt := 0
	for a > 0 {
		d := a % 10
		if d == 4 || d == 7 {
			cnt++
			if cnt > k {
				return false
			}
		}
		a = a / 10
	}
	return true
}

package main

import "fmt"

func main() {
    var n,k int
    var a string
    fmt.Scan(&n,&k)
    ans := 0
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        cnt := 0
        for _, v := range a {
            if (v == '4') || (v == '7') { cnt++ }
        }
        if cnt <= k { ans++ }
    }
    fmt.Println(ans)
}

package main
import "fmt"
func main () {
    var n,m,c,z int
    c=0
    z=0
    var t []byte
    fmt.Scan(&n,&m)
    for i:=0; i<n; i++ {
        fmt.Scan(&t)
        for _,j := range t {
            if j==52 || j==55 {
                z++
            }
        }
        if z<=m {
            c++
        }
        z=0
    }
    fmt.Println(c)
}


package main

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

func main() {
	var s string
	var k int
	re := regexp.MustCompile(`\r?\n`)

	reader := bufio.NewReader(os.Stdin)
	if _s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(_s, "")
	}

	if _k, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		_k = re.ReplaceAllString(_k, "")
		_vk, err := strconv.Atoi(_k)
		if err != nil {
			return
		}
		k = _vk
	}

	var ok bool = true
	l := len(s)
	if l%k != 0 {
		ok = false
	} else {
		n := l / k
		for i := 0; i < k; i++ {
			for j := 0; j < n/2; j++ {
				if s[n*i+j] != s[n*i+n-j-1] {
					ok = false
					break
				}
			}
			if !ok {
				break
			}
		}
	}

	if ok {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"
import "os"
import "bufio"
import "strconv"

var (
	ss string
)

func main() {
	//fin, _ := os.Open("in.txt")
	in := bufio.NewScanner(os.Stdin)
	//in := bufio.NewScanner(fin)
	for in.Scan() {
		ss = in.Text()
		//fmt.Fscan(fin, &k)
		in.Scan()
		k, _ := strconv.Atoi(in.Text())
		//fmt.Println(ss, k)
		l := len(ss)
		if l == k {
			fmt.Println("YES")
		} else if l%k != 0 {
			fmt.Println("NO")
		} else {
			f := l / k
			flag := true
			for i := 0; i < l; i += f {
				if check(i, i+f-1) != true {
					flag = false
					break
				}
			}
			if flag == true {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

func check(s, t int) bool {
	for i, j := s, t; i < j; i, j = i+1, j-1 {
		if ss[i] != ss[j] {
			return false
		}
	}
	return true
}

package main

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

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

//Wrong
func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)

	s := next()
	k := nextInt()

	if len(s)%k != 0 {
		println("NO")
		return
	}

	n := len(s) / k

	for i := 0; i < k; i++ {
		begin, end := i*n, (i+1)*n
		if !isPalindrome(s[begin:end]) {
			println("NO")
			return
		}
	}

	println("YES")
}

func isPalindrome(s string) bool {
	for i := 0; i < len(s)/2; i++ {
		if s[i] != s[len(s)-i-1] {
			return false
		}
	}

	return true
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

func nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }

package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  s := getS()
  k := getI()
  feasible := false
  if len(s)%k == 0 {
    feasible = true
    span := len(s)/k
    for i := span; i <= len(s); i += span {
      for j, k := i-span, i-1; j < k; j, k = j+1, k-1 {
        if s[j] != s[k] {
          feasible = false
          break
        }
      }
      if !feasible {
        break
      }
    }
  }
  result := "NO"
  if feasible {
    result = "YES"
  }
  writer.WriteString(fmt.Sprintf("%s\n", result))
}

package main

import (
  "fmt"
  "os"
)

func main(){
  var s string
  var k int
  fmt.Scan(&s, &k)
  if len(s) % k != 0 {
    fmt.Println("NO")
  }else{
    l := len(s)/k
    for i := 0;i < k;i++ {
      for j := 0;j < l; j++ {
        if s[j+i*l] != s[l-j-1+i*l] {
          fmt.Println("NO")
          os.Exit(0)
        }
      }
    }
    fmt.Println("YES")
  }
}

package main

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

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

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

func getLine() string {
	s, _ := reader.ReadString('\n')
	if strings.HasSuffix(s, "\r\n") {
		s = s[:len(s)-2]
	} else if strings.HasSuffix(s, "\n") {
		s = s[:len(s)-1]
	}
	return s
}
func getLine2Int() (n int) {
	scanf("%d\n", &n)
	return
}
func getLine2Int2() (a, b int) {
	scanf("%d %d\n", &a, &b)
	return
}
func getLine2Ints(n int) []int {
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		scanf("%d ", &ans[i])
	}
	scanf("%d\n", &ans[n-1])
	return ans
}

func pcheck(i bool) {
	if i {
		printf("YES\n")
	} else {
		printf("NO\n")
	}
}

var debug = true

func see(a interface{}) {
	if debug {
		printf("DEBUG:%v\n", a)
	}
}

func checks(s []byte) bool {
	for i := 0; i < len(s)-i; i++ {
		if s[i] != s[len(s)-i-1] {
			return false
		}
	}
	return true
}

func main() {
	defer writer.Flush()

	s := getLine()
	k := getLine2Int()
	ok := true
	if len(s)%k != 0 {
		ok = false
	}
	dex := len(s) / k
	for i := 0; ok && i < len(s); i += len(s) / k {
		ok = checks([]byte(s[i : i+dex]))
	}
	pcheck(ok)
}

package main

import (
	"fmt"
)

func pal(arr []rune) bool {
	for i := 0; i < len(arr)/2; i++ {
		if arr[i] != arr[len(arr)-i-1] {
			return false
		}
	}
	return true
}

func main() {
	var str string
	var k int
	fmt.Scan(&str, &k)

	if len(str)%k != 0 {
		fmt.Println("NO")
		return
	}

	isPal := true
	s := []rune(str)
	size := len(str) / k

	for i := 0; i < k && isPal; i++ {
		isPal = isPal && pal(s[i*size:i*size+size])
	}

	if isPal {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}

package main

import (
	"fmt"
)

func pal(arr []rune) bool {
  for i:=0; i< len(arr)/2;i++ {
    if arr[i] != arr[len(arr)-i-1] {
      return false
    }
  }
  return true
}

func main() {
  var str string
  var k int
  fmt.Scan(&str, &k)

  if len(str) % k != 0 {
    fmt.Println("NO")
    return
  }

  isPal := true
  s := []rune(str)
  size := len(str)/k

  for i:=0; i < k && isPal ; i++ {
    isPal = isPal && pal(s[i*size:i*size+size])
  }

  if isPal {
    fmt.Println("YES")
  }else{
    fmt.Println("NO")
  }

}

package main

import (
	"fmt"
)

func check(s string, l int) bool {
	for i := 0; i < l/2; i++ {
		if s[i] != s[l-1-i] {
			return false
		}
	}

	return true
}

func solve(s string, k int) bool {
	length := len(s)
	if length%k != 0 {
		return false
	}

	d := length / k
	for i := 0; i < length; i += d {
		if !check(s[i:i+d], d) {
			return false
		}
	}

	return true
}

func main() {
	var s string
	var k int
	fmt.Scan(&s)
	fmt.Scan(&k)

	if solve(s, k) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"

func min(a, b int) int {
  if a < b {
    return a
  }
  return b
}

func isPalindrome(s string, l, r int) bool {
  for l < r {
    if s[l] != s[r] {
      return false
    }
    l++
    r--
  }

  return true
}

func main()  {
  var s string
  var K int
  fmt.Scanf("%s\n", &s)
  fmt.Scanf("%d\n", &K)

  N := len(s) / K

  ret := true

  if len(s) % K != 0 {
    ret = false
  }

  for k := 0; ret && k < K; k++ {
    if !isPalindrome(s, k * N, k * N + N - 1) {
      ret = false
    }
  }

  if ret {
    fmt.Println("YES")
  } else {
    fmt.Println("NO")
  }
}

package main

import "fmt"
import "os"
import "bufio"
import "strconv"

var (
	ss string
)

func main() {
	//fin, _ := os.Open("in.txt")
	in := bufio.NewScanner(os.Stdin)
	//in := bufio.NewScanner(fin)
	for in.Scan() {
		ss = in.Text()
		//fmt.Fscan(fin, &k)
		in.Scan()
		k, _ := strconv.Atoi(in.Text())
		fmt.Println(ss, k)
		l := len(ss)
		if l == k {
			fmt.Println("YES")
		} else {
			f := l / k
			flag := true
			for i := 0; i < l; i += f {
				if check(i, i+f-1) != true {
					flag = false
					break
				}
			}
			if flag == true {
				fmt.Println("YES")
			} else {
				fmt.Println("NO")
			}
		}
	}
}

func check(s, t int) bool {
	for i, j := s, t; i < j; i, j = i+1, j-1 {
		if ss[i] != ss[j] {
			return false
		}
	}
	return true
}

package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func getI() int {
  return int(getI64())
}
func getF() float64 {
  scanner.Scan()
  x, _ := strconv.ParseFloat(scanner.Text(), 64)
  return x
}
func getS() string {
  scanner.Scan()
  return scanner.Text()
}

func main() {
  scanner = bufio.NewScanner(os.Stdin)
  scanner.Split(bufio.ScanWords)
  writer := bufio.NewWriter(os.Stdout)
  defer writer.Flush()

  s := getS()
  k := getI()
  feasible := true
  if len(s)%k == 0 {
    span := len(s)/k
    for i := span; i <= len(s); i += span {
      for j, k := i-span, i-1; j < k; j, k = j+1, k-1 {
        if s[j] != s[k] {
          feasible = false
          break
        }
      }
      if !feasible {
        break
      }
    }
  }
  result := "NO"
  if feasible {
    result = "YES"
  }
  writer.WriteString(fmt.Sprintf("%s\n", result))
}

package main

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

func main() {
	var s string
	var k int

	reader := bufio.NewReader(os.Stdin)
	if _s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = _s
	}

	if _, err := fmt.Scanf("%d\n", &k); err != nil {
		return
	}

	l := len(s)
	if l > 1 && s[l-2] == '\r' {
		l -= 2
	} else if s[l-1] == '\n' {
		l -= 1
	}

	var ok bool = true
	if l%k != 0 {
		ok = false
	} else {
		n := l / k
		for i := 0; i < k; i++ {
			for j := 0; j < n/2; j++ {
				if s[n*i+j] != s[n*i+n-j-1] {
					ok = false
					break
				}
			}
			if !ok {
				break
			}
		}
	}

	if ok {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

package main

import "fmt"

func min(a, b int) int {
  if a < b {
    return a
  }
  return b
}

func isPalindrome(s string, l, r int) bool {
  for l < r {
    if s[l] != s[r] {
      return false
    }
    l++
    r--
  }

  return true
}

func main()  {
  var s string
  var K int
  fmt.Scanf("%s\n", &s)
  fmt.Scanf("%d\n", &K)

  N := len(s) / K

  ret := true

  for k := 0; k < K; k++ {
    if !isPalindrome(s, k * N, k * N + N - 1) {
      ret = false
      break
    }
  }

  if ret {
    fmt.Println("YES")
  } else {
    fmt.Println("NO")
  }
}