package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func flush()                            { out.Flush() }
func scan(a ...interface{})             { fmt.Fscan(in, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(out, f, a...) }
func assert(f bool) {
	if !f {
		panic("gg")
	}
}

// ----------------------------- TEMPLATE END ----------------------------------
var n, k int
var a []int
var acc []int

func countInRange(x, y int) int {
	return acc[y] - acc[x-1]
}

func solveCase() {
	scan(&n, &k)
	a = make([]int, n)
	acc = make([]int, n+1)
	for i := 0; i < n; i++ {
		scan(&a[i])
		acc[a[i]]++
	}
	for i := 0; i < n; i++ {
		acc[i+1] += acc[i]
	}
	ansX := 1
	ansY := n
	for x := 1; x <= n; x++ {
		lo := x
		hi := n
		mi := lo
		cnt0 := 0
		cnt1 := 0
		for lo < hi {
			mi = (lo + hi) / 2
			cnt1 = countInRange(x, mi)
			cnt0 = n - cnt1
			if cnt1-cnt0 >= k {
				hi = mi
			} else {
				lo = mi + 1
			}
		}
		y := lo
		cnt1 = countInRange(x, y)
		cnt0 = n - cnt1
		if cnt1-cnt0 >= k {
			if ansY-ansX > y-x {
				ansY = y
				ansX = x
			}
		}
	}
	printf("%d %d\n", ansX, ansY)
	var ansL []int
	var ansR []int
	var startAt = 0
	var balance = 0
	for i := 0; len(ansL)+1 < k; i++ {
		if ansX <= a[i] && a[i] <= ansY {
			balance++
		} else {
			balance--
		}
		if balance == 1 {
			ansL = append(ansL, startAt+1)
			ansR = append(ansR, i+1)
			startAt = i + 1
			balance = 0
		}
	}
	ansL = append(ansL, startAt+1)
	ansR = append(ansR, n)
	for i := 0; i < k; i++ {
		printf("%d %d\n", ansL[i], ansR[i])
	}
}

func main() {
	defer flush()

	var ntc int
	scan(&ntc)
	for t := 0; t < ntc; t++ {
		solveCase()
	}
}

/**
Case k=1:
	Find [x,y] such that mayority of elements are in [x,y] and y-x is minimized.
	If I sort a, I can find [x,y] in O(n).
	Moyority means countInRange(x,y) >= n/2 + 1
	n/2 + 1 - (n - ((n/2)+1)) = -n + n/2 + 1 + n/2 + 1 = -n + 2*(n/2) + 2
General case:
	Find [x,y] such that:
	countInRange(x,y) >= n/2 + k
	n/2 + k - (n - ((n/2)+k)) = -n + n/2 + k + n/2 + k = -n + 2*(n/2) + 2*k
*/

package main

import (
	"bufio"
	. "fmt"
	"io"
	"io/ioutil"
	"os"
	"sort"
	"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, k int
		Fscan(in, &n, &k)
		a := make([]int, n)
		pos := make([][]int, n+1)
		for i := range a {
			Fscan(in, &a[i])
			pos[a[i]] = append(pos[a[i]], i)
		}

		sum := make([]int, n+2)
		for i, v := range pos {
			sum[i+1] = sum[i] + len(v)
		}

		type pair struct{ l, r int }
		ans := []pair{}
		ansx := -1
		ansy := -1
		f := func(d int) bool {
			ans = nil
			ansx = -1

			for y := d + 1; y <= n; y++ {
				x := y - d
				cnt := sum[y+1] - sum[x]
				if cnt-(n-cnt) >= k {
					ansx = x
					ansy=y
					i := 0
					for ; i < n && len(ans) < k-1; {
						st := i
						c := 0
						for ; i < n && c <= 0; i++ {
							if x <= a[i] && a[i] <= y {
								c++
							} else {
								c--
							}
						}
						ans = append(ans, pair{st, i - 1})
					}
					if len(ans) < k-1 {
						return false
					}
					ans = append(ans, pair{i,n-1})
					return true
				}
			}
			return false
		}

		d := sort.Search(n, f)
		if d == n {
			Fprintln(out, 1, n)
			for i := 1; i < k; i++ {
				Fprintln(out, i, i)
			}
			Fprintln(out, k, n)
			return
		}

		f(d)

		if ansx == -1 {
			panic(-1)
		}
		Fprintln(out, ansx, ansy)
		for _, p := range ans {
			Fprintln(out, p.l+1, p.r+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"
	"os"
	"sort"
)

var rw = NewFastIO(os.Stdin, os.Stdout)

func main() {
	defer rw.Flush()
	n := rw.NextInt()
	a := rw.NextInts(n)
	sort.Ints(a[:])
	b := make([]int, n)
	rw.Println((n - 1) / 2)
	for i := 0; i < n; i++ {
		if i%2 == 0 {
			b[i] = a[i/2+n/2]
		} else {
			b[i] = a[i/2]
		}
	}
	rw.PrintlnInts(b...)
}

// @meooow template uwu
type FastIO struct {
	*bufio.Writer
	r    io.Reader
	buf  [8192]byte
	i, n int
}

func NewFastIO(r io.Reader, w io.Writer) *FastIO {
	return &FastIO{r: r, Writer: bufio.NewWriter(w)}
}

func (f *FastIO) readC() byte {
	if f.i == f.n {
		f.n, _ = f.r.Read(f.buf[:])
		if f.n == 0 {
			panic("EOF")
		}
		f.i = 0
	}
	f.i++
	return f.buf[f.i-1]
}

func (f *FastIO) Next() string {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	var s []byte
	for ; c > ' '; c = f.readC() {
		s = append(s, c)
	}
	return string(s)
}

func (f *FastIO) NextInt() int {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := 0
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}
func (f *FastIO) NextInt64() int64 {
	c := f.readC()
	for ; c <= ' '; c = f.readC() {
	}
	neg := false
	if c == '-' {
		neg = true
		c = f.readC()
	}
	n := int64(0)
	for ; '0' <= c && c <= '9'; c = f.readC() {
		n = n*10 + int64(c) - '0'
	}
	if neg {
		return -n
	}
	return n
}

func (f *FastIO) NextInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt()
	}
	return a
}
func (f *FastIO) NextInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = f.NextInt64()
	}
	return a
}

func (f *FastIO) Println(a ...interface{}) {
	fmt.Fprintln(f, a...)
}

func (f *FastIO) Print(a ...interface{}) {
	fmt.Fprint(f, a...)
}
func (f *FastIO) PrintInts(a ...int) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInts(a ...int) {
	f.PrintInts(a...)
	f.Println()
}
func (f *FastIO) PrintInt64s(a ...int64) {
	if len(a) > 0 {
		f.Print(a[0])
		for _, x := range a[1:] {
			f.Print(" ", x)
		}
	}
}
func (f *FastIO) PrintlnInt64s(a ...int64) {
	f.PrintInt64s(a...)
	f.Println()
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

	in := func() int64 {
		sc.Scan()
		i, _ := strconv.ParseInt(sc.Text(), 10, 64)
		return i
	}

	n := in()
	a := make([]int64, n)
	b := make([]int64, n)

	for i := range a {
		a[i] = in()
	}

	sort.Slice(a, func(i, j int) bool {
		return a[i] < a[j]
	})

	var s, c int64 = 1, 0

	var j int64

	for j = s; j < n; j += 2 {
		b[j] = a[c]
		c++
	}

	s = 0

	for j = s; j < n; j += 2 {
		b[j] = a[c]
		c++
	}

	fmt.Println((n-1)/2)

	for i := range b {
		fmt.Print(b[i], " ")
	}

	fmt.Println()
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
	"sort"
)

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

	n := readNum(reader)

	A := readNNums(reader, n)

	cnt := solve(n, A)

	var buf bytes.Buffer

	buf.WriteString(fmt.Sprintf("%d\n", cnt))

	for i := 0; i < n; i++ {
		buf.WriteString(fmt.Sprintf("%d ", A[i]))
	}
	buf.WriteByte('\n')
	fmt.Print(buf.String())
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(n int, A []int) int {
	cnt := (n - 2 + 1) / 2

	sort.Ints(A)

	B := make([]int, n)
	j := n - 1
	for i := 0; i < n; i += 2 {
		B[i] = A[j]
		j--
	}
	for i := 1; i < n; i += 2 {
		B[i] = A[j]
		j--
	}
	copy(A, B)

	return cnt
}

package main

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

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	scanner.Buffer(bf, 10*1024*1024)

	numberSpheres := convertInputToInt(stdInput(scanner, 1))[0]
	priceList := convertInputToInt(stdInput(scanner, numberSpheres))
	sort.Ints(priceList)
	cheapItemsCount, optimalOrder := processPriceList(priceList, numberSpheres)

	fmt.Println(cheapItemsCount)
	for i := 0; i < numberSpheres; i++ {
		fmt.Print(optimalOrder[i], " ")
	}
}

func processPriceList(priceList []int, numElements int) (int, []int) {
	var cheapItemsCount int = 0
	if numElements < 3 {
		return cheapItemsCount, priceList
	}
	if numElements%2 == 0 {
		cheapItemsCount = len(priceList)/2 - 1
	} else {
		cheapItemsCount = len(priceList) / 2
	}
	return cheapItemsCount, rearrangePriceList(priceList, cheapItemsCount)
}

func rearrangePriceList(priceList []int, cheapItemsCount int) []int {
	var newPriceList []int
	cheapSplit := priceList[:cheapItemsCount]
	expensiveSplit := priceList[cheapItemsCount:]

	for i := 0; i < len(expensiveSplit); i++ {
		if i > len(cheapSplit)-1 {
			newPriceList = append(newPriceList, expensiveSplit[i])
		} else {
			newPriceList = append(newPriceList, expensiveSplit[i], cheapSplit[i])
		}
	}
	return newPriceList
}

///////// UTILS ///////////

func stdInput(scanner *bufio.Scanner, varCount int) []string {
	var inputParameters []string

	scanner.Scan()
	input := strings.Split(scanner.Text(), " ")
	for i := 0; i < varCount; i++ {
		inputParameters = append(inputParameters, input[i])
	}
	return inputParameters
}

func convertInputToInt(variables []string) []int {
	var convertedInput []int
	for _, value := range variables {
		convertedVar, _ := strconv.Atoi(value)
		convertedInput = append(convertedInput, convertedVar)
	}
	return convertedInput
}

package main

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

const (
	SCANNER_BUF_SIZE = 2 << 20

	INF = int64(math.MaxInt64)
	MOD = 1e9 + 7
)

var (
	writer  *bufio.Writer
	scanner *bufio.Scanner
)

func init() {
	writer = bufio.NewWriter(os.Stdout)
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, SCANNER_BUF_SIZE), SCANNER_BUF_SIZE)
}

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

func sint64() int64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func suint64() uint64 {
	scanner.Scan()
	bb := scanner.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

func sstring() string {
	scanner.Scan()
	return scanner.Text()
}

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func lcm(a, b int64) int64 {
	return a * b / gcd(a, b)
}

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

func main() {
	defer writer.Flush()
	n := sint64()
	a := make([]int64, n)
	for i := range a {
		a[i] = sint64()
	}
	sol(n, a)
}

func sol(n int64, a []int64) {
	if n <= 2 {
		printf("%d\n", 0)
		for _, ai := range a {
			printf("%d ", ai)
		}
		printf("\n")
		return
	}
	sort.Slice(a, func(il, ir int) bool {
		return a[il] < a[ir]
	})
	ans := []int64{}
	l := 0
	r := len(a) - 1
	for l <= r {
		if l == r {
			ans = append(ans, a[l])
			break
		}
		ans = append(ans, a[r], a[l])
		l++
		r--
	}
	if ans[len(ans)-2] > ans[len(ans)-1] {
		ans[len(ans)-2], ans[len(ans)-1] = ans[len(ans)-1], ans[len(ans)-2]
	}
	ansn := int64(0)
	for i := 1; i < len(ans)-1; i++ {
		if ans[i-1] > ans[i] && ans[i] < ans[i+1] {
			ansn++
		}
	}
	printf("%d\n", ansn)
	for _, ai := range ans {
		printf("%d ", ai)
	}
	printf("\n")
}

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	bf := make([]byte, 1024*1024)
	sc.Buffer(bf, 10*1024*1024)
	sc.Split(bufio.ScanWords)

	in := func() int64 {
		sc.Scan()
		i, _ := strconv.ParseInt(sc.Text(), 10, 64)
		return i
	}

	n := in()
	a := make([]int64, n)
	b := make([]int64, n)

	for i := range a {
		a[i] = in()
	}

	sort.Slice(a, func(i, j int) bool {
		return a[i] < a[j]
	})

	var s, c int64 = 1, 0

	var j int64

	for j = s; j < n; j += 2 {
		b[j] = a[c]
		c++
	}

	s = 0

	for j = s; j < n; j += 2 {
		b[j] = a[c]
		c++
	}

	for i := range b {
		fmt.Print(b[i], " ")
	}

	fmt.Println()
}

package main

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

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	numberSpheres := convertInputToInt(stdInput(scanner, 1))[0]
	priceList := convertInputToInt(stdInput(scanner, numberSpheres))

	sort.Ints(priceList)
	optimalOrder, cheapItemsCount := processPriceList(priceList, numberSpheres)
	fmt.Println(optimalOrder)
	fmt.Println(cheapItemsCount)
}

func processPriceList(priceList []int, numElements int) (int, []int) {
	var cheapItemsCount int = 0
	if numElements < 3 {
		return cheapItemsCount, priceList
	}

	even := (numElements%2 == 0)
	if even {
		cheapItemsCount = len(priceList)/2 - 1
	} else {
		cheapItemsCount = len(priceList) / 2
	}
	return cheapItemsCount, rearrangePriceList(priceList, cheapItemsCount)
}

func rearrangePriceList(priceList []int, cheapItemsCount int) []int {
	var newPriceList []int
	cheapSplit := priceList[:cheapItemsCount]
	expensiveSplit := priceList[cheapItemsCount:]

	for i := 0; i < len(expensiveSplit); i++ {
		if i > len(cheapSplit)-1 {
			newPriceList = append(newPriceList, expensiveSplit[i])
		} else {
			newPriceList = append(newPriceList, expensiveSplit[i], cheapSplit[i])
		}

	}
	return newPriceList
}

func stdInput(scanner *bufio.Scanner, varCount int) []string {
	var inputParameters []string

	scanner.Scan()
	input := strings.Split(scanner.Text(), " ")
	for i := 0; i < varCount; i++ {
		inputParameters = append(inputParameters, input[i])
	}
	return inputParameters
}

func convertInputToInt(variables []string) []int {
	var convertedInput []int
	for _, value := range variables {
		convertedVar, _ := strconv.Atoi(value)
		convertedInput = append(convertedInput, convertedVar)
	}
	return convertedInput
}

package main

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

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	numberSpheres := convertInputToInt(stdInput(scanner, 1))[0]
	priceList := convertInputToInt(stdInput(scanner, numberSpheres))

	sort.Ints(priceList)
	optimalOrder, cheapItemsCount := processPriceList(priceList, numberSpheres)
	fmt.Println(optimalOrder)
	fmt.Println(cheapItemsCount)
}

func processPriceList(priceList []int, numElements int) (int, []int) {
	var cheapItemsCount int = 0
	if numElements < 3 {
		return cheapItemsCount, priceList
	}

	even := (numElements%2 == 0)
	if even {
		cheapItemsCount = len(priceList)/2 - 1
	} else {
		cheapItemsCount = len(priceList) / 2
	}
	return cheapItemsCount, rearrangePriceList(priceList, cheapItemsCount)
}

func rearrangePriceList(priceList []int, cheapItemsCount int) []int {
	var newPriceList []int
	cheapSplit := priceList[:cheapItemsCount]
	expensiveSplit := priceList[cheapItemsCount:]

	for i := 0; i < len(expensiveSplit); i++ {
		if i > len(cheapSplit)-1 {
			newPriceList = append(newPriceList, expensiveSplit[i])
		} else {
			newPriceList = append(newPriceList, expensiveSplit[i], cheapSplit[i])
		}

	}
	return newPriceList
}

///////// UTILS ///////////

func stdInput(scanner *bufio.Scanner, varCount int) []string {
	var inputParameters []string

	scanner.Scan()
	input := strings.Split(scanner.Text(), " ")
	for i := 0; i < varCount; i++ {
		inputParameters = append(inputParameters, input[i])
	}
	return inputParameters
}

func convertInputToInt(variables []string) []int {
	var convertedInput []int
	for _, value := range variables {
		convertedVar, _ := strconv.Atoi(value)
		convertedInput = append(convertedInput, convertedVar)
	}
	return convertedInput
}

func convertSliceToString(slice []int) string {
	var output string
	for _, value := range slice {
		output += strconv.Itoa(value) + " "
	}
	return output[:len(output)-1]
}


package main

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

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

func ChangeStringToDate(x string) (t time.Time, err error) {
	t, err = time.Parse("2006-01-02", x)
	return
}

func DiffrenceBetweenTwoDates(first, second time.Time) int64 {
	date := first
	date2 := second
	k := date.Unix() - date2.Unix()
	return k
}

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)

		// ARRAY := make([]int, n)
		// for i := 0; i < n; i++ {
		// 	fmt.Fscan(input, &ARRAY[i])

		// }

		// String := make([]byte, 0)
		// fmt.Fscan(input, &String)

		if n == 1 {
			fmt.Println(1)
		}
		if n > 1 {
			var B int64 = 3
			var modula int64 = 1000000007
			q := 2 * n

			for i := 4; i <= q; i++ {
				B = B * int64(i)
				B = B % modula
			}

			fmt.Println(B)
		}

	}

}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for j := 0; j < n; j++ {
		var s, i int64
		s = 1
		var a int64
		fmt.Scanf("%d\n", &a)
		for i = 3; i <= 2*a; i++ {
			s = s * i % 1000000007
		}
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
)

func main(){
	T := 0
	fmt.Scan(&T)
	MOD := int64(1000000007)
	for it:=0; it<T; it++ {
		n := int64(0)
		fmt.Scan(&n)
		n =n * 2
		res := MOD-MOD/2
		for i := int64(1); i<=n;i++{
			res = res * i % MOD
		}
		fmt.Println(res)
	}
}

package main

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

const MOD int64 = 1000000007

var n int

func main() {

	read := bufio.NewReader(os.Stdin)

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

	for i := 0; i < t; i++ {

		fmt.Fscan(read, &n)

		fmt.Println(solve())
	}
}

func solve() int64 {

	var ans int64 = 1

	for i := 3; i <= 2 * n; i++ {
		ans *= int64(i)

		ans %= MOD
	}

	return ans
}

package main

import "fmt"

var ans [100005]int64

func main() {
	var i int64 = 3
	ans[1] = 1
	ans[2] = 12
	for ; i <= 100000; i++ {
		k := i * 2
		n := ans[i-1]
		for j := k - 1; j <= k; j++ {
			n = n * j % 1000000007
		}
		ans[i] = n
	}
	n := 0
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		j := 0
		fmt.Scan(&j)
		fmt.Println(ans[j])
	}

}

package main

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

var iost *Iost

type Iost struct {
	Scanner *bufio.Scanner
	Writer  *bufio.Writer
}

func NewIost(fp io.Reader, wfp io.Writer) *Iost {
	const BufSize = 2000005
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, BufSize), BufSize)
	return &Iost{Scanner: scanner, Writer: bufio.NewWriter(wfp)}
}
func (i *Iost) Text() string {
	if !i.Scanner.Scan() {
		panic("scan failed")
	}
	return i.Scanner.Text()
}
func (i *Iost) Atoi(s string) int                 { x, _ := strconv.Atoi(s); return x }
func (i *Iost) GetNextInt() int                   { return i.Atoi(i.Text()) }
func (i *Iost) Atoi64(s string) int64             { x, _ := strconv.ParseInt(s, 10, 64); return x }
func (i *Iost) GetNextInt64() int64               { return i.Atoi64(i.Text()) }
func (i *Iost) Atof64(s string) float64           { x, _ := strconv.ParseFloat(s, 64); return x }
func (i *Iost) GetNextFloat64() float64           { return i.Atof64(i.Text()) }
func (i *Iost) Print(x ...interface{})            { fmt.Fprint(i.Writer, x...) }
func (i *Iost) Printf(s string, x ...interface{}) { fmt.Fprintf(i.Writer, s, x...) }
func (i *Iost) Println(x ...interface{})          { fmt.Fprintln(i.Writer, x...) }
func isLocal() bool                               { return os.Getenv("I") == "IronMan" }
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	if isLocal() {
		fp, _ = os.Open(os.Getenv("END_GAME"))
	}
	iost = NewIost(fp, wfp)
	defer func() {
		if isLocal() {
			iost.Println(recover())
		}
		iost.Writer.Flush()
	}()
	solve()
	for i := 0; isLocal() && i < 100; i++ {
		iost.Println("-----------------------------------")
		solve()
	}
}
func solve() {
	SetMod(Mod1000000007)
	t := iost.GetNextInt()
	for i := 0; i < t; i++ {
		testcase()
	}
}

func testcase() {
	n := iost.GetNextInt()
	mc := newModcom(n * 2)
	var ans Mint = mc.Facs[n*2].Div(2)
	iost.Println(ans)
}

// Mod constants.
const (
	Mod1000000007 = 1000000007
	Mod998244353  = 998244353
)

var (
	mod  Mint
	fmod func(Mint) Mint
)

// Mint treats the modular arithmetic
type Mint int64

// SetMod sets the mod. It must be called first.
func SetMod(newmod Mint) {
	switch newmod {
	case Mod1000000007:
		fmod = staticMod1000000007
	case Mod998244353:
		fmod = staticMod998244353
	default:
		mod = newmod
		fmod = dynamicMod
	}
}
func dynamicMod(m Mint) Mint {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}
func staticMod1000000007(m Mint) Mint {
	m %= Mod1000000007
	if m < 0 {
		return m + Mod1000000007
	}
	return m
}
func staticMod998244353(m Mint) Mint {
	m %= Mod998244353
	if m < 0 {
		return m + Mod998244353
	}
	return m
}

// Mod returns m % mod.
func (m Mint) Mod() Mint {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Mint) Inv() Mint {
	return m.Pow(Mint(0).Sub(2))
}

// Pow returns m^n
func (m Mint) Pow(n Mint) Mint {
	p := Mint(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Mint) Add(x Mint) Mint {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Mint) Sub(x Mint) Mint {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Mint) Mul(x Mint) Mint {
	return (m * x).Mod()
}

// Div returns m/x
func (m Mint) Div(x Mint) Mint {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Mint) AddAs(x Mint) *Mint {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Mint) SubAs(x Mint) *Mint {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Mint) MulAs(x Mint) *Mint {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Mint) DivAs(x Mint) *Mint {
	*m = m.Div(x)
	return m
}

type modcom struct {
	Facs, Invs []Mint
}

func newModcom(n int) modcom {
	facs := make([]Mint, n+1)
	invs := make([]Mint, n+1)
	facs[0] = 1
	for i := 0; i < n; i++ {
		facs[i+1] = facs[i].Mul(Mint(i + 1))
	}
	invs[n] = facs[n].Inv()
	for i := n - 1; i >= 0; i-- {
		invs[i] = invs[i+1].Mul(Mint(i + 1))
	}
	return modcom{
		Facs: facs,
		Invs: invs,
	}
}
func (mc *modcom) Choose(n, k int) Mint {
	if n < len(mc.Facs) {
		return mc.Facs[n].Mul(mc.Invs[k]).Mul(mc.Invs[n-k])
	}
	ans := mc.Invs[k]
	for k > 0 {
		ans.MulAs(Mint(n).Mod())
		n--
		k--
	}
	return ans
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for j := 0; j < n; j++ {
		s := 1
		var a int
		fmt.Scanf("%d\n", &a)
		for i := 3; i <= 2*a; i++ {
			s = s * i
			s = s % 1000000007
		}
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for j := 0; j < n; j++ {
		s := 1
		var a int
		fmt.Scanf("%d\n", &a)
		for i := 3; i <= 2*a; i++ {
			s = s * i % 1000000007
		}
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	for j := 0; j < n; j++ {
		s := 1
		var a int
		fmt.Scanf("%d\n", &a)
		for i := 3; i <= 2*a; i++ {
			s = s * i
			if s > 1000000007 {
				s = s % 1000000007
			}
		}
		fmt.Println(s)
	}
}

package main

import (
	"fmt"
)

func main(){
	T := 0
	fmt.Scan(&T)
	MOD := 1000000007
	for it:=0; it<T; it++ {
		n := 0
		fmt.Scan(&n)
		n =n * 2
		res := MOD-MOD/2
		for i := 1; i<=n;i++{
			res = res * i % MOD
		}
		fmt.Println(res)
	}
}

package main

import (
	"fmt"
)

func main(){
	T := 0
	fmt.Scan(&T)
	MOD := 1000000007
	for it:=0; it<T; it++ {
		n := 0
		fmt.Scan(&n)
		n =n * 2
		res := MOD-MOD/2
		for i := 1; i<=n;i++{
			res = res * i % MOD
		}
		println(res)
	}
}


// 353C
package main

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

func main() {
	var n int
	var a [100001]int
	var b string
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
	}
	fmt.Fscan(in, &b)
	c := 0
	ans := 0
	for i := 0; i < len(b); i++ {
		if b[i] == '0' {
			c += a[i]
		} else {
			if a[i] > c {
				ans = ans + a[i]
			} else {
				ans = ans + c
				c = a[i]
			}
		}
	}
	fmt.Print(ans)
}

package main
import(
	"fmt"
	"bufio"
	"os"
)

func main(){
	var n int
	var bin string
	fmt.Scan(&n)
	a:=make([]int,n)
	reader := bufio.NewReader(os.Stdin)
	for i:=0; i<n; i++{
		fmt.Fscan(reader,&a[i])
	}

	fmt.Fscan(reader,&bin)

	ans,sum := 0, 0
	for i:=0; i<len(bin) ; i++{
		if bin[i] == '0'{
			sum+=a[i]
		}else{
			if a[i]>sum {
				ans+=a[i]
			}else{
				ans+=sum
				sum=a[i]
			}
		}
	}
	fmt.Println(ans)
}

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

func main(){
	var n int
	var bin string
	fmt.Scan(&n)
	a:=make([]int,n)
	inp := bufio.NewScanner(os.Stdin)
	inp.Split(bufio.ScanWords)

	for i:=0; i<n; i++{
		inp.Scan()
		a[i], _ = strconv.Atoi(inp.Text())
	}

	inp.Scan()
	bin = inp.Text()

	ans,sum := 0, 0
	for i:=0; i<len(bin) ; i++{
		if bin[i] == '0'{
			sum+=a[i]
		}else{
			if a[i]>sum {
				ans+=a[i]
			}else{
				ans+=sum
				sum=a[i]
			}
		}
	}
	fmt.Println(ans)
}

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

func main(){
	var n int
	var bin string
	fmt.Scan(&n)
	a:=make([]int,n)
	inp := bufio.NewScanner(os.Stdin)
	inp.Split(bufio.ScanWords)

	for i:=0; i<n; i++{
		inp.Scan()
		a[i], _ = strconv.Atoi(inp.Text())
	}
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader,&bin)

	ans,sum := 0, 0
	for i:=0; i<len(bin) ; i++{
		if bin[i] == '0'{
			sum+=a[i]
		}else{
			if a[i]>sum {
				ans+=a[i]
			}else{
				ans+=sum
				sum=a[i]
			}
		}
	}
	fmt.Println(ans)
}

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

func main(){
	var n int
	var bin string
	fmt.Scan(&n)
	a:=make([]int,n)
	inp := bufio.NewScanner(os.Stdin)
	inp.Split(bufio.ScanWords)

	for i:=0; i<n; i++{
		inp.Scan()
		a[i], _ = strconv.Atoi(inp.Text())
	}
	fmt.Scan(&bin)
	ans,sum := 0, 0
	for i:=0; i<len(bin) ; i++{
		if bin[i] == '0'{
			sum+=a[i]
		}else{
			if a[i]>sum {
				ans+=a[i]
			}else{
				ans+=sum
				sum=a[i]
			}
		}
	}
	fmt.Println(ans)
}

// 353C
package main

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

func main() {
	var n int
	var a [100001]int
	var b string
	fmt.Scan(&n)
	in := bufio.NewReader(os.Stdin)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
	}
	fmt.Scan(&b)
	c := 0
	ans := 0
	for i := 0; i < len(b); i++ {
		if b[i] == '0' {
			c += a[i]
		} else {
			if a[i] > c {
				ans = ans + a[i]
			} else {
				ans = ans + c
				c = a[i]
			}
		}
	}
	fmt.Print(ans)
}


package main

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

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

	var n int
	Fscan(in, &n)
	water := make([]int, n)
	cp := make([]int, n)
	for i := range cp {
		Fscan(in, &cp[i])
	}

	fa := make([]int, n)
	for i := range fa {
		fa[i] = i
	}
	var find func(int) int
	find = func(x int) int {
		for fa[x] != x {
			fa[x] = fa[fa[x]]
			x = fa[x]
		}
		return x
	}
	merge := func(from, to int) { fa[find(from)] = find(to) }

	var m, op, idx, x int
	for Fscan(in, &m); m > 0; m-- {
		Fscan(in, &op, &idx)
		idx--
		if op == 1 {
			Fscan(in, &x)
			for idx = find(idx); ; idx = find(idx) {
				if water[idx]+x < cp[idx] {
					water[idx] += x
					break
				}
				x -= cp[idx] - water[idx]
				water[idx] = cp[idx]
				idx++
				if idx == n {
					break
				}
				merge(idx-1, idx)
			}
		} else {
			Fprintln(out, water[idx])
		}
	}
}

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

package main

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

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

	var n int
	Fscan(in, &n)
	water := make([]int, n)
	cp := make([]int, n)
	for i := range cp {
		Fscan(in, &cp[i])
	}

	fa := make([]int, n)
	for i := range fa {
		fa[i] = i
	}
	var find func(int) int
	find = func(i int) int {
		if fa[i] != i {
			fa[i] = find(fa[i])
		}
		return fa[i]
	}
	merge := func(from, to int) { fa[find(from)] = find(to) }

	var m, op, idx, x int
	for Fscan(in, &m); m > 0; m-- {
		Fscan(in, &op, &idx)
		idx--
		if op == 1 {
			Fscan(in, &x)
			for idx = find(idx); ; idx = find(idx) {
				if water[idx]+x < cp[idx] {
					water[idx] += x
					break
				}
				x -= cp[idx] - water[idx]
				water[idx] = cp[idx]
				idx++
				if idx == n {
					break
				}
				merge(idx-1, idx)
			}
		} else {
			Fprintln(out, water[idx])
		}
	}
}

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

package main

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

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

	var n int
	Fscan(in, &n)
	water := make([]int, n)
	cp := make([]int, n)
	for i := range cp {
		Fscan(in, &cp[i])
	}

	fa := make([]int, n)
	for i := range fa {
		fa[i] = i
	}
	var find func(int) int
	find = func(i int) int {
		if fa[i] != i {
			fa[i] = find(fa[i])
		}
		return fa[i]
	}
	merge := func(from, to int) { fa[find(from)] = find(to) }

	var m, op, idx, x int
	for Fscan(in, &m); m > 0; m-- {
		Fscan(in, &op, &idx)
		idx--
		if op == 1 {
			Fscan(in, &x)
			for idx = find(idx); ; idx = find(idx) {
				if water[idx]+x < cp[idx] {
					water[idx] += x
					break
				}
				x -= cp[idx] - water[idx]
				water[idx] = cp[idx]
				idx++
				if idx == n {
					break
				}
				merge(idx-1, idx)
			}
		} else {
			Fprintln(out, water[idx])
		}
	}
}

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


package main

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

type Node struct {
	max, min int64
}

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

func Min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func pushUp(a []Node, root int) {
	l := 2 * root
	r := l + 1
	a[root].max = Max(a[l].max, a[r].max)
	a[root].min = Min(a[l].min, a[r].min)
}

func build(a []Node, root, l, r int) {
	if l == r {
		a[root].max = s[l-1]
		a[root].min = s[l-1]

		return
	}

	mid := (l + r) / 2
	if l <= mid {
		build(a, 2*root, l, mid)
	}

	if r > mid {
		build(a, 2*root+1, mid+1, r)
	}

	pushUp(a, root)
}

func queryMax(a []Node, root, l, r, ll, rr int) int64 {
	//fmt.Println(root, l, r, ll, rr)

	if ll <= l && r <= rr {
		return a[root].max
	}

	var ans int64 = -(1 << 40)

	mid := (l + r) / 2

	if ll <= mid {
		ans = Max(ans, queryMax(a, 2*root, l, mid, ll, rr))
	}

	if mid < rr {
		ans = Max(ans, queryMax(a, 2*root+1, mid+1, r, ll, rr))
	}

	return ans
}

func queryMin(a []Node, root, l, r, ll, rr int) int64 {
	//fmt.Println(root, l, r, ll, rr)

	if ll <= l && r <= rr {
		return a[root].min
	}

	var ans int64 = 1 << 40

	mid := (l + r) / 2

	if ll <= mid {
		ans = Min(ans, queryMin(a, 2*root, l, mid, ll, rr))
	}

	if mid < rr {
		ans = Min(ans, queryMin(a, 2*root+1, mid+1, r, ll, rr))
	}

	return ans
}

var s []int64

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

	var n int
	var p, q, r int64

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &p, &q, &r)

	s = make([]int64, n)
	d := make([]Node, 4*(n+1))

	for i := 0; i < n; i++ {
		if i+1 != n {
			fmt.Fscanf(reader, "%d", &s[i])
		} else {
			fmt.Fscanf(reader, "%d\n", &s[i])
		}
	}

	build(d, 1, 1, n)

	var ans int64

	for i := 0; i < n; i++ {
		temp := q * s[i]

		if p > 0 {
			temp += (p * queryMax(d, 1, 1, n, 1, i+1))
		} else {
			temp += (p * queryMin(d, 1, 1, n, 1, i+1))
		}

		if r > 0 {
			temp += (r * queryMax(d, 1, 1, n, i+1, n))
		} else {
			temp += (r * queryMin(d, 1, 1, n, i+1, n))
		}

		if i == 0 {
			ans = temp
		} else {
			ans = Max(ans, temp)
		}
	}

	fmt.Println(ans)
}

package main

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

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

	return y
}

func readInt64(r *bufio.Reader, delime byte) (n int64) {
	var i, j int
	for {
		s, err := r.ReadSlice(delime)

		if len(s) > 0 && s[len(s)-1] == delime {
			s = s[:len(s)-1]
		}

		if len(s) > 0 && s[len(s)-1] == '\r' {
			s = s[:len(s)-1]
		}

		for i = 0; i < len(s) && s[i] == ' '; i++ {

		}

		for j = len(s) - 1; j >= i && s[j] == ' '; j-- {

		}

		if j >= i {
			n, _ = strconv.ParseInt(string(s[i:j+1]), 10, 64)
			return
		}

		if j < i && err == nil {
			continue
		}

		if j < i && err != nil {
			return
		}
	}

	return
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1<<20)

	var n int
	var p, q, r, t int64
	var dp [3]int64

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &p, &q, &r)

	for i := 0; i < n; i++ {
		if i+1 != n {
			t = readInt64(reader, ' ')
		} else {
			t = readInt64(reader, '\n')
		}

		if i != 0 {
			dp[0] = max(dp[0], t*p)
			dp[1] = max(dp[1], dp[0]+t*q)
			dp[2] = max(dp[2], dp[1]+t*r)
		} else {
			dp[0] = t * p
			dp[1] = t*q + dp[0]
			dp[2] = t*r + dp[1]
		}
	}

	fmt.Println(dp[2])
}

package main

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

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

	return y
}

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

	var n int
	var p, q, r, t int64
	var dp [3]int64

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &p, &q, &r)

	for i := 0; i < n; i++ {
		if i+1 != n {
			fmt.Fscanf(reader, "%d", &t)
		} else {
			fmt.Fscanf(reader, "%d\n", &t)
		}

		if i != 0 {
			dp[0] = max(dp[0], t*p)
			dp[1] = max(dp[1], dp[0]+t*q)
			dp[2] = max(dp[2], dp[1]+t*r)
		} else {
			dp[0] = t * p
			dp[1] = t*q + dp[0]
			dp[2] = t*r + dp[1]
		}
	}

	fmt.Println(dp[2])
}

package main

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

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

	return y
}

var a [3][]int64

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

	var n int
	var p, q, r int64

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &p, &q, &r)
	a[0] = make([]int64, n)
	a[1] = make([]int64, n)
	a[2] = make([]int64, n)
	for i := 0; i < n; i++ {
		if i+1 != n {
			fmt.Fscanf(reader, "%d", &a[0][i])
		} else {
			fmt.Fscanf(reader, "%d\n", &a[0][i])
		}
	}

	a[1][0] = a[0][0] * p
	for i := 1; i < n; i++ {
		a[1][i] = max(a[0][i]*p, a[1][i-1])
	}

	a[2][n-1] = a[0][n-1] * r
	for i := n - 2; i >= 0; i-- {
		a[2][i] = max(a[0][i]*r, a[2][i+1])
	}

	var ans int64 = a[1][0] + a[0][0]*q + a[2][0]
	for i := 1; i < n; i++ {
		ans = max(ans, a[1][i]+a[0][i]*q+a[2][i])
	}

	fmt.Println(ans)
}

package main

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

var in = bufio.NewScanner(os.Stdin)

func readInt() int64 {
	if !in.Scan() {
		panic(in.Err())
	}
	res := int64(0)
	mul := int64(1)
	for _, b := range in.Bytes() {
		if b == '-' {
			mul *= -1
			continue
		}
		res = res*10 + int64(b-'0')
	}
	return mul * res
}

func main() {
	in.Split(bufio.ScanWords)
	n := readInt()
	p := readInt()
	q := readInt()
	r := readInt()
	a := make([]int64, n)
	for i := range a {
		a[i] = readInt()
	}

	bestP := make([]int64, n)
	bestP[0] = p * a[0]
	for i := int64(1); i < n; i++ {
		bestP[i] = bestP[i-1]
		if c := a[i] * p; bestP[i] < c {
			bestP[i] = c
		}
	}

	bestR := make([]int64, n)
	bestR[n-1] = a[n-1] * r
	for i := n - 2; i >= 0; i-- {
		bestR[i] = bestR[i+1]
		if c := a[i] * r; bestR[i] < c {
			bestR[i] = c
		}
	}

	ans := a[0] * (p + q + r)
	for i := range a {
		if c := a[i]*q + bestP[i] + bestR[i]; ans < c {
			ans = c
		}
	}
	fmt.Println(ans)
}

// B. Marvolo Gaunt's Ring
/*
Professor Dumbledore is helping Harry destroy the Horcruxes. He went to Gaunt Shack as he suspected a Horcrux to be present there. He saw Marvolo Gaunt's Ring and identified it as a Horcrux. Although he destroyed it, he is still affected by its curse. Professor Snape is helping Dumbledore remove the curse. For this, he wants to give Dumbledore exactly x drops of the potion he made.

Value of x is calculated as maximum of p·a i + q·a j + r·a k for given p, q, r and array a 1, a 2, ... a n such that 1 ≤ i ≤ j ≤ k ≤ n. Help Snape find the value of x. Do note that the value of x may be negative.

Input
First line of input contains 4 integers n, p, q, r ( - 109 ≤ p, q, r ≤ 109, 1 ≤ n ≤ 105).

Next line of input contains n space separated integers a 1, a 2, ... a n ( - 109 ≤ a i ≤ 109).

Output
Output a single integer the maximum value of p·a i + q·a j + r·a k that can be obtained provided 1 ≤ i ≤ j ≤ k ≤ n.

Examples
Input
5 1 2 3
1 2 3 4 5

Output
30

Input
5 1 2 -3
-1 -2 -3 -4 -5

Output
12

Note
In the first sample case, we can take i = j = k = 5, thus making the answer as 1·5 + 2·5 + 3·5 = 30.

In second sample case, selecting i = j = 1 and k = 5 gives the answer 12.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	arr1 := strings.Split(strings.TrimSpace(input1), " ")

	n, _ := strconv.ParseInt(arr1[0], 10, 64)
	p, _ := strconv.ParseInt(arr1[1], 10, 64)
	q, _ := strconv.ParseInt(arr1[2], 10, 64)
	r, _ := strconv.ParseInt(arr1[3], 10, 64)

	input2, _ := reader.ReadString('\n')
	aArr := strings.Split(strings.TrimSpace(input2), " ")

	var d1, d2, d3 int64 = math.MinInt64, math.MinInt64, math.MinInt64
	var i int64 = 0
	for ; i < n; i++ {
		a, _ := strconv.ParseInt(aArr[i], 10, 64)

		if d1 < p*a {
			d1 = p * a
		}
		if d2 < q*a+d1 {
			d2 = q*a + d1
		}
		if d3 < r*a+d2 {
			d3 = r*a + d2
		}
	}
	fmt.Print(d3)
}

package main

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

func solve() {
	n := readInt()
	v := make([]int64, 3)
	for i := 0; i < 3; i++ {
		v[i] = readInt64()
	}
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = readInt64()
	}
	suffix := make([]int64, n)
	for j := n - 1; j >= 0; j-- {
		if j == n-1 {
			suffix[j] = v[2] * a[j]
		} else {
			suffix[j] = max(suffix[j+1], v[2]*a[j])
		}
	}
	bestFirst := int64(math.MinInt64)
	res := int64(math.MinInt64)
	for i := 0; i < n; i++ {
		bestFirst = max(bestFirst, v[0]*a[i])
		best := bestFirst + (v[1] * a[i]) + suffix[i]
		if best > res {
			res = best
		}
	}
	fmt.Println(res)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

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

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

	return y
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1<<20)

	var n int
	var p, q, r, t int64
	var dp [3]int64

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &p, &q, &r)

	for i := 0; i < n; i++ {
		if i+1 != n {
			fmt.Fscanf(reader, "%d", &t)
		} else {
			fmt.Fscanf(reader, "%d\n", &t)
		}

		if i != 0 {
			dp[0] = max(dp[0], t*p)
			dp[1] = max(dp[1], dp[0]+t*q)
			dp[2] = max(dp[2], dp[1]+t*r)
		} else {
			dp[0] = t * p
			dp[1] = t*q + dp[0]
			dp[2] = t*r + dp[1]
		}
	}

	fmt.Println(dp[2])
}

// B. Marvolo Gaunt's Ring
/*
Professor Dumbledore is helping Harry destroy the Horcruxes. He went to Gaunt Shack as he suspected a Horcrux to be present there. He saw Marvolo Gaunt's Ring and identified it as a Horcrux. Although he destroyed it, he is still affected by its curse. Professor Snape is helping Dumbledore remove the curse. For this, he wants to give Dumbledore exactly x drops of the potion he made.

Value of x is calculated as maximum of p·a i + q·a j + r·a k for given p, q, r and array a 1, a 2, ... a n such that 1 ≤ i ≤ j ≤ k ≤ n. Help Snape find the value of x. Do note that the value of x may be negative.

Input
First line of input contains 4 integers n, p, q, r ( - 109 ≤ p, q, r ≤ 109, 1 ≤ n ≤ 105).

Next line of input contains n space separated integers a 1, a 2, ... a n ( - 109 ≤ a i ≤ 109).

Output
Output a single integer the maximum value of p·a i + q·a j + r·a k that can be obtained provided 1 ≤ i ≤ j ≤ k ≤ n.

Examples
Input
5 1 2 3
1 2 3 4 5

Output
30

Input
5 1 2 -3
-1 -2 -3 -4 -5

Output
12

Note
In the first sample case, we can take i = j = k = 5, thus making the answer as 1·5 + 2·5 + 3·5 = 30.

In second sample case, selecting i = j = 1 and k = 5 gives the answer 12.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	arr1 := strings.Split(strings.TrimSpace(input1), " ")

	n, _ := strconv.ParseInt(arr1[0], 10, 64)
	p, _ := strconv.ParseInt(arr1[1], 10, 64)
	q, _ := strconv.ParseInt(arr1[2], 10, 64)
	r, _ := strconv.ParseInt(arr1[3], 10, 64)

	input2, _ := reader.ReadString('\n')
	aArr := strings.Split(strings.TrimSpace(input2), " ")

	var d1, d2, d3 int64 = math.MinInt64, math.MinInt64, math.MinInt64
	var i int64 = 0
	for ; i < n; i++ {
		a, _ := strconv.ParseInt(aArr[i], 10, 64)

		if d1 < p*a {
			d1 = p * a
		}
		if d2 < q*a {
			d2 = q * a
		}
		if d3 < r*a {
			d3 = r * a
		}
	}
	fmt.Print(d1 + d2 + d3)
}

package main

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

func solve() {
	n := readInt()
	v := make([]int64, 3)
	for i := 0; i < 3; i++ {
		v[i] = readInt64()
	}
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = readInt64()
	}
	prefix := make([][]int64, 3)
	for i := 0; i < 3; i++ {
		prefix[i] = make([]int64, n)
		for j := n - 1; j >= 0; j-- {
			if j == n-1 {
				prefix[i][j] = v[i] * a[j]
			} else {
				prefix[i][j] = max(prefix[i][j+1], v[i]*a[j])
			}
		}
	}
	res := int64(0)
	for i := 0; i < n; i++ {
		res = max(res, prefix[0][i]+prefix[1][i]+prefix[2][i])
	}
	fmt.Println(res)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

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

func solve() {
	n := readInt()
	p := readInt()
	q := readInt()
	r := readInt()
	v := []int{p, q, r}
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()
	}
	res := int64(0)
	for i := 0; i < 3; i++ {
		c := int64(v[i])
		hi := int64(math.MinInt64)
		for j := 0; j < n; j++ {
			tmp := c * int64(a[j])
			if tmp > hi {
				hi = tmp
			}
		}
		res += hi
	}
	fmt.Println(res)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

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

func solve() {
	n := readInt()
	v := make([]int64, 3)
	for i := 0; i < 3; i++ {
		v[i] = readInt64()
	}
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = readInt64()
	}
	res := int64(0)
	for i := 0; i < 3; i++ {
		best := v[i] * a[0]
		for j := 1; j < n; j++ {
			tmp := v[i] * a[j]
			if tmp > best {
				best = tmp
			}
		}
		res += best
	}
	fmt.Println(res)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

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

func solve() {
	n := readInt()
	p := readInt()
	q := readInt()
	r := readInt()
	v := []int{p, q, r}
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = readInt()
	}
	res := int64(0)
	for i := 0; i < 3; i++ {
		c := int64(v[i])
		best := c * int64(a[0])
		for j := 1; j < n; j++ {
			tmp := c * int64(a[j])
			if tmp > best {
				best = tmp
			}
		}
		res += best
	}
	fmt.Println(res)
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

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

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

	return y
}

func readInt64(r *bufio.Reader, delime byte) (n int64) {
	var i, j int
	for {
		s, err := r.ReadSlice(delime)

		fmt.Println("read", s, err)
		if len(s) > 0 && s[len(s)-1] == delime {
			s = s[:len(s)-1]
		}
		for i = 0; i < len(s) && s[i] == ' '; i++ {

		}

		for j = len(s) - 1; j >= i && s[j] == ' '; j-- {

		}

		if j >= i {
			n, _ = strconv.ParseInt(string(s[i:j+1]), 10, 64)
			return
		}

		if j < i && err == nil {
			continue
		}

		if j < i && err != nil {
			return
		}
	}

	return
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1<<20)

	var n int
	var p, q, r, t int64
	var dp [3]int64

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &p, &q, &r)

	for i := 0; i < n; i++ {
		if i+1 != n {
			t = readInt64(reader, ' ')
		} else {
			t = readInt64(reader, '\n')
		}
		fmt.Println("cacl", t)
		if i != 0 {
			dp[0] = max(dp[0], t*p)
			dp[1] = max(dp[1], dp[0]+t*q)
			dp[2] = max(dp[2], dp[1]+t*r)
		} else {
			dp[0] = t * p
			dp[1] = t*q + dp[0]
			dp[2] = t*r + dp[1]
		}
	}

	fmt.Println(dp[2])
}

package main

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

type Node struct {
	max, min int64
}

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

func Min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func pushUp(a []Node, root int) {
	l := 2 * root
	r := l + 1
	a[root].max = Max(a[l].max, a[r].max)
	a[root].min = Min(a[l].min, a[r].min)
}

func build(a []Node, root, l, r int) {
	if l == r {
		a[root].max = s[l-1]
		a[root].min = s[l-1]

		return
	}

	mid := (l + r) / 2
	if l <= mid {
		build(a, 2*root, l, mid)
	}

	if r > mid {
		build(a, 2*root+1, mid+1, r)
	}

	pushUp(a, root)
}

func queryMax(a []Node, root, l, r, ll, rr int) int64 {
	//fmt.Println(root, l, r, ll, rr)

	if ll <= l && r <= rr {
		return a[root].max
	}

	var ans int64

	mid := (l + r) / 2

	if ll <= mid {
		ans = queryMax(a, 2*root, l, mid, ll, rr)
	}

	if mid < rr {
		ans = Max(ans, queryMax(a, 2*root+1, mid+1, r, ll, rr))
	}

	return ans
}

func queryMin(a []Node, root, l, r, ll, rr int) int64 {
	//fmt.Println(root, l, r, ll, rr)

	if ll <= l && r <= rr {
		return a[root].min
	}

	var ans int64

	mid := (l + r) / 2

	if ll <= mid {
		ans = queryMin(a, 2*root, l, mid, ll, rr)
	}

	if mid < rr {
		ans = Min(ans, queryMin(a, 2*root+1, mid+1, r, ll, rr))
	}

	return ans
}

var s []int64

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

	var n int
	var p, q, r int64

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &p, &q, &r)

	s = make([]int64, n)
	d := make([]Node, 4*(n+1))

	for i := 0; i < n; i++ {
		if i+1 != n {
			fmt.Fscanf(reader, "%d", &s[i])
		} else {
			fmt.Fscanf(reader, "%d\n", &s[i])
		}
	}

	build(d, 1, 1, n)

	var ans int64

	for i := 0; i < n; i++ {
		temp := q * s[i]

		if p > 0 {
			temp += (p * queryMax(d, 1, 1, n, 1, i+1))
		} else {
			temp += (p * queryMin(d, 1, 1, n, 1, i+1))
		}

		if r > 0 {
			temp += (r * queryMax(d, 1, 1, n, i+1, n))
		} else {
			temp += (r * queryMin(d, 1, 1, n, i+1, n))
		}

		if i == 0 {
			ans = temp
		} else {
			ans = Max(ans, temp)
		}
	}

	fmt.Println(ans)
}

package main

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

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

	return y
}

func readInt64(r *bufio.Reader, delime byte) (n int64) {
	var i, j int
	for {
		s, err := r.ReadSlice(delime)
		if len(s) > 0 && s[len(s)-1] == delime {
			s = s[:len(s)-1]
		}
		for i = 0; i < len(s) && s[i] == ' '; i++ {

		}

		for j = len(s) - 1; j >= i && s[j] == ' '; j-- {

		}

		if j >= i {
			n, _ = strconv.ParseInt(string(s[i:j+1]), 10, 64)
			return
		}

		if j < i && err == nil {
			continue
		}

		if j < i && err != nil {
			return
		}
	}

	return
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1<<20)

	var n int
	var p, q, r, t int64
	var dp [3]int64

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &p, &q, &r)

	for i := 0; i < n; i++ {
		if i+1 != n {
			t = readInt64(reader, ' ')
		} else {
			t = readInt64(reader, '\n')
		}

		if i != 0 {
			dp[0] = max(dp[0], t*p)
			dp[1] = max(dp[1], dp[0]+t*q)
			dp[2] = max(dp[2], dp[1]+t*r)
		} else {
			dp[0] = t * p
			dp[1] = t*q + dp[0]
			dp[2] = t*r + dp[1]
		}
	}

	fmt.Println(dp[2])
}

package main

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

type Node struct {
	sum [3]int64
}

func pushUp(a []Node, root int) {
	a[root].sum[0] = a[2*root].sum[0]
	a[root].sum[1] = a[2*root].sum[1]
	a[root].sum[2] = a[2*root].sum[2]

	for i := 2; i >= 0; i-- {
		if a[2*root+1].sum[i] >= a[2*root].sum[i] {
			a[root].sum[i] = a[2*root+1].sum[i]
		} else {
			break
		}
	}
}

var pp, qq, rr int64

func build(a []Node, root, l, r int) {
	if l == r {
		a[root].sum[0] = pp * s[l-1]
		a[root].sum[1] = qq * s[l-1]
		a[root].sum[2] = rr * s[l-1]

		return
	}

	mid := (l + r) / 2
	if l <= mid {
		build(a, 2*root, l, mid)
	}

	if r > mid {
		build(a, 2*root+1, mid+1, r)
	}

	pushUp(a, root)
}

var s []int64

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

	var n int

	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &pp, &qq, &rr)

	s = make([]int64, n)
	d := make([]Node, 4*(n+1))

	for i := 0; i < n; i++ {
		if i+1 != n {
			fmt.Fscanf(reader, "%d", &s[i])
		} else {
			fmt.Fscanf(reader, "%d\n", &s[i])
		}
	}

	build(d, 1, 1, n)

	fmt.Println(d[1].sum[0] + d[1].sum[1] + d[1].sum[2])
}


package main

import (
    "fmt"

)

func main() {
    tt := 0
    fmt.Scan(&tt)
    var s string
    for i := 1; i <= tt; i++ {
        sz := 0
        fmt.Scan(&sz)

        fmt.Scan(&s)
        arr := [26]int{0,}
        for j := range s {
            arr[s[j] - 'A']++
        }
        ans := 0
        for j := 0; j < 26; j++ {
            if arr[j] > 0 {
                ans += 2
                arr[j]--
                ans += arr[j]
            }
        }

        fmt.Println(ans)
    }

}

package main

import "fmt"

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

	for i := 0; i < t; i++ {
		var n int
		var s string
		m := make(map[byte]struct{})
		var cnt int
		fmt.Scanf("%d\n", &n)
		fmt.Scanf("%s\n", &s)
		for j := 0; j < n; j++ {
			if _, exist := m[s[j]]; !exist {
			    m[s[j]] = struct{}{}
				cnt += 2
			} else {
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

package main

import . "fmt"

func main() {
	var (
		t, n, cnt int
		s, chr    string
	)
	Scan(&t)
	for i := 0; i < t; i++ {
		cnt = 0
		m := make(map[string]int)
		Scan(&n)
		Scan(&s)
		for j := 0; j < n; j++ {
			chr = string(s[j])
			if m[chr] == 0 {
				m[chr] = 1
				cnt += 2
			} else {
				cnt += 1
			}
		}
		Println(cnt)
	}
}

package main

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

func main() {
	var (
		t   int
		n   int
		sln []int
	)
	fmt.Scanf("%d\n", &t)
	scanner := bufio.NewScanner(os.Stdin)
	for i := 0; i < t; i++ {
		sln = nil
		scanner.Scan()
		n, _ = strconv.Atoi(scanner.Text())
		scanner.Scan()
		for _, runeValue := range scanner.Text() {
			sln = append(sln, int(runeValue))
		}
		su := CountValue(sln)
		fmt.Println(n + len(su))
	}
}

func CountValue(arr []int) (res map[int]int) {
	dict := make(map[int]int)
	for _, num := range arr {
		dict[num] = dict[num] + 1
	}
	res = dict
	return
}

package main

import "fmt"

func main() {
	var t, n int
	fmt.Scan(&t)
	for t > 0 {
		t--
		var s string
		var r int
		fmt.Scan(&n)
		m := make(map[rune]int)
		fmt.Scan(&s)
		for _, c := range s {
			m[c]++
			r++
		}
		r += len(m)
		fmt.Println(r)
	}
}

package main
import(
    "fmt"
)
func main() {
	var t int
	fmt.Scan(&t)
	for i:=0;i<t;i++{
		var n int
		fmt.Scan(&n)
		var word string
		fmt.Scan(&word)
		var list []byte
		for j:=0;j<len(word);j++{
			tally:=0
			for k:=0;k<len(list);k++{
				if list[k] == word[j] {
					tally++
				}
			}
			if tally == 0 {
				list = append(list,word[j])
			}
		}
		// x:= distinct characters in word
		fmt.Println(n+len(list))
	}
}

package main

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

var in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)

func solve() {
	var let [26]rune
	_ = _readInt()
	s := _readStr()
	cnt := 0
	for _, r := range s {
		r -= 'A'
		if let[r] == 0 {
			let[r]++
			cnt++
		}
	}
	_print(len(s) + cnt)
}

func main() {
	defer out.Flush()
	var t int
	for fmt.Fscanln(in, &t); t > 0; t-- {
		solve()
	}
}

// ====
func _readInt() int {
	var x int
	fmt.Fscan(in, &x)
	return x
}
func _readStr() string {
	var x string
	fmt.Fscan(in, &x)
	return x
}
func _readArr() (int, []int) {
	var n int
	fmt.Fscan(in, &n)
	var v = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &v[i])
	}
	return n, v
}
func _print(x ...any) {
	fmt.Fprintln(out, x...)
}
func _max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func _min(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func _abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func _sortStr(x string) string {
	r := []rune(x)
	sort.Slice(r, func(i, j int) bool {
		return r[i] < r[j]
	})
	return string(r)
}
func _reverseInts(x []int) {
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
}
func _reverseStr(s string) string {
	x := []rune(s)
	n := len(x)
	for i := 0; i < n/2; i++ {
		x[i], x[n-1-i] = x[n-1-i], x[i]
	}
	return string(x)
}

package main

import (
	"fmt"
)

func main() {
	var str string
	var T int
	fmt.Scan(&T)
	for Case := 1; Case <= T; Case++ {
		var n int
		fmt.Scan(&n)
		fmt.Scan(&str)
		var table[256] int
		var ans int = 0
		for i := 0; i < n; i++ {
			id := int(str[i])
			if table[id] == 0 {
				ans += 2
			} else {
				ans += 1
			}
			table[id]++
		}
		fmt.Println(ans)
	}
}

// https://codeforces.com/problemset/problem/1703/B

// 1703B - ICPC Balloons

// In an ICPC contest, balloons are distributed as follows:
//  • Whenever a team solves a problem, that team gets a balloon.
//  • The first team to solve a problem gets an additional balloon.
// A contest has 26 problems, labelled A, B, C, ..., Z. You are given the order of solved problems in the contest, denoted as a string s, where the i-th character indicates that the problem si has been solved by some team. No team will solve the same problem twice.
// Determine the total number of balloons that the teams received. Note that some problems may be solved by none of the teams.

// Input
// The first line of the input contains an integer t (1≤t≤100) — the number of testcases.
// The first line of each test case contains an integer n (1≤n≤50) — the length of the string.
// The second line of each test case contains a string s of length n consisting of uppercase English letters, denoting the order of solved problems.

// Output
// For each test case, output a single integer — the total number of balloons that the teams received.

// Example
// input
// 6
// 3
// ABA
// 1
// A
// 3
// ORZ
// 5
// BAAAA
// 4
// BKPT
// 10
// CODEFORCES
// output
// 5
// 2
// 6
// 7
// 8
// 17

// Note

// In the first test case, 5 balloons are given out:
//  • Problem A is solved. That team receives 2 balloons: one because they solved the problem, an an additional one because they are the first team to solve problem A.
//  • Problem B is solved. That team receives 2 balloons: one because they solved the problem, an an additional one because they are the first team to solve problem B.
//  • Problem A is solved. That team receives only 1 balloon, because they solved the problem. Note that they don't get an additional balloon because they are not the first team to solve problem A.
// The total number of balloons given out is 2+2+1=5.
// In the second test case, there is only one problem solved. The team who solved it receives 2 balloons: one because they solved the problem, an an additional one because they are the first team to solve problem A.

// Tutorial

// Let's keep an array a of booleans, ai denoting whether or not some team has solved the ith problem already. Now we can iterate through the string from left to right and keep a running total tot. If ai is true (the i-th problem has already been solved), increase tot by 1; otherwise, increase tot by 2 and set ai to true.
// The time complexity is O(n).
// Bonus: the answer is always n+number of distinct characters in s. Can you see why?

package main

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

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	var c int
	var t, n, tot, i uint
	var s string
	var a [26]bool

	for c, _ = fmt.Fscan(reader, &t); c == 1; c, _ = fmt.Fscan(reader, &t) {
		for ; t > 0; t-- {
			fmt.Fscan(reader, &n, &s)
			tot = 0

			for i = 0; i < 26; i++ {
				a[i] = false
			}

			for i = 0; i < n; i++ {
				if a[s[i]-'A'] {
					tot++
				} else {
					tot += 2
					a[s[i]-'A'] = true
				}
			}

			fmt.Fprintln(writer, tot)
		}
	}

	writer.Flush()
}

package main

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

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

	var buf bytes.Buffer

	tc := readNum(reader)

	for tc > 0 {
		tc--
		readNum(reader)
		word := readString(reader)
		res := solve(word)
		buf.WriteString(fmt.Sprintf("%d\n", res))
	}

	fmt.Print(buf.String())
}

func readString(reader *bufio.Reader) string {
	s, _ := reader.ReadString('\n')
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' || s[i] == '\r' {
			return s[:i]
		}
	}
	return s
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(s string) int {
	first := make([]bool, 26)
	var res int
	for i := 0; i < len(s); i++ {
		x := int(s[i] - 'A')
		res++
		if !first[x] {
			res++
			first[x] = true
		}
	}

	return res
}

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 i := 0; i < t; i++ {
		var n, cnt int
		var s string
		var arr [26]bool
		cnt = 0
		fmt.Fscan(in, &n)
		fmt.Fscan(in, &s)
		for i := 0; i < n; i++ {
			if arr[s[i]-65] {
				cnt++
			} else {
				arr[s[i]-65] = true
				cnt += 2
			}
		}
		fmt.Fprintln(out, cnt)
	}

}

package main

import "fmt"

func main() {
	var t int
	fmt.Scanln(&t)

	for ; t > 0; t-- {
		var n int
		fmt.Scanln(&n)
		var s string
		fmt.Scanln(&s)

		var m = make(map[rune]int)
		for _, v := range s {
			m[v]++
		}

		var sum = len(m)
		for _, v := range m {
			sum += v
		}

		fmt.Println(sum)
	}
}

package main

import (
	"fmt"
)

func main() {
	var s string
	var n, m int
	fmt.Scan(&n)
	for n>0 {
		fmt.Scan(&m,&s)
		var t [128]int
		sum:=0
		for _,c:=range s{
			// fmt.Print(c,' ')
			if t[c]==0 {sum++}
			t[c]=1
		}
		fmt.Println(sum+len(s))
		n--
	}

}

package main

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

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

func solve(n int, s string) int {
	var solved = make(map[byte]int)
	for i := 0; i < n; i++ {
		solved[s[i]] = solved[s[i]] + 1
	}
	var result int
	for _, x := range solved {
		result += x + 1
	}
	return result
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &n, &s)
		fmt.Println(solve(n, s))
	}
}

package main

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

const mod = 998244353
const mx = int64(1e9 + 7)

func solve(in *bufio.Reader, out *bufio.Writer) {
	defer out.Flush()
	var n int
	fmt.Fscan(in, &n)
	var s string
	fmt.Fscan(in, &s)
	arr := make([]int, 26)
	for i := 0; i < n; i++ {
		idx := s[i] - 'A'
		if arr[idx] == 0 {
			arr[idx] += 2
		} else {
			arr[idx]++
		}
	}
	sum := 0
	for _, v := range arr {
		sum += v
	}
	fmt.Fprintln(out, sum)
}

func abs(a int64) int64 {
	if a > 0 {
		return a
	}
	return -a
}
func sum(a, b int64) int64 {
	return (b + a) * (b - a + 1) / 2
}

func max(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func gcd(a, b int) int {
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func main() {
	stdin := os.Stdin
	stdout := os.Stdout
	in := bufio.NewReader(stdin)
	out := bufio.NewWriter(stdout)
	n := 1
	fmt.Fscan(in, &n)
	for i := 0; i < n; i++ {
		solve(in, out)
	}
}

package main

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

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	// 读入一行数据
	// s, _ := in.ReadString('\n')
	out := bufio.NewWriter(_w)
	defer out.Flush()
	solve := func() {
		var n int
		fmt.Fscan(in, &n)
		var s string
		fmt.Fscan(in, &s)
		mp := make(map[byte]int)
		byteStr := []byte(s)
		var res int
		for i := 0; i < len(byteStr); i++ {
			if _, ok := mp[byteStr[i]]; ok {
				res += 1
			}else{
				res += 2
			}
			mp[byteStr[i]]++
		}
		fmt.Fprintln(out, res)
	}

	var t int
	fmt.Fscan(in, &t)
	for i := 0; i < t; i++ {
		solve()
	}
}
func main() {
	run(os.Stdin, os.Stdout)
}

package main

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

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

func (in *CF1703B) 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 *CF1703B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

/**
Run solve the problem CF1703B
Date: 14/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1703/B
Problem: CF1703B
**/
func (in *CF1703B) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		mapa := make(map[uint8]bool)

		str := in.NextString()
		ans := 0
		for i := 0; i < n; i++ {
			_, e := mapa[str[i]]

			if !e {
				mapa[str[i]] =true
				ans++
			}
			ans++
		}
		fmt.Println(ans)
	}

}

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

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

package main

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

var rr = bufio.NewReader(os.Stdin)
var ww = bufio.NewWriter(os.Stdout)

func slove() {
	var n int
	fmt.Fscan(rr, &n)
	var s string
	fmt.Fscan(rr, &s)
	cnt := map[byte]bool{}
	ans := 0
	for i := range s {
		if cnt[s[i]] {
			ans++
		} else {
			ans+=2
		}
		cnt[s[i]] = true
	}
	fmt.Fprintln(ww, ans)
}

func main() {
	defer ww.Flush()
	var n int
	fmt.Fscan(rr, &n)
	for i:=1;i<=n;i++ {
		slove()
	}
}

package main

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

// https://space.bilibili.com/206214
func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, n int
	var s string
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		Fscan(in, &s)
		cnt := map[rune]int{}
		for _, v := range s {
			cnt[v]++
		}
		Fprintln(out, n+len(cnt))
	}
}

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

package main

import (
	"fmt"
	"os"
)

func setOs() {
	//os.Stdin, err = os.OpenFile("input.txt", os.RDONLY|os.O_CREATE, 0666)
	//os.Stdout, err = os.OpenFile("output.txt", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
	_, err := os.Stat("input.txt")
	if err == nil {
		os.Stdin, _ = os.OpenFile("input.txt", os.O_RDWR|os.O_CREATE, 0666)
	}
}

func main() {
	setOs()
	var t int
	fmt.Scan(&t)
	for i := 1; i <= t; i++ {
		var n int
		var s string
		res := 0
		fmt.Scan(&n)
		fmt.Scan(&s)
		m := make(map[byte]bool)
		for i := 0; i < len(s); i++ {
			if m[s[i]] == true {
				res++
			} else {
				res += 2
			}
			m[s[i]] = true
		}

		fmt.Println(res)

	}
}

package main

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

func main() {
	var (
		t     int
		n     int
		input string
	)

	reader := bufio.NewReader(os.Stdin)
	fmt.Fscanf(reader, "%d\n", &t)

	for i := 0; i < t; i++ {
		fmt.Fscanf(reader, "%d\n", &n)
		fmt.Fscanf(reader, "%s\n", &input)
		distinct := solve(input, n)
		fmt.Println(2*distinct + (n - distinct))
	}
}

func solve(str string, n int) (count int) {
	temp := strings.Split(str, "")
	sort.Strings(temp)

	for i := 0; i < n; i++ {
		for i < n-1 && temp[i] == temp[i+1] {
			i++
		}
		count++
	}
	return
}

package main

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

func check(s string) int {
	set := map[rune]struct{}{}
	c := 0
	for _, ch := range s {
		if _, ok := set[ch]; !ok {
			c+=1
			set[ch] = struct{}{}
		}
		c++
	}
	return c
}

func main() {
	// f, _ := os.Open("input.txt")
	t := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(t, &n)
	for i := 0; i < n; i++ {
		var m int
		fmt.Fscan(t, &m)
		var s string
		fmt.Fscan(t, &s)
		fmt.Println(check(s))
	}
}

package main

import "fmt"

func main() {
    t := 0;
    fmt.Scanf("%d\n", &t);

    for i := 0; i < t; i++ {
        balloons := 0;
        solved := map[byte]bool{};

        n := 0;
        s := "";
        fmt.Scanf("%d\n%s\n", &n, &s);

        for j := 0; j < len(s); j++ {
            problem := s[j];
            balloons++;
            if _, ok := solved[problem]; !ok {
                balloons++;
                solved[problem] = true;
            }
        }

        fmt.Printf("%d\n", balloons);
    }
}

//package main
//
//import (
//	"context"
//	"gerRpc"
//	"gerRpc/xclient"
//	"log"
//	"sync"
//
//	"net"
//	"time"
//)
//
////
////func startServer(addr chan string)  {
////	l, err := net.Listen("tcp", ":0")
////	if err != nil{
////		log.Fatal("network error:", err)
////	}
////	log.Println("start rpc server on:", l.Addr())
////	addr <- l.Addr().String()
////	gerRpc.Accept(l)
////}
////
////func main()  {
////
////	//addr := make(chan string)
////	//go startServer(addr)
////	//client, _ := gerRpc.Dial("tcp", <-addr)
////	//defer func() {_ = client.Close()}()
////
////	//time.Sleep(time.Second)
////	//var wg sync.WaitGroup
////	//for i := 0; i < 5; i ++{
////	//	wg.Add(1)
////	//	go func(i int) {
////	//		defer wg.Done()
////	//		args := fmt.Sprintf("geerpc req %d", i)
////	//		var reply string
////	//		if err := client.Call("Foo.sum", args, &reply); err != nil{
////	//			log.Fatal("call Foo.Sum error:", err)
////	//		}
////	//		log.Println("reply")
////	//	}(i)
////	//}
////	//wg.Wait()
////}
//
////
////func main() {
////	addr := make(chan string)
////	go startServer(addr)
////
////	// in fact, following code is like a simple geerpc client
////	conn, _ := net.Dial("tcp", <-addr)
////	defer func() { _ = conn.Close() }()
////
////	time.Sleep(time.Second)
////	// send options
////	_ = json.NewEncoder(conn).Encode(gerRpc.DefaultOption)
////	cc := codec.NewGobCodec(conn)
////	// send request & receive response
////	for i := 0; i < 5; i++ {
////		h := &codec.Header{
////			ServiceMethod: "Foo.Sum",
////			Seq:           uint64(i),
////		}
////		_ = cc.Write(h, fmt.Sprintf("geerpc req %d", h.Seq))
////		_ = cc.ReadHeader(h)
////		var reply string
////		_ = cc.ReadBody(&reply)
////		log.Println("reply:", reply)
////	}
////}
////
////
////type Foo int
////
////type Args struct {
////	Num1, Num2 int
////}
////
////func (f Foo)Sum(args Args, reply *int)error  {
////	*reply = args.Num1 + args.Num2
////	return nil
////}
////func startServer(addr chan string) {
////	var foo Foo
////	if err := gerRpc.Register(&foo); err != nil {
////		log.Fatal("register error:", err)
////	}
////	// pick a free port
////	l, err := net.Listen("tcp", ":0")
////	if err != nil {
////		log.Fatal("network error:", err)
////	}
////	log.Println("start rpc server on", l.Addr())
////	addr <- l.Addr().String()
////	gerRpc.Accept(l)
////}
////
////func main()  {
////	log.SetFlags(0)
////	addr := make(chan string)
////	go startServer(addr)
////	client, _ := gerRpc.Dial("tcp", <-addr)
////	defer func() {_ = client.Close()}()
////
////	time.Sleep(time.Second)
////	var wg sync.WaitGroup
////	for i := 0; i < 5; i ++{
////		wg.Add(1)
////		go func(i int) {
////			defer wg.Done()
////			args := &Args{
////				Num1: i,
////				Num2: i * i,
////			}
////			ctx, _ := context.WithTimeout(context.Background(), time.Second)
////			var reply int
////			if err := client.Call(ctx,"Foo.Sum", args, &reply); err != nil{
////				log.Fatal("call Foo.Sum error:", err)
////			}
////			log.Printf("%d + %d = %d", args.Num1, args.Num2, reply)
////		}(i)
////	}
////	wg.Wait()
////}
//type Foo int
//
//type Args struct{ Num1, Num2 int }
//
//func (f Foo) Sum(args Args, reply *int) error {
//	*reply = args.Num1 + args.Num2
//	return nil
//}
//
//func (f Foo) Sleep(args Args, reply *int) error {
//	time.Sleep(time.Second * time.Duration(args.Num1))
//	*reply = args.Num1 + args.Num2
//	return nil
//}
//
//func startServer(addrCh chan string) {
//	var foo Foo
//	l, _ := net.Listen("tcp", ":0")
//	server := gerRpc.NewServer()
//	_ = server.Register(&foo)
//	addrCh <- l.Addr().String()
//	server.Accept(l)
//}
//
//func foo(xc *xclient.Xclient, ctx context.Context, typ, serviceMethod string, args *Args)  {
//	var reply int
//	var err error
//	switch typ {
//	case "call":
//		err = xc.Call(ctx, serviceMethod, args, &reply)
//	case "broadcast":
//		err = xc.Broadcast(ctx, serviceMethod, args, &reply)
//	}
//	if err != nil{
//		log.Printf("%s %s error: %v", typ, serviceMethod, err)
//	}else{
//		log.Printf("%s %s success: %d + %d = %d", typ, serviceMethod, args.Num1, args.Num2, reply)
//	}
//}
//
//func call(addr1, addr2 string)  {
//	d := xclient.NewMultiServerDiscovery([]string{"tcp@"+addr1, "tcp@"+addr2})
//	xc := xclient.NewXClient(d, xclient.RandomSelect, nil)
//	defer func() {_ = xc.Close()}()
//
//	var wg sync.WaitGroup
//	for i := 0; i < 5; i ++{
//		wg.Add(1)
//		go func(i int) {
//			defer wg.Done()
//			foo(xc, context.Background(), "call", "Foo.Sum", &Args{
//				Num1: i,
//				Num2: i * i,
//			})
//		}(i)
//	}
//	wg.Wait()
//}
//
//func broadcast(addr1, addr2 string) {
//	d := xclient.NewMultiServerDiscovery([]string{"tcp@" + addr1, "tcp@" + addr2})
//	xc := xclient.NewXClient(d, xclient.RandomSelect, nil)
//	defer func() { _ = xc.Close() }()
//	var wg sync.WaitGroup
//	for i := 0; i < 5; i++ {
//		wg.Add(1)
//		go func(i int) {
//			defer wg.Done()
//			foo(xc, context.Background(), "broadcast", "Foo.Sum", &Args{Num1: i, Num2: i * i})
//			// expect 2 - 5 timeout
//			ctx, _ := context.WithTimeout(context.Background(), time.Second*2)
//			foo(xc, ctx, "broadcast", "Foo.Sleep", &Args{Num1: i, Num2: i * i})
//		}(i)
//	}
//	wg.Wait()
//}
//
//
//func main() {
//	log.SetFlags(0)
//	ch1 := make(chan string)
//	ch2 := make(chan string)
//	// start two servers
//	go startServer(ch1)
//	go startServer(ch2)
//
//	addr1 := <-ch1
//	addr2 := <-ch2
//
//	time.Sleep(time.Second)
//	call(addr1, addr2)
//	broadcast(addr1, addr2)
//}
//
//package main
//
//import (
//	"bufio"
//	"fmt"
//	"os"
//	"strings"
//)
//
//var in = bufio.NewReader(os.Stdin)
//
//func main()  {
//	var T int
//	fmt.Fscan(in, &T)
//	for ;T > 0; T--{
//		var str string
//		fmt.Fscan(in, &str)
//
//		if strings.EqualFold(strings.ToLower(str), "yes"){
//			fmt.Println("YES")
//		}else{
//			fmt.Println("NO")
//		}
//	}
//}

package main

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

var in = bufio.NewReader(os.Stdin)

func main()  {
	var T int
	fmt.Fscan(in, &T)
	for ;T > 0; T--{
		var n int
		fmt.Fscan(in, &n)
		var str string
		fmt.Fscan(in, &str)
		mp := make(map[byte]bool)
		cnt := 0
		for i := 0; i < n; i ++{
			if !mp[str[i]] {
				cnt += 2
				mp[str[i]] = true
			}else{
				cnt ++
			}
		}
		fmt.Println(cnt)
	}
}

package main

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

func calcScore(str string) int {
	problems := make(map[byte]bool)
	score := 0
	for i := 0; i < len(str); i++ {
		if problems[str[i]] {
			score++
		} else {
			score += 2
			problems[str[i]] = true
		}
	}
	return score
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 16*1024*1024)
	T, err := strconv.Atoi(strings.TrimSpace(readLine(reader)))
	checkError(err)
	var results = make([]int, T)
	for i := 0; i < T; i++ {
		_, err := strconv.Atoi(strings.TrimSpace(readLine(reader)))
		checkError(err)
		str := strings.TrimSpace(readLine(reader))
		results[i] = calcScore(str)
	}
	for _, result := range results {
		fmt.Println(result)
	}
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err != nil {
		return ""
	}
	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

// 1703B. ICPC Balloons
package main

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

func main() {
	var T int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &T)
	for t := 1; t <= T; t++ {
		var n int
		var s string
		fmt.Fscan(reader, &n, &s)
		m := make(map[byte]bool)
		ans := 0
		for i := 0; i < n; i++ {
			if !m[s[i]] {
				m[s[i]] = true
				ans += 2
			} else {
				ans++
			}
		}
		fmt.Println(ans)
	}
}

package main

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

func Sol(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T int
	for fmt.Fscan(in, &T); T > 0; T-- {
		var n int
		var s string
		fmt.Fscan(in, &n, &s)
		cnt := make([]bool, 26)
		ans := 0
		for i := 0;i < n; i++ {
			if cnt[s[i] - 'A'] {
				ans ++
			} else {
				cnt[s[i] - 'A'] = true
				ans += 2
			}
		}
		fmt.Fprintln(out, ans)
	}
}

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

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 < T; t++ {
		var n int
		var s string
		fmt.Fscan(in, &n, &s)

		var tot int
		m := make([]bool, 26)
		for _, ch := range s {
			if !m[ch-'A'] {
				tot += 2
				m[ch-'A'] = true
			} else {
				tot++
			}
		}
		fmt.Fprintln(out, tot)
	}
}

package main

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

var _, _, _ = main, rw, do

func main() {
	r, w := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer w.Flush()
	rw(r, w)
}

func rw(r io.Reader, w io.Writer) {
	var t int
	fmt.Fscan(r, &t)
	for ti := 0; ti < t; ti++ {
		var n int
		var s string
		fmt.Fscan(r, &n, &s)
		w1 := do(s)
		fmt.Fprintln(w, w1)
	}
}

func do(m string) int {
	x := make([]int, 26)
	ans := 0
	for _, c := range m {
		y := c - 'A'
		if x[y] == 0 {
			ans++
		}
		ans++
		x[y]++
	}
	return ans
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func ReadIntArray(N int) []int{
	ans := make([]int, N)
	for i := 0; i < N; i++{
		fmt.Fscan(in, &ans[i])
	}
	return ans
}

func ReadString() string{
	var s string
	fmt.Fscan(in, &s)
	return s
}

func ReadStringArray(N int) []string{
	ans := make([]string, N)
	for i := 0; i < N; i++{
		fmt.Fscan(in, &ans[i])
	}
	return ans
}

func main(){
	defer out.Flush()
	testCases := ReadInt()
	for ; testCases > 0; testCases--{
		N := ReadInt()
		S := ReadString()
		who := make([]bool, 26)
		tot := N
		for i := 0; i < N; i++{
			if !who[S[i] - 'A']{
				who[S[i] - 'A'] = true
				tot++
			}
		}
		fmt.Fprintln(out, tot)
	}
}

package main

import "fmt"

func ReadInt() int{
	var i int
	fmt.Scanf("%d\n", &i)
	return i
}

func ReadArray(N int) []int{
	ans := make([]int, N)
	for i := 0; i < N; i++{
		ans[i] = ReadInt()
	}
	return ans
}

func ReadString() string{
	var s string
	fmt.Scanf("%s\n", &s)
	return s
}

func main(){
	testCases := ReadInt()
	for ; testCases > 0; testCases--{
		N := ReadInt()
		S := ReadString()
		who := make([]bool, 26)
		tot := N
		for i := 0; i < N; i++{
			if !who[S[i] - 'A']{
				who[S[i] - 'A'] = true
				tot++
			}
		}
		fmt.Println(tot)
	}
}

package main

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

var (
	in  = bufio.NewReader(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func ReadInt() int{
	var i int
	fmt.Fscan(in, &i)
	return i
}

func ReadIntArray(N int) []int{
	ans := make([]int, N)
	for i := 0; i < N; i++{
		fmt.Fscan(in, &ans[i])
	}
	return ans
}

func ReadString() string{
	var s string
	fmt.Fscan(in, &s)
	return s
}

func ReadStringArray(N int) []string{
	ans := make([]string, N)
	for i := 0; i < N; i++{
		fmt.Fscan(in, &ans[i])
	}
	return ans
}

func main(){
	testCases := ReadInt()
	for ; testCases > 0; testCases--{
		N := ReadInt()
		S := ReadString()
		who := make([]bool, 26)
		tot := N
		for i := 0; i < N; i++{
			if !who[S[i] - 'A']{
				who[S[i] - 'A'] = true
				tot++
			}
		}
		fmt.Fprintln(out, tot)
	}
}

package main

import "fmt"

func ReadInt() int{
	var i int
	fmt.Scanf("%d", &i)
	return i
}

func ReadArray(N int) []int{
	ans := make([]int, N)
	for i := 0; i < N; i++{
		ans[i] = ReadInt()
	}
	return ans
}

func ReadString() string{
	var s string
	fmt.Scanf("%s", &s)
	return s
}

func main(){
	testCases := ReadInt()
	for ; testCases > 0; testCases--{
		N := ReadInt()
		S := ReadString()
		who := make([]bool, 26)
		tot := N
		for i := 0; i < N; i++{
			if !who[S[i] - 'A']{
				who[S[i] - 'A'] = true
				tot++
			}
		}
		fmt.Println(tot)
	}
}

package main

import (
    "fmt"
    "strings"
)

func main() {
    tt := 0
    fmt.Scan(&tt)
    var str string
    for i := 1; i <= tt; i++ {
        fmt.Scan(&str)
        str = strings.ToLower(str)
        if str == "yes" {
            println("YES")
        } else {
            println("NO")
        }
    }

}

package main

import "fmt"

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

	for i := 0; i < t; i++ {
		var n int
		var s string
		m := make(map[byte]struct{})
		var cnt int
		fmt.Scanf("%d\n", &n)
		fmt.Scanf("%s\n", &s)
		for j := 0; j < n; j++ {
			if _, exist := m[s[j]]; !exist {
				cnt += 2
			} else {
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

package main

import . "fmt"

func main() {
	var (
		t, n, cnt int
		s, chr    string
	)
	Scan(&t)
	for i := 0; i < t; i++ {
		cnt = 0
		m := make(map[string]int)
		Scan(&n)
		Scan(&s)
		for j := 0; j < n; j++ {
			chr = string(s[j])
			if m[chr] == 0 {
				m[chr] = 1
				cnt += 2
			} else {
				cnt += 1
			}
		}
		Print(cnt)
	}
}