package main

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

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

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

	var T int
	for fmt.Fscan(r, &T); T > 0; T-- {

		var n, res int
		fmt.Fscan(r, &n)

		a := make([]int, n)
		for i := range a { fmt.Fscan(r, &a[i]) }
		sort.Ints(a)

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

		fmt.Fprintln(w, res)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var t int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		var arr []int64 = make([]int64, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Slice(arr, func(i, j int) bool {
			return arr[i] > arr[j]
		})
		var ans int64
		for i := 1; i < n-1; i++ {
			tmp := arr[i-1]*2 - arr[i] - arr[n-1]
			if tmp > ans {
				ans = tmp
			}
		}
		for i := 2; i < n; i++ {
			tmp := arr[0] + arr[i-1] - 2*arr[i]
			if tmp > ans {
				ans = tmp
			}
		}
		fmt.Fprintln(out, ans)
	}
	out.Flush()
}

package main

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

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...) }

const (
	DEBUG = false
)

func debug(a ...interface{}) {
	if !DEBUG {
		return
	}
	for _, e := range a {
		printf("%v ", e)
	}
	printf("\n")
	writer.Flush()
}

func debugCondn(condn bool, a ...interface{}) {
	if !DEBUG || !condn {
		return
	}
	for _, e := range a {
		printf("%v ", e)
	}
	printf("\n")
	writer.Flush()
}

func assert(condn bool) {
	if !condn {
		panic("assertion error")
	}
}

func solve(tt int) {
	var n int
	scanf("%d\n", &n)
	a := make([]int64, n)
	for i:=0; i<n; i++ {
		scanf("%d ", &a[i])
	}
	scanf("\n")

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

	res := int64(0)
	for k:=2; k<n; k++ {
		cur := 2*a[k] - (a[0] + a[k-1])
		if cur > res {
			res = cur
		}
	}

	for k:=1; k<n-1; k++ {
		cur := a[n-1] + a[k] - 2*a[k-1]
		if cur > res {
			res = cur
		}
	}
	printf("%d\n", res)
}

func main() {
	defer writer.Flush()

	var T int
	scanf("%d\n", &T)
	for tt:=1; tt<=T; tt++ {
		solve(tt)
	}
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var t int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		var arr []int64 = make([]int64, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Slice(arr, func(i, j int) bool {
			return arr[i] > arr[j]
		})
		var x int64 = arr[0]
		for i := 1; i < n-1; i++ {
			if arr[i] != arr[0] {
				x = arr[i]
				break
			}
		}
		ans := arr[0]*2 - arr[n-1] - x
		for i := 1; i < n-1; i++ {
			tmp := arr[i-1]*2 - arr[i] - arr[n-1]
			if tmp > ans {
				ans = tmp
			}
		}
		fmt.Fprintln(out, ans)
	}
	out.Flush()
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var t int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		var arr []int64 = make([]int64, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Slice(arr, func(i, j int) bool {
			return arr[i] > arr[j]
		})
		var x int64 = arr[0]
		for i := 1; i < n-1; i++ {
			if arr[i] != arr[0] {
				x = arr[i]
				break
			}
		}
		fmt.Fprintln(out, arr[0]*2-arr[n-1]-x)
	}
	out.Flush()
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	var t int
	fmt.Fscan(in, &t)
	for ; t != 0; t-- {
		var n int
		fmt.Fscan(in, &n)
		var arr []int64 = make([]int64, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Slice(arr, func(i, j int) bool {
			return arr[i] > arr[j]
		})
		//fmt.Fprintln(out, arr[0], arr[n-1], arr[n-2])
		fmt.Fprintln(out, arr[0]*2-arr[n-1]-arr[1])
	}
	out.Flush()
}

package main

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

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...) }

const (
	DEBUG = false
)

func debug(a ...interface{}) {
	if !DEBUG {
		return
	}
	for _, e := range a {
		printf("%v ", e)
	}
	printf("\n")
	writer.Flush()
}

func debugCondn(condn bool, a ...interface{}) {
	if !DEBUG || !condn {
		return
	}
	for _, e := range a {
		printf("%v ", e)
	}
	printf("\n")
	writer.Flush()
}

func assert(condn bool) {
	if !condn {
		panic("assertion error")
	}
}

func solve(tt int) {
	var n int
	scanf("%d\n", &n)
	a := make([]int64, n)
	for i:=0; i<n; i++ {
		scanf("%d ", &a[i])
	}
	scanf("\n")

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

	res := int64(0)
	for k:=2; k<n; k++ {
		cur := 2*a[k] - (a[0] + a[k-1])
		if cur > res {
			res = cur
		}
	}
	printf("%d\n", res)
}

func main() {
	defer writer.Flush()

	var T int
	scanf("%d\n", &T)
	for tt:=1; tt<=T; tt++ {
		solve(tt)
	}
}


package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func slove() {
	defer w.Flush()
	var n int
	var x int64
	fmt.Fscan(r, &n, &x)
	nums, pre := make([]int, n), make([]int64, n+1)
	for i := range nums {
		fmt.Fscan(r,&nums[i])
	}
	sort.Ints(nums)
	for j := range nums {
		pre[j+1] = pre[j] + int64(nums[j])
	}
	var ans, d int64
	for d+int64(nums[0])<=x {
		j := sort.Search(n, func(i int) bool {
			return pre[i+1] + d * int64(i + 1) > x
		})
		cur := pre[j] + d * int64(j)
		diff := x - cur
		ans += (diff/int64(j)+1)*int64(j)
		d += (diff/int64(j)+1)
	}
	fmt.Fprintln(w, ans)
}

func abs(a int) int {if a < 0 {return -a} else {return a}}
//func max(a, b int) int {if a > b {return a} else {return b}}

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

package main

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

const (
	INF = 3e5 + 10
	L0  = int64(0)
	L1  = int64(1)
)

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

	var t int
	Fscan(in, &t)

	for tt := 0; tt < t; tt++ {
		var n, x int64
		Fscan(in, &n, &x)
		a := make([]int, n)
		for i := L0; i < n; i++ {
			Fscan(in, &a[i])
		}
		sort.Ints(a)

		sum := L0
		cnt := L0
		for i := L0; i < n; i++ {
			if sum+int64(a[i]) <= x {
				sum += int64(a[i])
				cnt++
			}
		}

		ans := L0
		d := L0
		for cnt > 0 {
			tmp := (x - sum - d*cnt + cnt) / cnt
			ans += tmp * cnt
			d += tmp
			cnt--
			sum -= int64(a[cnt])
		}
		Fprintln(out, ans)
	}
}

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

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

package main

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

/*
1
5 10
1 3 5 5 7
---
15 = 10 + 4 + 1
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n, x int64
	scanf("%d %d\n", &n, &x)

	a := make([]int, n)

	for i := range a {
		scanf("%d", &a[i])
	}
	scanf("\n")

	sort.Ints(a)

	ans := int64(0)
	sm := int64(0)

	for i, num := range a {
		inc := int64(i) + 1
		sm += int64(num)

		rng := x - sm
		if rng >= 0 {
			ans += rng/inc + 1
		} else {
			break
		}
	}

	fmt.Fprintln(writer, ans)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func sum(nums ...int) (sum int) {
	for _, num := range nums {
		sum += num
	}
	return
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int64) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

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

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnusedFunction
func factorize(num int64) []int64 {
	factors := make([]int64, 0)

	for ftr := int64(2); ftr*ftr <= num; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > 1 {
		factors = append(factors, num)
	}

	return factors
}

package main

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

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

func main() {
	defer out.Flush()

	var tc int
	fmt.Fscan(in, &tc)
	for ; tc > 0; tc-- {
		var n int
		var x int64
		fmt.Fscan(in, &n, &x)
		as := make([]int64, n)
		for i := range as {
			fmt.Fscan(in, &as[i])
		}
		sort.Slice(as, func(i, j int) bool { return as[i] < as[j] })
		var asum int64
		var cnt int64
		for i, a := range as {
			asum += a
			if asum <= x {
				cnt += (x - asum + int64(i + 1)) / int64(i + 1)
			}
		}
		fmt.Fprintln(out, cnt)
	}
}

package main

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

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

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

		arr := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Ints(arr)

		ans, sum := int64(0), 0
		for i, v := range arr {
			sum += v
			if sum > x {
				break
			}
			ans += int64((x-sum)/(i+1) + 1)
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

	var t int

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

		arr := make([]int, n)

		sum := int64(0)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
			sum += int64(arr[i])
		}
		sort.Ints(arr)

		ans, prevDay := int64(0), -1
		for i := n - 1; i >= 0; i-- {
			var curDay int
			if x >= sum {
				curDay = int((x - sum) / int64(i+1))
			} else {
				curDay = -1
			}

			ans += int64((i + 1) * (curDay - prevDay))
			prevDay = curDay
			sum -= int64(arr[i])
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

	var t int
	fmt.Fscanf(in, "%d\n", &t)

	for ; t > 0; t-- {
		var n int
		var x int64
		fmt.Fscanf(in, "%d %d\n", &n, &x)

		arr := make([]int, n)

		sum := int64(0)
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &arr[i])
			sum += int64(arr[i])
		}
		fmt.Fscanf(in, "\n")
		sort.Ints(arr)

		ans, prevDay := int64(0), -1
		for i := n - 1; i >= 0; i-- {
			var curDay int
			if x >= sum {
				curDay = int((x - sum) / int64(i+1))
			} else {
				curDay = -1
			}

			ans += int64((i + 1) * (curDay - prevDay))
			prevDay = curDay
			sum -= int64(arr[i])
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

const maxTokenSize = 25000000 * 7

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, maxTokenSize), maxTokenSize)
	scanner.Scan()

	countSum := func(pieces []int64) []int64 {
		var sum = make([]int64, 0, len(pieces))
		var local int64
		for _, piece := range pieces {
			local += piece
			sum = append(sum, local)
		}

		return sum
	}

	count, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < count; i++ {
		scanner.Scan()
		s := strings.Split(scanner.Text(), " ")

		shopCount, _ := strconv.ParseInt(s[0], 10, 64)
		moneyForDay, _ := strconv.ParseInt(s[1], 10, 64)

		prices := make([]int64, 0, shopCount)
		scanner.Scan()

		for _, p := range strings.Split(scanner.Text(), " ") {
			price, _ := strconv.ParseInt(p, 10, 64)
			prices = append(prices, price)
		}

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

		var dayNum int64
		var sugarSum int64
		sum := countSum(prices)

		for {
			startSum := moneyForDay - (sum[shopCount-1] + shopCount*dayNum)
			if startSum < 0 {
				shopCount--
				if shopCount == 0 {
					break
				}

				continue
			}

			days := (startSum / shopCount) + 1

			dayNum += days
			sugarSum += shopCount * days
		}

		fmt.Println(sugarSum)
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t, "\n")
	for ; t > 0; t-- {
		var n, x int64
		fmt.Fscan(in, &n, &x)
		arr := make([]int64, n)
		for i := int64(0); i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Slice(arr, func(i, j int) bool {
			return arr[i] < arr[j]
		})
		res := int64(0)
		sum := int64(0)
		for i := int64(0); i < n; i++ {
			sum += arr[i]
			if x >= sum {
				res += (x-sum)/(i+1) + 1
			}
		}

		fmt.Fprintln(out, res)
	}

}

package main

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

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 x int64
		fmt.Fscan(in, &n, &x)

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

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

		var tot int64
		var sum int64
		for i := 0; i < n; i++ {
			sum += arr[i]
			if sum > x {
				break
			}

			tot += (x-sum)/int64((i+1)) + 1
		}
		fmt.Fprintln(out, tot)
	}
}

package main

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

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 x int
		fmt.Fscan(in, &n, &x)

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

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

		m := make([]int64, n)
		m[0] = int64(arr[0])
		var pos int64
		for i := 1; i < n; i++ {
			m[i] = m[i-1] + int64(arr[i])
			if m[i] <= int64(x) {
				pos = int64(i)
			}
		}

		var d int64
		var tot int64
		for pos >= 0 {
			sum := m[pos] + ((pos + 1) * d)

			if sum <= int64(x) {
				z := (int64(x)-sum)/(pos+1) + 1
				tot += (pos + 1) * z
				d += z
			} else {
				pos--
			}
		}
		fmt.Fprintln(out, tot)
	}
}

package main

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

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

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

	var T int
	var x int
	var n int
	var t int64

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		Fscan(in, &t)

		r := []int{}
		for i := 0; i < n; i++ {
			Fscan(in, &x)
			r = append(r, x)
		}
		sort.Ints(r)

		ans := int64(0)
		s := int64(0)
		for i, v := range r {
			s += int64(v)
			if t < s {
				break
			}
			ans += (t-s)/int64(i+1) + 1
		}

		Fprintln(out, ans)
	}
}

package main

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

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

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

	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] < a[j]
		})
		cnt, ans, sum := 0, uint64(0), 0
		for cnt < n && sum+a[cnt] <= x {
			sum += a[cnt]
			cnt++
		}
		for d := 0; cnt > 0; {
			remain := x - sum - d*cnt
			if remain < 0 {
				cnt--
				sum -= a[cnt]
			} else {
				days := remain/cnt + 1
				d += days
				ans += uint64(days * cnt)
				cnt--
				sum -= a[cnt]
			}
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

const MOD int64 = 1000000007

var n int
var x int64

var a []int

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

func (a ByV) Len() int           { return len(a) }
func (a ByV) Less(i, j int) bool { return a[i].v < a[j].v }
func (a ByV) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {

	read := bufio.NewReader(os.Stdin)

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

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

		fmt.Fscan(read, &n, &x)

		a = make([]int, n)

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

		solve()
	}
}

type pair struct {
	v int
	idx []int
}

//a b c d

//20 12 -- 4
//4  2  -- 4

func solve()  {
	sort.Ints(a)

	cnt := 0
	var s int64
	var tot int64

	for i := 0; i < n; i++ {
		s += int64(a[i])

		if s > x {
			s -= int64(a[i])
			break
		}
		cnt++
	}

	if cnt == 0 {
		fmt.Println(0)
		return
	}

	tot += int64(cnt)
	idx := cnt - 1

	//X > s,  (X - s)/cnt

	d := (x - s)/int64(cnt)
	d++

	tot += (d - 1) * int64(cnt)

	var S int64

	S = s + (d) * int64(cnt)

	D := d

	for j := idx; j > 0; j-- {
		S = S - int64(a[j]) - D
		cnt--

		if S <= x {
			tot += int64(cnt)

			d := (x - S)/int64(cnt)
			d++

			tot += (d - 1) * int64(cnt)

			S = S + (d) * int64(cnt)

			D += d
		}

	}

	fmt.Println(tot)
}

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

package main

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

// github.com/EndlessCheng/codeforces-go
func CF1671C(_r io.Reader, out io.Writer) {
	in := bufio.NewReader(_r)
	var T, n, x int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n, &x)
		a := make([]int, n)
		for i := range a {
			Fscan(in, &a[i])
		}
		sort.Ints(a)

		ans, sum := int64(0), 0
		for i, v := range a {
			sum += v
			if sum > x {
				break
			}
			ans += int64((x-sum)/(i+1) + 1)
		}
		Fprintln(out, ans)
	}
}

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

package main

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

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

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

	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] < a[j]
		})
		cnt, ans, sum := 0, 0, 0
		for cnt < n && sum+a[cnt] <= x {
			sum += a[cnt]
			cnt++
		}
		for d := 0; cnt != 0; {
			remain := x - sum - d*cnt
			if remain < 0 {
				cnt--
				sum -= a[cnt]
			} else {
				days := remain/cnt + 1
				d += days
				ans += days * cnt
				cnt--
				sum -= a[cnt]
			}
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

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

	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] < a[j]
		})
		for i := 1; i < n; i++ {
			a[i] += a[i-1]
		}
		end := sort.Search(n, func(i int) bool {
			return a[i] > x
		})
		var ans uint64
		for d := 0; end != 0; {
			y := x - (a[end-1] + end*d)
			if y >= 0 {
				kk := y/end + 1
				d += kk
				ans += uint64(kk * end)
			}
			end--
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

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

	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] < a[j]
		})
		for i := 1; i < n; i++ {
			a[i] += a[i-1]
		}
		end := sort.Search(n, func(i int) bool {
			return a[i] > x
		})
		var ans uint64
		for d := 0; end != 0; d++ {
			y := x - (a[end-1] + end*d)
			if y >= 0 {
				ans += uint64(end)
				kk := y / end
				d += kk
				ans += uint64(kk * end)
			}
			end--
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

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

	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] < a[j]
		})
		for i := 1; i < n; i++ {
			a[i] += a[i-1]
		}
		end := sort.Search(n, func(i int) bool {
			return a[i] > x
		})
		var ans uint64
		for d := 0; end != 0; d++ {
			y := x - (a[end-1] + end*d)
			if y > 0 {
				ans += uint64(end)
				kk := y / end
				d += kk
				ans += uint64(kk * end)
			}
			end--
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

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

	t := 0
	fmt.Fscan(in, &t)
	for ; t > 0; t-- {
		n, x := 0, 0
		fmt.Fscan(in, &n, &x)
		a := make([]int, n)
		for i := range a {
			fmt.Fscan(in, &a[i])
		}
		sort.Slice(a, func(i, j int) bool {
			return a[i] < a[j]
		})
		for i := 1; i < n; i++ {
			a[i] += a[i-1]
		}
		end := sort.Search(n, func(i int) bool {
			return a[i] > x
		})
		var ans uint64
		for d := 0; end != 0; d++ {
			fmt.Println(d, end, ans)
			y := x - (a[end-1] + end*d)
			if y > 0 {
				fmt.Println(y)
				ans += uint64(end)
				kk := y / end
				d += kk
				ans += uint64(kk * end)
			}
			end--
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

/*
1
5 10
1 3 5 5 7
---
15 = 10 + 4 + 1
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n, x int
	scanf("%d %d\n", &n, &x)

	a := make([]int, n)

	for i := range a {
		scanf("%d", &a[i])
	}
	scanf("\n")

	sort.Ints(a)

	ans := int64(0)
	sm := int64(0)

	for i, num := range a {
		inc := int64(i) + 1
		sm += int64(num)

		cnt := (int64(x) - sm) / inc
		if cnt >= 0 {
			ans += cnt + 1
		} else {
			break
		}
	}

	fmt.Fprintln(writer, ans)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func sum(nums ...int) (sum int) {
	for _, num := range nums {
		sum += num
	}
	return
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int64) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

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

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnusedFunction
func factorize(num int64) []int64 {
	factors := make([]int64, 0)

	for ftr := int64(2); ftr*ftr <= num; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > 1 {
		factors = append(factors, num)
	}

	return factors
}

package main

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

/*
1
6 9
1 2 4 5 6 7
---
14

sum = 7, 10, 5, 7, 9, 11, 5 6 7 8 9
cnt = 3,  0  2, 2, 2, 0   1 1 1 1 1
2
2

---
========
1
3 7
2 1 2
---
11
=======
1
5 9
10 20 30 40 50
--
0
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n, x int64
	scanf("%d %d\n", &n, &x)

	a := make([]int, n)

	for i := range a {
		scanf("%d", &a[i])
	}
	scanf("\n")

	sort.Ints(a)

	if x < int64(a[0]) {
		fmt.Fprintln(writer, 0)
		return
	}

	dayCnt := int64(0)
	cnt := int64(0)

	sum := int64(0)
	i := int64(0)
	for {
		sum += int64(a[i])
		i++

		if i >= n {
			i--
			break
		}

		if sum > x {
			i--
			sum -= int64(a[i])
			i--
			break
		}
	}

	for i >= 0 {
		sum += i + 1
		cnt += i + 1

		dayCnt++

		for i >= 0 && sum > x {
			sum -= int64(a[i]) + dayCnt
			i--
		}
	}

	fmt.Fprintln(writer, cnt)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main

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

/*
1
6 9
1 2 4 4 6 7
---
14

sum = 7, 10, 5, 7, 9, 11, 5 6 7 8 9
cnt = 3,  0  2, 2, 2, 0   1 1 1 1 1
2
2

---
========
1
3 7
2 1 2
---
11
=======
1
5 9
10 20 30 40 50
--
0
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n, x int64
	scanf("%d %d\n", &n, &x)

	a := make([]int, n)

	for i := range a {
		scanf("%d", &a[i])
	}
	scanf("\n")

	sort.Ints(a)

	if x < int64(a[0]) {
		fmt.Fprintln(writer, 0)
		return
	}

	dayCnt := int64(0)
	cnt := int64(0)

	sum := int64(0)
	i := int64(0)
	for i < n && sum <= x {
		sum += int64(a[i])
		i++
	}
	i--
	if i != n-1 {
		sum -= int64(a[i])
		i--
	}

	for i >= 0 {
		sum += i + 1
		cnt += i + 1

		dayCnt++

		for i >= 0 && sum > x {
			sum -= int64(a[i]) + dayCnt
			i--
		}
	}

	fmt.Fprintln(writer, cnt)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main

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

/*
1
6 9
1 2 4 4 6 7
---

sum = 7, 10
3
2
2

---
========
1
3 7
2 1 2
---
11
=======
1
5 9
10 20 30 40 50
--
0
*/

//goland:noinspection GoUnhandledErrorResult
func solve() {
	var n, x int64
	scanf("%d %d\n", &n, &x)

	a := make([]int, n)

	for i := range a {
		scanf("%d", &a[i])
	}
	scanf("\n")

	sort.Ints(a)

	if x < int64(a[0]) {
		fmt.Fprintln(writer, 0)
		return
	}

	dayCnt := int64(0)
	cnt := int64(0)

	sum := int64(0)
	i := int64(0)
	for i < n && sum <= x {
		sum += int64(a[i])
		i++
	}
	i--
	if i != n-1 {
		sum -= int64(a[i])
	}

	for i >= 0 {
		sum += i + 1
		cnt += i + 1

		dayCnt++

		for i >= 0 && sum > x {
			sum -= int64(a[i]) + dayCnt
			i--
		}
	}

	fmt.Fprintln(writer, cnt)
}

//goland:noinspection GoUnhandledErrorResult
func main() {
	defer writer.Flush()

	t := 1
	scanf("%d\n", &t)

	for ; t > 0; t-- {
		solve()
	}
}

const maxUint = ^uint(0)

//goland:noinspection GoUnusedConst
const minUint = 0
const maxInt = int(maxUint >> 1)

//goland:noinspection GoUnusedConst
const minInt = -maxInt - 1

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

func scanf(f string, a ...interface{}) {
	if _, err := fmt.Fscanf(reader, f, a...); err != nil {
		panic(err)
	}
}

//goland:noinspection GoUnusedFunction
func reversed(s string) string {
	input := []rune(s)
	li := len(input)
	ret := make([]rune, li)
	for i, r := range input {
		ret[li-i-1] = r
	}
	return string(ret)
}

//goland:noinspection GoUnusedFunction
func divCeil(num, div int64) int64 {
	quot := num / div
	if num%div > 0 {
		quot++
	} else if num%div < 0 {
		quot--
	}
	return quot
}

//goland:noinspection GoUnusedFunction
func min(nums ...int) int {
	return nums[minIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func minIdx(nums ...int) int {
	minNumIdx := 0
	for i, num := range nums {
		if num < nums[minNumIdx] {
			minNumIdx = i
		}
	}

	return minNumIdx
}

//goland:noinspection GoUnusedFunction
func max(nums ...int) int {
	return nums[maxIdx(nums...)]
}

//goland:noinspection GoUnusedFunction
func maxIdx(nums ...int) int {
	maxNumIdx := 0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = i
		}
	}

	return maxNumIdx
}

//goland:noinspection GoUnusedFunction
func abs(num int) int {
	if num < 0 {
		return -num
	}
	return num
}

//goland:noinspection GoUnusedFunction
func isPrime(num int) bool {
	if num == 2 || num == 3 {
		return true
	}

	if num <= 1 || num%2 == 0 || num%3 == 0 {
		return false
	}

	for i := 5; i*i <= num; i += 6 {
		if num%i == 0 || num%(i+2) == 0 {
			return false
		}
	}

	return true
}

//goland:noinspection GoUnusedFunction
func gcd(a, b int) int {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

//goland:noinspection GoUnusedFunction
func lcm(a, b int) int {
	return abs(a) / gcd(a, b) * abs(b)
}

// Examples:
//	digitAt(1234, -1) -> panic!
//	digitAt(1234, 0) -> 4
//	digitAt(1234, 1) -> 3
//	digitAt(1234, 2) -> 2
//	digitAt(1234, 3) -> 1
//	digitAt(1234, 4) -> panic!
//goland:noinspection GoUnusedFunction
func digitAt(num, pos int) int {
	if num == 0 {
		return 0
	}

	num = abs(num)

	lenNum := int(math.Log10(float64(num))) + 1
	if pos < 0 || pos >= lenNum {
		err := fmt.Sprintf("Out of bound access for digit. Position passed %d, number %d", pos, num)
		panic(err)
	}

	rem := num % int(math.Pow10(pos+1))
	return rem / int(math.Pow10(pos))
}

//goland:noinspection GoUnhandledErrorResult
func factorize(num int) []int {
	factors := []int{1}

	sqrtA := int(math.Sqrt(float64(num)))

	for ftr := 2; ftr <= sqrtA; ftr++ {
		for num%ftr == 0 {
			num /= ftr
			factors = append(factors, ftr)
		}
	}

	if num > sqrtA {
		factors = append(factors, num)
	}

	return factors
}

package main

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

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

	var t int
	fmt.Fscanf(in, "%d\n", &t)

	for ; t > 0; t-- {
		var n, x int
		fmt.Fscanf(in, "%d %d\n", &n, &x)

		arr := make([]int, n)

		sum := 0
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &arr[i])
			sum += arr[i]
		}
		fmt.Fscanf(in, "\n")
		sort.Ints(arr)

		ans, prevDay := int64(0), -1
		for i := n - 1; i >= 0; i-- {
			var curDay int
			if x-sum >= 0 {
				curDay = (x - sum) / (i + 1)
			} else {
				curDay = -1
			}

			ans += int64((i + 1) * (curDay - prevDay))
			prevDay = curDay
			sum -= arr[i]
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

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

	var t int
	fmt.Fscanf(in, "%d\n", &t)

	for ; t > 0; t-- {
		var n, x int
		fmt.Fscanf(in, "%d %d\n", &n, &x)

		arr := make([]int, n)

		sum := 0
		for i := 0; i < n; i++ {
			fmt.Fscanf(in, "%d", &arr[i])
			sum += arr[i]
		}
		fmt.Fscanf(in, "\n")
		sort.Ints(arr)

		ans, prevDay := 0, -1
		for i := n - 1; i >= 0; i-- {
			var curDay int
			if x-sum >= 0 {
				curDay = (x - sum) / (i + 1)
			} else {
				curDay = -1
			}

			ans += (i + 1) * (curDay - prevDay)
			prevDay = curDay
			sum -= arr[i]
		}
		fmt.Fprintln(out, ans)
	}
}

package main

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

const maxTokenSize = 2500000 * 7

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, maxTokenSize), maxTokenSize)
	scanner.Scan()

	countSum := func(pieces []int) []int {
		var sum = make([]int, 0, len(pieces))
		var local int
		for _, piece := range pieces {
			local += piece
			sum = append(sum, local)
		}

		return sum
	}

	count, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < count; i++ {
		scanner.Scan()
		s := strings.Split(scanner.Text(), " ")

		shopCount, _ := strconv.Atoi(s[0])
		moneyForDay, _ := strconv.Atoi(s[1])

		prices := make([]int, 0, shopCount)
		scanner.Scan()

		for _, p := range strings.Split(scanner.Text(), " ") {
			price, _ := strconv.Atoi(p)
			prices = append(prices, price)
		}

		sort.Ints(prices)

		var dayNum int
		var sugarSum int
		sum := countSum(prices)

		for {
			startSum := moneyForDay - (sum[shopCount-1] + shopCount*dayNum)
			if startSum < 0 {
				shopCount--
				if shopCount == 0 {
					break
				}

				continue
			}

			days := (startSum / shopCount) + 1

			dayNum += days
			sugarSum += shopCount * days
		}

		fmt.Println(sugarSum)
	}
}

package main

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

const maxTokenSize = 4 * 100000

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]byte, 0, maxTokenSize), maxTokenSize)
	scanner.Scan()

	countSum := func(pieces []int) []int {
		var sum = make([]int, 0, len(pieces))
		var local int
		for _, piece := range pieces {
			local += piece
			sum = append(sum, local)
		}

		return sum
	}

	count, _ := strconv.Atoi(scanner.Text())
	for i := 0; i < count; i++ {
		scanner.Scan()
		s := strings.Split(scanner.Text(), " ")

		shopCount, _ := strconv.Atoi(s[0])
		moneyForDay, _ := strconv.Atoi(s[1])

		prices := make([]int, 0, shopCount)
		scanner.Scan()

		for _, p := range strings.Split(scanner.Text(), " ") {
			price, _ := strconv.Atoi(p)
			prices = append(prices, price)
		}

		sort.Ints(prices)

		var dayNum int
		var sugarSum int
		sum := countSum(prices)

		for {
			startSum := moneyForDay - (sum[shopCount-1] + shopCount*dayNum)
			if startSum < 0 {
				shopCount--
				if shopCount == 0 {
					break
				}

				continue
			}

			days := (startSum / shopCount) + 1

			dayNum += days
			sugarSum += shopCount * days
		}

		fmt.Println(sugarSum)
	}
}

package main

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

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

func main() {
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t, "\n")
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(in, &n, &x)
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Slice(arr, func(i, j int) bool {
			return arr[i] < arr[j]
		})
		res := 0
		sum := 0
		for i := 0; i < n; i++ {
			sum += arr[i]
			if x >= sum {
				res += (x-sum)/(i+1) + 1
			}
		}

		fmt.Fprintln(out, res)
	}

}

package main

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

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

func main() {
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t, "\n")
	for ; t > 0; t-- {
		var n, x int
		fmt.Fscan(in, &n, &x)
		arr := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Fscan(in, &arr[i])
		}
		sort.Slice(arr, func(i, j int) bool {
			return arr[i] < arr[j]
		})

		presum := make([]int, n)
		presum[0] = arr[0]
		for i := 1; i < n; i++ {
			presum[i] = presum[i-1] + arr[i]
		}
		idx := sort.Search(n, func(i int) bool {
			return presum[i] >= x
		})
		if idx == n {
			idx--
		}

		res := 0
		if presum[idx] <= x {
			res = idx + 1
		}
		cur := 0
		for {
			flag := true
			for i := idx; i >= 0; i-- {
				if presum[i]+(i+1)*(cur+1) <= x {
					idx = i
					res += i + 1
					flag = false
					break
				}
			}
			if flag {
				break
			}
			cur++
		}
		fmt.Fprintln(out, res)
	}

}

package main

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

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 x int
		fmt.Fscan(in, &n, &x)

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

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

		m := make([]int, n)
		m[0] = arr[0]
		for i := 1; i < n; i++ {
			m[i] = m[i-1] + arr[i]
		}

		pos := sort.SearchInts(m, x)
		if pos == n {
			pos = n - 1
		}

		d := 0
		var tot int
		for pos >= 0 {
			sum := m[pos] + ((pos + 1) * d)

			if sum <= x {
				z := (x-sum)/(pos+1) + 1
				tot += (pos + 1) * z
				d += z
			} else {
				pos--
			}
		}
		fmt.Fprintln(out, tot)
	}
}

package main

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

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

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

	var T int
	var x int
	var n int
	var t int

	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		Fscan(in, &t)

		r := []int{}
		for i := 0; i < n; i++ {
			Fscan(in, &x)
			r = append(r, x)
		}
		sort.Ints(r)

		ans := 0
		s := 0
		for i, v := range r {
			s += v
			if t < s {
				break
			}
			ans += (t-s)/(i+1) + 1
		}

		Fprintln(out, ans)
	}
}

package main

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

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func slove() {
	defer w.Flush()
	var n, x int
	fmt.Fscan(r, &n, &x)
	nums, pre := make([]int, n), make([]int, n+1)
	for i := range nums {
		fmt.Fscan(r,&nums[i])
	}
	sort.Ints(nums)
	for j := range nums {
		pre[j+1] = pre[j] + nums[j]
	}
	ans := 0
	d := 0
	for d+nums[0]<=x {
		j := sort.Search(n, func(i int) bool {
			return pre[i+1] + d * (i + 1) > x
		})
		cur := pre[j] + d * (j)
		diff := x - cur
		ans += (diff/j+1)*j
		d += (diff/j+1)
	}
	fmt.Fprintln(w, ans)

}

func abs(a int) int {if a < 0 {return -a} else {return a}}
//func max(a, b int) int {if a > b {return a} else {return b}}

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

package main

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

const MOD int64 = 1000000007

var n int
var x int64

var a []int

// ByAge implements sort.Interface based on the Age field.
type ByV []*pair

func (a ByV) Len() int           { return len(a) }
func (a ByV) Less(i, j int) bool { return a[i].v < a[j].v }
func (a ByV) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {

	read := bufio.NewReader(os.Stdin)

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

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

		fmt.Fscan(read, &n, &x)

		a = make([]int, n)

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

		solve()
	}
}

type pair struct {
	v int
	idx []int
}

//a b c d

//20 12 -- 4
//4  2  -- 4

func solve()  {
	sort.Ints(a)

	cnt := 0
	var s int64
	var tot int64

	for i := 0; i < n; i++ {
		s += int64(a[i])

		if s > x {
			s -= int64(a[i])
			break
		}
		cnt++
	}

	if cnt == 0 {
		fmt.Println(0)
		return
	}

	tot += int64(cnt)
	idx := cnt - 1

	//X > s,  (X - s)/cnt

	d := (x - s)/int64(cnt)
	d++

	tot += (d - 1) * int64(cnt)

	var S int64

	S = s + d * int64(cnt)

	for j := idx; j > 0; j-- {
		S = S - int64(a[j]) - d
		cnt--

		if S <= x {
			d := (x - S)/int64(cnt)
			d++

			tot += (d) * int64(cnt)

			S = S + (d - 1) * int64(cnt)
		}

	}

	fmt.Println(tot)
}

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


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 int
		_, _ = fmt.Fscan(in, &n)

		s := make([]int64, n)
		dp := make([]int64, n)
		for i := 0; i < n; i++ {
			_, _ = fmt.Fscan(in, &s[i])
			dp[i] = 1
		}

		ans := int64(0)
		for i := 0; i < n; i++ {
			if dp[i] > s[i] {
				if i+1 < n {
					dp[i+1] += dp[i] - s[i]
					dp[i] = s[i]
				}
			}
			if dp[i] < s[i] {
				ans += s[i] - dp[i]
				dp[i] = s[i]
			}
			for j := int64(2); (j <= s[i]) && (int64(i)+j < int64(n)); j++ {
				dp[j+int64(i)]++
			}
		}
		fmt.Println(ans)
	}
}

package main

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

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

	var T, n int
	for Fscan(in, &T); T > 0; T-- {
		Fscan(in, &n)
		fa := make([]int, n+1)
		var find func(int) int
		find = func(x int) int {
			if fa[x] != x {
				fa[x] = find(fa[x])
			}
			return fa[x]
		}
		a := make([]int, n)
		for i := range a {
			fa[i] = i
			if Fscan(in, &a[i]); a[i] == 1 {
				fa[i]++
			}
		}
		fa[n] = n
		ans := int64(0)
		for i, s := range a[:n-1] {
			if s == 1 {
				continue
			}
			if i+s >= n {
				to := n - 1 - i
				ans += int64(s - to)
				s = to
			}
			for ; s > 1; s-- {
				ans++
				for j := i + s; j < n; {
					if a[j] > 1 {
						if a[j]--; a[j] == 1 {
							fa[j] = j + 1
						}
						j += a[j] + 1
					} else {
						j = find(j)
					}
				}
			}
		}
		Fprintln(out, ans+int64(a[n-1]-1))
	}
}

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

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 min_int(a int, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}
func min_int64(a int64, b int64) int64 {
	if a < b {
		return a
	} else {
		return b
	}
}

func max_int(a int, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}
func max_int64(a int64, b int64) int64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func read_vector(n int64) []int64 {

	vec := make([]int64, n)

	for i := int64(0); i < n; i++ {
		if i != n-1 {
			scanf("%d ", &vec[i])
		} else {
			scanf("%d\n", &vec[i])
		}
	}
	return vec
}

func main() {
	defer writer.Flush()

	var T int = 0
	scanf("%d\n", &T)

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

		var N int64 = 0
		scanf("%d\n", &N)
		vec := read_vector(N)
		del := make([]int64, N)

		for i := int64(0); i < N; i++ {
			del[i] = 0
		}

		var res int64 = 0
		for i := int64(0); i < N; i++ {
			var jumps int64 = del[i]

			// printf("jumps: %d\n", jumps)
			if jumps < vec[i]-1 {
				var free_jumps int64 = vec[i] - 1 - jumps
				res += free_jumps
				jumps += free_jumps
			}

			if i+1 < N {
				del[i+1] += jumps - vec[i] + 1
			}

			if i+2 < N {
				for j := i + 2; j < min_int64(N, i+vec[i]+1); j++ {
					del[j] += 1
				}

			}

		}
		printf("%d\n", res)
	}

}

package main

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

func solve(s []int64) {
	var n int64 = int64(len(s))

	var i, curr, ans int64
	jmp := make([]int64, n+100)

	for ; i < n; i++ {
		curr = jmp[i]

		if curr >= s[i] {
			jmp[i+1] += curr - s[i] + 1
		} else if s[i]-curr-1 > 0 {
			ans += s[i] - curr - 1
		}

		to := n - 1
		if i+s[i] < n {
			to = i + s[i]
		}
		for j := i + 2; j <= to; j++ {
			jmp[j]++
		}
	}
	printf("%d\n", ans)
}

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	scan(&T)
	for t := 0; t < T; t++ {
		var n int
		scan(&n)
		s := make([]int64, n)
		for i := range s {
			scan(&s[i])
		}
		solve(s)
	}
}

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

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

package main

import (
	"fmt"
)

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

	for ; t > 0; t-- {
		fmt.Scan(&n)
		var result int64
		s := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scan(&s[i])
		}

		var current int
		next := make([]int, n)
		for i := range next {
			next[i] = i + 1
		}
		for first := 0; first < n; first++ {
			if s[first] == 1 {
				continue
			}
			result += int64(s[first] - 1)
			if s[first] > n-1-first {
				s[first] = n - 1 - first
			}
			for ; s[first] > 1; s[first]-- {
				current = first + s[first]
				for {
					if s[current] > 1 {
						s[current]--
						current += s[current] + 1
					} else {
						for ; next[current] < n && s[next[current]] == 1; next[current]++ {
						}
						current = next[current]
					}
					if current >= n {
						break
					}
				}
				//fmt.Println(s, first, current, result, next)
			}
		}
		fmt.Println(result)
	}
}

package main

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

func solve(s []int64) {
	var n int64 = int64(len(s))

	var i, ans, curr int64
	jmp := make([]int64, n+100)

	for ; i < n; i++ {
		curr += jmp[i]
		if s[i]-curr > 1 {
			ans += s[i] - curr - 1
		}

		jmp[i+2]++
		if i+s[i]+1 > n {
			jmp[n]--
		} else {
			jmp[i+s[i]+1]--
		}
	}
	printf("%d\n", ans)
}

func main() {
	defer writer.Flush()
	//redirectInputToFile(reader, "input.txt")

	T := 1
	scan(&T)
	for t := 0; t < T; t++ {
		var n int
		scan(&n)
		s := make([]int64, n)
		for i := range s {
			scan(&s[i])
		}
		solve(s)
	}
}

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

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

func redirectInputToFile(r *bufio.Reader, fp string) {
	f, err := os.Open(fp)
	if err != nil {
		panic(err)
	}
	r.Reset(f)
}

package main

import (
	"fmt"
)

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

	for ; t > 0; t-- {
		fmt.Scan(&n)
		s := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scan(&s[i])
		}
		var result int64
		for i := 0; i < n; i++ {
			if s[i] == 1 {
				continue
			}
			result += int64(s[i] - 1)
			if i+s[i] >= n {
				s[i] = n - i - 1
			}
			for j := i + 2; j <= i+s[i]; j++ {
				s[j]--
			}
			s[i] = 1
		}
		fmt.Println(result)
	}
}


package main

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

const mod = 1000000007

var bigMod = big.NewInt(mod)
var bigThree = big.NewInt(3)

func charval(c byte) byte {
	switch {
	case '0' <= c && c <= '9':
		return c - '0'
	case 'A' <= c && c <= 'Z':
		return 10 + c - 'A'
	case 'a' <= c && c <= 'z':
		return 36 + c - 'a'
	case c == '-':
		return 62
	case c == '_':
		return 63
	default:
		panic("illegal character " + string(c))
	}
}

func zeros(b byte) int {
	z := 0
	for i := 0; i < 6; i++ {
		if b%2 == 0 {
			z++
		}
		b >>= 1
	}
	return z
}
func zerobits(s string) int {
	bs := make([]byte, len(s))
	for i := range bs {
		bs[i] = charval(s[i])
	}
	z := 0
	for _, b := range bs {
		z += zeros(b)
	}
	return z
}

func solve(s string) int64 {
	z := int64(zerobits(s))
	bz := big.NewInt(z)
	var be big.Int
	be.Exp(bigThree, bz, bigMod)
	return be.Int64()
}

func main() {
	s := ""
	_, err := fmt.Fscan(os.Stdin, &s)
	if err != nil {
		panic(err)
	}
	i := solve(s)
	fmt.Println(i)
}

package main

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

var M [256]byte

func bits(x byte) byte {
	var ans byte
	for x > 0 {
		ans += x & 1
		x /= 2
	}
	return 6 - ans
}

func init() {
	var val byte
	f := func(b, e byte) {
		for i := b; i <= e; i++ {
			M[i] = bits(val)
			val++
		}
	}
	f('0', '9')
	f('A', 'Z')
	f('a', 'z')
	f('-', '-')
	f('_', '_')
}

const mod = 1000000000 + 7

func main() {
	cnt := 0
	for {
		b := getByte()
		if b == '\n' {
			break
		}
		cnt += int(M[b])
	}

	fmt.Println(big.NewInt(0).Exp(big.NewInt(3), big.NewInt(int64(cnt)), big.NewInt(mod)))
}

type Input struct {
	*bufio.Scanner
}

var globalInput = wrapStdin()

func wrapStdin() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanBytes)
	return Input{Scanner: sc}
}
func getByte() byte {
	globalInput.Scan()
	return globalInput.Bytes()[0]
}
func getInt() int {
	globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x
}
func getIntOk() (int, bool) {
	ok := globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x, ok
}
func getNint(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = getInt()
	}
	return v
}
func getVint(v []int) bool {
	var ok bool
	for i := 0; i < len(v); i++ {
		v[i], ok = getIntOk()
	}
	return ok
}
func getWord() string {
	globalInput.Scan()
	return globalInput.Text()
}
func getWordOk() (string, bool) {
	ok := globalInput.Scan()
	return globalInput.Text(), ok
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func minStr(a, b string) string {
	if a < b {
		return a
	}
	return b
}
func maxStr(a, b string) string {
	if a < b {
		return b
	}
	return a
}
func remin(a *int, b int) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax(a *int, b int) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func remin64(a *int64, b int64) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax64(a *int64, b int64) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func reminStr(a *string, b string) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remaxStr(a *string, b string) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

type (
	FLess    func(i, j int) bool
	FSwap    func(i, j int)
	wrapSort struct {
		Length int
		FLess
		FSwap
	}
)

func (w *wrapSort) Len() int           { return w.Length }
func (w *wrapSort) Less(i, j int) bool { return w.FLess(i, j) }
func (w *wrapSort) Swap(i, j int)      { w.FSwap(i, j) }
func wsort(length int, fless func(i, j int) bool, fswap func(i, j int)) {
	sort.Sort(&wrapSort{length, fless, fswap})
}

package main

import "fmt"

func possible(s rune) uint {
  var(
    n,i int;
    cnt uint
  )
  q:=int(s);
  if('0'<=s&&s<='9'){
    n=q-'0'
  }  else if('A'<=s&&s<='Z'){
    n=10+q-int('A')
  }  else if('a'<=s&&s<='z'){
    n=36+q-int('a')
  }  else if(s=='-'){
    n=62
  }  else{
    n=63
  }
  for cnt,i=0,1;i<64;i<<=1{
    if 0==n&i {
      cnt++
    }
  }
  return cnt
}

func main() {
  var r int64 = 1
  const mod int64= 1000000007
  var i string ; fmt.Scanf("%s",&i)
  var q rune
  var j int
  for j = range i{
    q=rune(i[j])
    var h,lim int
    for h,lim=0,	int(possible(q));h<lim;h++ {
      r*=3
      if r>=mod{r%=mod}
    }
  }
  fmt.Printf("%d\n",r)
}

package main

import (
	"fmt"
)

func zeros(num rune) uint {
	zeros := uint(6)
	for i := 0; i < 6; i++ {
		zeros -= uint(num & 1)
		num >>= 1
	}

	return zeros
}

func value(c rune) rune {
	if c >= '0' && c <= '9' {
		return c - '0' + 0
	}

	if c >= 'A' && c <= 'Z' {
		return c - 'A' + 10
	}

	if c >= 'a' && c <= 'z' {
		return c - 'a' + 36
	}

	if c == '-' {
		return 62
	}

	if c == '_' {
		return 63
	}

	return c
}

func main() {
	var str string
	fmt.Scanln(&str)

	result := int64(1)
	for _, c := range str {
		for i := zeros(value(c)); i > 0; i-- {
			result *= 3
		}

		result %= 1000000007
	}

	fmt.Println(result)
}