Problem:
Score : 300 points

Problem Statement

You are given a string S consisting of digits between 1 and 9, inclusive.
You can insert the letter + into some of the positions (possibly none) between two letters in this string.
Here, + must not occur consecutively after insertion.

All strings that can be obtained in this way can be evaluated as formulas.

Evaluate all possible formulas, and print the sum of the results.

Constraints

1 \leq |S| \leq 10

All letters in S are digits between 1 and 9, inclusive.

Input

The input is given from Standard Input in the following format:

S

Output

Print the sum of the evaluated value over all possible formulas.

Sample Input 1

125

Sample Output 1

176

There are 4 formulas that can be obtained: 125, 1+25, 12+5 and 1+2+5. When each formula is evaluated,

125

1+25=26

12+5=17

1+2+5=8

Thus, the sum is 125+26+17+8=176.

Sample Input 2

9999999999

Sample Output 2

12656242944

Solution in Go (1.6) (judge verdict: Runtime Error)

// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.
//   $ bundle -pkg main -prefix   -dst github.com/mpppk/atcoder/arc061/c github.com/mpppk/atcoder/arc061/c

package main

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

func solve(input *utl_Input) int {
	n := input.MustGetFirstIntValue(0)
	int8Nums := utl_ToDigitSliceInt(n)
	var nums []int
	for _, int8num := range int8Nums { // FIXME
		nums = append(nums, int(int8num))
	}

	// +を挿入するかどうかのビット列を全組み合わせ作る
	// N桁の+の組み合わせは2^(N-1)通り
	allSum := 0
	for i := 0; i < int(math.Pow(2, float64(len(nums)-1))); i++ {
		bits := utl_IntToBits(i, len(nums)-1)
		if len(bits) <= 1 {
			bits = []bool{}
		}
		chunks := utl_MustChunkIntByBits(nums, bits)
		sum := utl_ReduceIntSlice(chunks, func(acc int, cur []int) int {
			var int8Cur []int8
			for _, c := range cur {
				int8Cur = append(int8Cur, int8(c))
			}
			joinedC := utl_DigitsToInt(int8Cur)
			return acc + joinedC
		}, 0)
		allSum += sum
	}
	return allSum
}

func main() {
	input, err := utl_NewInputFromReader(bufio.NewReader(io.Reader(os.Stdin)))
	utl_PanicIfErrorExist(err)
	fmt.Println(solve(input))
}

func utl_IntToBits(value int, minDigits int) (bits []bool) {
	bin := fmt.Sprintf("%b", int(value))
	digits := 0
	for _, b := range bin {
		digits++
		if b == '0' {
			bits = append(bits, false)
		} else if b == '1' {
			bits = append(bits, true)
		} else {
			panic("invalid bit:" + string(b) + ", " + string('0'))
		}
	}

	for minDigits > digits {
		bits = append([]bool{false}, bits...)
		digits++
	}

	return
}

func utl_Int8ToBits(value int8, minDigits int) (bits []bool) {
	bin := fmt.Sprintf("%b", int(value))
	digits := 0
	for _, b := range bin {
		digits++
		if b == '0' {
			bits = append(bits, false)
		} else if b == '1' {
			bits = append(bits, true)
		} else {
			panic("invalid bit:" + string(b) + ", " + string('0'))
		}
	}

	for minDigits > digits {
		bits = append([]bool{false}, bits...)
		digits++
	}

	return
}

func utl_Int16ToBits(value int16, minDigits int) (bits []bool) {
	bin := fmt.Sprintf("%b", int(value))
	digits := 0
	for _, b := range bin {
		digits++
		if b == '0' {
			bits = append(bits, false)
		} else if b == '1' {
			bits = append(bits, true)
		} else {
			panic("invalid bit:" + string(b) + ", " + string('0'))
		}
	}

	for minDigits > digits {
		bits = append([]bool{false}, bits...)
		digits++
	}

	return
}

func utl_Int32ToBits(value int32, minDigits int) (bits []bool) {
	bin := fmt.Sprintf("%b", int(value))
	digits := 0
	for _, b := range bin {
		digits++
		if b == '0' {
			bits = append(bits, false)
		} else if b == '1' {
			bits = append(bits, true)
		} else {
			panic("invalid bit:" + string(b) + ", " + string('0'))
		}
	}

	for minDigits > digits {
		bits = append([]bool{false}, bits...)
		digits++
	}

	return
}

func utl_Int64ToBits(value int64, minDigits int) (bits []bool) {
	bin := fmt.Sprintf("%b", int(value))
	digits := 0
	for _, b := range bin {
		digits++
		if b == '0' {
			bits = append(bits, false)
		} else if b == '1' {
			bits = append(bits, true)
		} else {
			panic("invalid bit:" + string(b) + ", " + string('0'))
		}
	}

	for minDigits > digits {
		bits = append([]bool{false}, bits...)
		digits++
	}

	return
}

func utl_GetEachDigitSumInt(n int) (sum int) {
	for _, digit := range utl_ToDigitSliceInt(n) {
		sum += int(digit)
	}
	return
}

func utl_ToDigitSliceInt(n int) (digits []int8) {
	nn := int64(n)
	for {
		if nn <= 0 {
			return utl_ReverseInt8(digits)
		}
		digit := int8(nn % 10) // FIXME
		digits = append(digits, digit)
		nn /= 10
	}
}

func utl_DigitsToInt(digits []int8) int {
	v := int(0)
	for i, digit := range digits {
		v += int(float64(digit) * math.Pow(10, float64(len(digits)-i-1)))
	}
	return v
}

func utl_GetEachDigitSumInt8(n int8) (sum int8) {
	for _, digit := range utl_ToDigitSliceInt8(n) {
		sum += int8(digit)
	}
	return
}

func utl_ToDigitSliceInt8(n int8) (digits []int8) {
	nn := int64(n)
	for {
		if nn <= 0 {
			return utl_ReverseInt8(digits)
		}
		digit := int8(nn % 10) // FIXME
		digits = append(digits, digit)
		nn /= 10
	}
}

func utl_DigitsToInt8(digits []int8) int8 {
	v := int8(0)
	for i, digit := range digits {
		v += int8(float64(digit) * math.Pow(10, float64(len(digits)-i-1)))
	}
	return v
}

func utl_GetEachDigitSumInt16(n int16) (sum int16) {
	for _, digit := range utl_ToDigitSliceInt16(n) {
		sum += int16(digit)
	}
	return
}

func utl_ToDigitSliceInt16(n int16) (digits []int8) {
	nn := int64(n)
	for {
		if nn <= 0 {
			return utl_ReverseInt8(digits)
		}
		digit := int8(nn % 10) // FIXME
		digits = append(digits, digit)
		nn /= 10
	}
}

func utl_DigitsToInt16(digits []int8) int16 {
	v := int16(0)
	for i, digit := range digits {
		v += int16(float64(digit) * math.Pow(10, float64(len(digits)-i-1)))
	}
	return v
}

func utl_GetEachDigitSumInt32(n int32) (sum int32) {
	for _, digit := range utl_ToDigitSliceInt32(n) {
		sum += int32(digit)
	}
	return
}

func utl_ToDigitSliceInt32(n int32) (digits []int8) {
	nn := int64(n)
	for {
		if nn <= 0 {
			return utl_ReverseInt8(digits)
		}
		digit := int8(nn % 10) // FIXME
		digits = append(digits, digit)
		nn /= 10
	}
}

func utl_DigitsToInt32(digits []int8) int32 {
	v := int32(0)
	for i, digit := range digits {
		v += int32(float64(digit) * math.Pow(10, float64(len(digits)-i-1)))
	}
	return v
}

func utl_GetEachDigitSumInt64(n int64) (sum int64) {
	for _, digit := range utl_ToDigitSliceInt64(n) {
		sum += int64(digit)
	}
	return
}

func utl_ToDigitSliceInt64(n int64) (digits []int8) {
	nn := int64(n)
	for {
		if nn <= 0 {
			return utl_ReverseInt8(digits)
		}
		digit := int8(nn % 10) // FIXME
		digits = append(digits, digit)
		nn /= 10
	}
}

func utl_DigitsToInt64(digits []int8) int64 {
	v := int64(0)
	for i, digit := range digits {
		v += int64(float64(digit) * math.Pow(10, float64(len(digits)-i-1)))
	}
	return v
}

func utl_GetEachDigitSumFloat32(n float32) (sum float32) {
	for _, digit := range utl_ToDigitSliceFloat32(n) {
		sum += float32(digit)
	}
	return
}

func utl_ToDigitSliceFloat32(n float32) (digits []int8) {
	nn := int64(n)
	for {
		if nn <= 0 {
			return utl_ReverseInt8(digits)
		}
		digit := int8(nn % 10) // FIXME
		digits = append(digits, digit)
		nn /= 10
	}
}

func utl_DigitsToFloat32(digits []int8) float32 {
	v := float32(0)
	for i, digit := range digits {
		v += float32(float64(digit) * math.Pow(10, float64(len(digits)-i-1)))
	}
	return v
}

func utl_GetEachDigitSumFloat64(n float64) (sum float64) {
	for _, digit := range utl_ToDigitSliceFloat64(n) {
		sum += float64(digit)
	}
	return
}

func utl_ToDigitSliceFloat64(n float64) (digits []int8) {
	nn := int64(n)
	for {
		if nn <= 0 {
			return utl_ReverseInt8(digits)
		}
		digit := int8(nn % 10) // FIXME
		digits = append(digits, digit)
		nn /= 10
	}
}

func utl_DigitsToFloat64(digits []int8) float64 {
	v := float64(0)
	for i, digit := range digits {
		v += float64(float64(digit) * math.Pow(10, float64(len(digits)-i-1)))
	}
	return v
}

func utl_SumInt(values []int) int {
	var sum int = 0
	for _, value := range values {
		sum += value
	}
	return sum
}

func utl_FilterInt(values []int, f func(v int) bool) (newInts []int) {
	for _, value := range values {
		if f(value) {
			newInts = append(newInts, value)
		}
	}
	return
}

func utl_UniqInt(values []int) (newInts []int) {
	m := map[int]bool{}
	for _, value := range values {
		m[value] = true
	}

	for key := range m {
		newInts = append(newInts, key)
	}
	return
}

func utl_SubtractIntBy(values1 []int, values2 []int, f func(v int) int) (newInts []int, err error) {
	if len(values1) != len(values2) {
		return nil, errors.New("two values lengths are different")
	}

	for i := 0; i < len(values1); i++ {
		fInt1 := f(values1[i])
		fInt2 := f(values2[i])
		newInts = append(newInts, fInt1-fInt2)
	}
	return newInts, nil
}

func utl_SubtractInt(values1 []int, values2 []int) (newInts []int, err error) {
	return utl_SubtractIntBy(values1, values2, func(v int) int {
		return v
	})
}

func utl_RDiffIntBy(values []int, f func(v int) int) (newInts []int, err error) {
	diffInts := append([]int{0}, values...)
	newInts, err = utl_SubtractIntBy(values, diffInts[:len(diffInts)-1], f)
	if err != nil {
		return nil, fmt.Errorf("failed to RDiff: %v", err)
	}
	return newInts[1:], nil
}

func utl_RDiffInt(values []int) (newInts []int, err error) {
	return utl_RDiffIntBy(values, func(v int) int {
		return v
	})
}

func utl_SumInt8(values []int8) int8 {
	var sum int8 = 0
	for _, value := range values {
		sum += value
	}
	return sum
}

func utl_FilterInt8(values []int8, f func(v int8) bool) (newInt8s []int8) {
	for _, value := range values {
		if f(value) {
			newInt8s = append(newInt8s, value)
		}
	}
	return
}

func utl_UniqInt8(values []int8) (newInt8s []int8) {
	m := map[int8]bool{}
	for _, value := range values {
		m[value] = true
	}

	for key := range m {
		newInt8s = append(newInt8s, key)
	}
	return
}

func utl_SubtractInt8By(values1 []int8, values2 []int8, f func(v int8) int8) (newInt8s []int8, err error) {
	if len(values1) != len(values2) {
		return nil, errors.New("two values lengths are different")
	}

	for i := 0; i < len(values1); i++ {
		fInt81 := f(values1[i])
		fInt82 := f(values2[i])
		newInt8s = append(newInt8s, fInt81-fInt82)
	}
	return newInt8s, nil
}

func utl_SubtractInt8(values1 []int8, values2 []int8) (newInt8s []int8, err error) {
	return utl_SubtractInt8By(values1, values2, func(v int8) int8 {
		return v
	})
}

func utl_RDiffInt8By(values []int8, f func(v int8) int8) (newInt8s []int8, err error) {
	diffInt8s := append([]int8{0}, values...)
	newInt8s, err = utl_SubtractInt8By(values, diffInt8s[:len(diffInt8s)-1], f)
	if err != nil {
		return nil, fmt.Errorf("failed to RDiff: %v", err)
	}
	return newInt8s[1:], nil
}

func utl_RDiffInt8(values []int8) (newInt8s []int8, err error) {
	return utl_RDiffInt8By(values, func(v int8) int8 {
		return v
	})
}

func utl_SumInt16(values []int16) int16 {
	var sum int16 = 0
	for _, value := range values {
		sum += value
	}
	return sum
}

func utl_FilterInt16(values []int16, f func(v int16) bool) (newInt16s []int16) {
	for _, value := range values {
		if f(value) {
			newInt16s = append(newInt16s, value)
		}
	}
	return
}

func utl_UniqInt16(values []int16) (newInt16s []int16) {
	m := map[int16]bool{}
	for _, value := range values {
		m[value] = true
	}

	for key := range m {
		newInt16s = append(newInt16s, key)
	}
	return
}

func utl_SubtractInt16By(values1 []int16, values2 []int16, f func(v int16) int16) (newInt16s []int16, err error) {
	if len(values1) != len(values2) {
		return nil, errors.New("two values lengths are different")
	}

	for i := 0; i < len(values1); i++ {
		fInt161 := f(values1[i])
		fInt162 := f(values2[i])
		newInt16s = append(newInt16s, fInt161-fInt162)
	}
	return newInt16s, nil
}

func utl_SubtractInt16(values1 []int16, values2 []int16) (newInt16s []int16, err error) {
	return utl_SubtractInt16By(values1, values2, func(v int16) int16 {
		return v
	})
}

func utl_RDiffInt16By(values []int16, f func(v int16) int16) (newInt16s []int16, err error) {
	diffInt16s := append([]int16{0}, values...)
	newInt16s, err = utl_SubtractInt16By(values, diffInt16s[:len(diffInt16s)-1], f)
	if err != nil {
		return nil, fmt.Errorf("failed to RDiff: %v", err)
	}
	return newInt16s[1:], nil
}

func utl_RDiffInt16(values []int16) (newInt16s []int16, err error) {
	return utl_RDiffInt16By(values, func(v int16) int16 {
		return v
	})
}

func utl_SumInt32(values []int32) int32 {
	var sum int32 = 0
	for _, value := range values {
		sum += value
	}
	return sum
}

func utl_FilterInt32(values []int32, f func(v int32) bool) (newInt32s []int32) {
	for _, value := range values {
		if f(value) {
			newInt32s = append(newInt32s, value)
		}
	}
	return
}

func utl_UniqInt32(values []int32) (newInt32s []int32) {
	m := map[int32]bool{}
	for _, value := range values {
		m[value] = true
	}

	for key := range m {
		newInt32s = append(newInt32s, key)
	}
	return
}

func utl_SubtractInt32By(values1 []int32, values2 []int32, f func(v int32) int32) (newInt32s []int32, err error) {
	if len(values1) != len(values2) {
		return nil, errors.New("two values lengths are different")
	}

	for i := 0; i < len(values1); i++ {
		fInt321 := f(values1[i])
		fInt322 := f(values2[i])
		newInt32s = append(newInt32s, fInt321-fInt322)
	}
	return newInt32s, nil
}

func utl_SubtractInt32(values1 []int32, values2 []int32) (newInt32s []int32, err error) {
	return utl_SubtractInt32By(values1, values2, func(v int32) int32 {
		return v
	})
}

func utl_RDiffInt32By(values []int32, f func(v int32) int32) (newInt32s []int32, err error) {
	diffInt32s := append([]int32{0}, values...)
	newInt32s, err = utl_SubtractInt32By(values, diffInt32s[:len(diffInt32s)-1], f)
	if err != nil {
		return nil, fmt.Errorf("failed to RDiff: %v", err)
	}
	return newInt32s[1:], nil
}

func utl_RDiffInt32(values []int32) (newInt32s []int32, err error) {
	return utl_RDiffInt32By(values, func(v int32) int32 {
		return v
	})
}

func utl_SumInt64(values []int64) int64 {
	var sum int64 = 0
	for _, value := range values {
		sum += value
	}
	return sum
}

func utl_FilterInt64(values []int64, f func(v int64) bool) (newInt64s []int64) {
	for _, value := range values {
		if f(value) {
			newInt64s = append(newInt64s, value)
		}
	}
	return
}

func utl_UniqInt64(values []int64) (newInt64s []int64) {
	m := map[int64]bool{}
	for _, value := range values {
		m[value] = true
	}

	for key := range m {
		newInt64s = append(newInt64s, key)
	}
	return
}

func utl_SubtractInt64By(values1 []int64, values2 []int64, f func(v int64) int64) (newInt64s []int64, err error) {
	if len(values1) != len(values2) {
		return nil, errors.New("two values lengths are different")
	}

	for i := 0; i < len(values1); i++ {
		fInt641 := f(values1[i])
		fInt642 := f(values2[i])
		newInt64s = append(newInt64s, fInt641-fInt642)
	}
	return newInt64s, nil
}

func utl_SubtractInt64(values1 []int64, values2 []int64) (newInt64s []int64, err error) {
	return utl_SubtractInt64By(values1, values2, func(v int64) int64 {
		return v
	})
}

func utl_RDiffInt64By(values []int64, f func(v int64) int64) (newInt64s []int64, err error) {
	diffInt64s := append([]int64{0}, values...)
	newInt64s, err = utl_SubtractInt64By(values, diffInt64s[:len(diffInt64s)-1], f)
	if err != nil {
		return nil, fmt.Errorf("failed to RDiff: %v", err)
	}
	return newInt64s[1:], nil
}

func utl_RDiffInt64(values []int64) (newInt64s []int64, err error) {
	return utl_RDiffInt64By(values, func(v int64) int64 {
		return v
	})
}

func utl_SumFloat32(values []float32) float32 {
	var sum float32 = 0
	for _, value := range values {
		sum += value
	}
	return sum
}

func utl_FilterFloat32(values []float32, f func(v float32) bool) (newFloat32s []float32) {
	for _, value := range values {
		if f(value) {
			newFloat32s = append(newFloat32s, value)
		}
	}
	return
}

func utl_UniqFloat32(values []float32) (newFloat32s []float32) {
	m := map[float32]bool{}
	for _, value := range values {
		m[value] = true
	}

	for key := range m {
		newFloat32s = append(newFloat32s, key)
	}
	return
}

func utl_SubtractFloat32By(values1 []float32, values2 []float32, f func(v float32) float32) (newFloat32s []float32, err error) {
	if len(values1) != len(values2) {
		return nil, errors.New("two values lengths are different")
	}

	for i := 0; i < len(values1); i++ {
		fFloat321 := f(values1[i])
		fFloat322 := f(values2[i])
		newFloat32s = append(newFloat32s, fFloat321-fFloat322)
	}
	return newFloat32s, nil
}

func utl_SubtractFloat32(values1 []float32, values2 []float32) (newFloat32s []float32, err error) {
	return utl_SubtractFloat32By(values1, values2, func(v float32) float32 {
		return v
	})
}

func utl_RDiffFloat32By(values []float32, f func(v float32) float32) (newFloat32s []float32, err error) {
	diffFloat32s := append([]float32{0}, values...)
	newFloat32s, err = utl_SubtractFloat32By(values, diffFloat32s[:len(diffFloat32s)-1], f)
	if err != nil {
		return nil, fmt.Errorf("failed to RDiff: %v", err)
	}
	return newFloat32s[1:], nil
}

func utl_RDiffFloat32(values []float32) (newFloat32s []float32, err error) {
	return utl_RDiffFloat32By(values, func(v float32) float32 {
		return v
	})
}

func utl_SumFloat64(values []float64) float64 {
	var sum float64 = 0
	for _, value := range values {
		sum += value
	}
	return sum
}

func utl_FilterFloat64(values []float64, f func(v float64) bool) (newFloat64s []float64) {
	for _, value := range values {
		if f(value) {
			newFloat64s = append(newFloat64s, value)
		}
	}
	return
}

func utl_UniqFloat64(values []float64) (newFloat64s []float64) {
	m := map[float64]bool{}
	for _, value := range values {
		m[value] = true
	}

	for key := range m {
		newFloat64s = append(newFloat64s, key)
	}
	return
}

func utl_SubtractFloat64By(values1 []float64, values2 []float64, f func(v float64) float64) (newFloat64s []float64, err error) {
	if len(values1) != len(values2) {
		return nil, errors.New("two values lengths are different")
	}

	for i := 0; i < len(values1); i++ {
		fFloat641 := f(values1[i])
		fFloat642 := f(values2[i])
		newFloat64s = append(newFloat64s, fFloat641-fFloat642)
	}
	return newFloat64s, nil
}

func utl_SubtractFloat64(values1 []float64, values2 []float64) (newFloat64s []float64, err error) {
	return utl_SubtractFloat64By(values1, values2, func(v float64) float64 {
		return v
	})
}

func utl_RDiffFloat64By(values []float64, f func(v float64) float64) (newFloat64s []float64, err error) {
	diffFloat64s := append([]float64{0}, values...)
	newFloat64s, err = utl_SubtractFloat64By(values, diffFloat64s[:len(diffFloat64s)-1], f)
	if err != nil {
		return nil, fmt.Errorf("failed to RDiff: %v", err)
	}
	return newFloat64s[1:], nil
}

func utl_RDiffFloat64(values []float64) (newFloat64s []float64, err error) {
	return utl_RDiffFloat64By(values, func(v float64) float64 {
		return v
	})
}

func utl_ReduceRune(values []rune, f func(acc, cur rune) rune, initial rune) (newValue rune) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceRuneSlice(values [][]rune, f func(acc rune, cur []rune) rune, initial rune) (newValue rune) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyRune(values []rune) []rune {
	dst := make([]rune, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseRune(values []rune) []rune {
	newValues := utl_CopyRune(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapRune(values []rune, f func(v rune) rune) (newValues []rune) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapRuneSlice(values [][]rune, f func(v []rune) rune) (newValues []rune) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipRune(valuesList ...[]rune) (newValuesList [][]rune, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipRune")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipRune")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []rune
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeRune(values []rune, f func(v rune) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeRuneSlice(valuesList [][]rune, f func(v []rune) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryRune(values []rune, f func(v rune) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryRuneSlice(valuesList [][]rune, f func(v []rune) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkRuneByBits(values []rune, bits []bool) (newValues [][]rune, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []rune
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []rune{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_ReduceString(values []string, f func(acc, cur string) string, initial string) (newValue string) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceStringSlice(values [][]string, f func(acc string, cur []string) string, initial string) (newValue string) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyString(values []string) []string {
	dst := make([]string, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseString(values []string) []string {
	newValues := utl_CopyString(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapString(values []string, f func(v string) string) (newValues []string) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapStringSlice(values [][]string, f func(v []string) string) (newValues []string) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipString(valuesList ...[]string) (newValuesList [][]string, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipString")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipString")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []string
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeString(values []string, f func(v string) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeStringSlice(valuesList [][]string, f func(v []string) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryString(values []string, f func(v string) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryStringSlice(valuesList [][]string, f func(v []string) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkStringByBits(values []string, bits []bool) (newValues [][]string, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []string
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []string{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_ReduceInt(values []int, f func(acc, cur int) int, initial int) (newValue int) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceIntSlice(values [][]int, f func(acc int, cur []int) int, initial int) (newValue int) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyInt(values []int) []int {
	dst := make([]int, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseInt(values []int) []int {
	newValues := utl_CopyInt(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapInt(values []int, f func(v int) int) (newValues []int) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapIntSlice(values [][]int, f func(v []int) int) (newValues []int) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipInt(valuesList ...[]int) (newValuesList [][]int, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipInt")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipInt")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []int
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeInt(values []int, f func(v int) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeIntSlice(valuesList [][]int, f func(v []int) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryInt(values []int, f func(v int) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryIntSlice(valuesList [][]int, f func(v []int) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkIntByBits(values []int, bits []bool) (newValues [][]int, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []int
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []int{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_ReduceInt8(values []int8, f func(acc, cur int8) int8, initial int8) (newValue int8) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceInt8Slice(values [][]int8, f func(acc int8, cur []int8) int8, initial int8) (newValue int8) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyInt8(values []int8) []int8 {
	dst := make([]int8, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseInt8(values []int8) []int8 {
	newValues := utl_CopyInt8(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapInt8(values []int8, f func(v int8) int8) (newValues []int8) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapInt8Slice(values [][]int8, f func(v []int8) int8) (newValues []int8) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipInt8(valuesList ...[]int8) (newValuesList [][]int8, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipInt8")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipInt8")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []int8
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeInt8(values []int8, f func(v int8) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeInt8Slice(valuesList [][]int8, f func(v []int8) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryInt8(values []int8, f func(v int8) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryInt8Slice(valuesList [][]int8, f func(v []int8) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkInt8ByBits(values []int8, bits []bool) (newValues [][]int8, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []int8
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []int8{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_ReduceInt16(values []int16, f func(acc, cur int16) int16, initial int16) (newValue int16) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceInt16Slice(values [][]int16, f func(acc int16, cur []int16) int16, initial int16) (newValue int16) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyInt16(values []int16) []int16 {
	dst := make([]int16, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseInt16(values []int16) []int16 {
	newValues := utl_CopyInt16(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapInt16(values []int16, f func(v int16) int16) (newValues []int16) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapInt16Slice(values [][]int16, f func(v []int16) int16) (newValues []int16) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipInt16(valuesList ...[]int16) (newValuesList [][]int16, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipInt16")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipInt16")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []int16
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeInt16(values []int16, f func(v int16) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeInt16Slice(valuesList [][]int16, f func(v []int16) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryInt16(values []int16, f func(v int16) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryInt16Slice(valuesList [][]int16, f func(v []int16) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkInt16ByBits(values []int16, bits []bool) (newValues [][]int16, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []int16
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []int16{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_ReduceInt32(values []int32, f func(acc, cur int32) int32, initial int32) (newValue int32) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceInt32Slice(values [][]int32, f func(acc int32, cur []int32) int32, initial int32) (newValue int32) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyInt32(values []int32) []int32 {
	dst := make([]int32, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseInt32(values []int32) []int32 {
	newValues := utl_CopyInt32(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapInt32(values []int32, f func(v int32) int32) (newValues []int32) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapInt32Slice(values [][]int32, f func(v []int32) int32) (newValues []int32) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipInt32(valuesList ...[]int32) (newValuesList [][]int32, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipInt32")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipInt32")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []int32
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeInt32(values []int32, f func(v int32) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeInt32Slice(valuesList [][]int32, f func(v []int32) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryInt32(values []int32, f func(v int32) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryInt32Slice(valuesList [][]int32, f func(v []int32) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkInt32ByBits(values []int32, bits []bool) (newValues [][]int32, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []int32
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []int32{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_ReduceInt64(values []int64, f func(acc, cur int64) int64, initial int64) (newValue int64) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceInt64Slice(values [][]int64, f func(acc int64, cur []int64) int64, initial int64) (newValue int64) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyInt64(values []int64) []int64 {
	dst := make([]int64, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseInt64(values []int64) []int64 {
	newValues := utl_CopyInt64(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapInt64(values []int64, f func(v int64) int64) (newValues []int64) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapInt64Slice(values [][]int64, f func(v []int64) int64) (newValues []int64) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipInt64(valuesList ...[]int64) (newValuesList [][]int64, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipInt64")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipInt64")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []int64
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeInt64(values []int64, f func(v int64) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeInt64Slice(valuesList [][]int64, f func(v []int64) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryInt64(values []int64, f func(v int64) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryInt64Slice(valuesList [][]int64, f func(v []int64) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkInt64ByBits(values []int64, bits []bool) (newValues [][]int64, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []int64
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []int64{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_ReduceFloat32(values []float32, f func(acc, cur float32) float32, initial float32) (newValue float32) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceFloat32Slice(values [][]float32, f func(acc float32, cur []float32) float32, initial float32) (newValue float32) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyFloat32(values []float32) []float32 {
	dst := make([]float32, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseFloat32(values []float32) []float32 {
	newValues := utl_CopyFloat32(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapFloat32(values []float32, f func(v float32) float32) (newValues []float32) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapFloat32Slice(values [][]float32, f func(v []float32) float32) (newValues []float32) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipFloat32(valuesList ...[]float32) (newValuesList [][]float32, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipFloat32")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipFloat32")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []float32
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeFloat32(values []float32, f func(v float32) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeFloat32Slice(valuesList [][]float32, f func(v []float32) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryFloat32(values []float32, f func(v float32) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryFloat32Slice(valuesList [][]float32, f func(v []float32) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkFloat32ByBits(values []float32, bits []bool) (newValues [][]float32, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []float32
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []float32{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_ReduceFloat64(values []float64, f func(acc, cur float64) float64, initial float64) (newValue float64) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_ReduceFloat64Slice(values [][]float64, f func(acc float64, cur []float64) float64, initial float64) (newValue float64) {
	newValue = initial
	for _, value := range values {
		newValue = f(newValue, value)
	}
	return
}

func utl_CopyFloat64(values []float64) []float64 {
	dst := make([]float64, len(values))
	copy(dst, values)
	return dst
}

func utl_ReverseFloat64(values []float64) []float64 {
	newValues := utl_CopyFloat64(values)
	for i, j := 0, len(values)-1; i < j; i, j = i+1, j-1 {
		newValues[i], newValues[j] = values[j], values[i]
	}
	return newValues
}

func utl_MapFloat64(values []float64, f func(v float64) float64) (newValues []float64) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_MapFloat64Slice(values [][]float64, f func(v []float64) float64) (newValues []float64) {
	for _, value := range values {
		newValues = append(newValues, f(value))
	}
	return
}

func utl_ZipFloat64(valuesList ...[]float64) (newValuesList [][]float64, err error) {
	if len(valuesList) == 0 {
		return nil, errors.New("empty values list are given to ZipFloat64")
	}
	valuesLen := len(valuesList[0])
	for _, values := range valuesList {
		if (len(values)) != valuesLen {
			return nil, errors.New("different lengths values are given to ZipFloat64")
		}
	}

	for i := 0; i < valuesLen; i++ {
		var newValues []float64
		for _, values := range valuesList {
			newValues = append(newValues, values[i])
		}
		newValuesList = append(newValuesList, newValues)
	}
	return
}

func utl_SomeFloat64(values []float64, f func(v float64) bool) bool {
	for _, value := range values {
		if f(value) {
			return true
		}
	}
	return false
}

func utl_SomeFloat64Slice(valuesList [][]float64, f func(v []float64) bool) bool {
	for _, values := range valuesList {
		if f(values) {
			return true
		}
	}
	return false
}

func utl_EveryFloat64(values []float64, f func(v float64) bool) bool {
	for _, value := range values {
		if !f(value) {
			return false
		}
	}
	return true
}

func utl_EveryFloat64Slice(valuesList [][]float64, f func(v []float64) bool) bool {
	for _, values := range valuesList {
		if !f(values) {
			return false
		}
	}
	return true
}

func utl_ChunkFloat64ByBits(values []float64, bits []bool) (newValues [][]float64, err error) {
	if len(values) != len(bits)+1 {
		return nil, errors.New(fmt.Sprintf("there are different length between values(%d) and bits(%d)", len(values), len(bits)))
	}

	var chunk []float64
	for i, bit := range bits {
		chunk = append(chunk, values[i])
		if bit {
			newValues = append(newValues, chunk)
			chunk = []float64{}
		}
	}
	chunk = append(chunk, values[len(values)-1])
	newValues = append(newValues, chunk)
	return
}

func utl_toLines(scanner *bufio.Scanner) [][]string {
	var lines [][]string
	for scanner.Scan() {
		text := utl_TrimSpaceAndNewLineCodeAndTab(scanner.Text())
		if len(text) == 0 {
			lines = append(lines, []string{})
			continue
		}
		line := strings.Split(text, " ")
		lines = append(lines, line)
	}
	return lines
}

func utl_toLinesFromReader(reader *bufio.Reader) (lines [][]string, err error) {
	for {
		chunks, err := utl_readLineAsChunks(reader)
		if err == io.EOF {
			return lines, nil
		}

		if err != nil {
			return nil, fmt.Errorf("failed to read line from reader: %v", err)
		}
		lineStr := utl_TrimSpaceAndNewLineCodeAndTab(strings.Join(chunks, ""))
		line := strings.Split(lineStr, " ")
		lines = append(lines, line)
	}
}

func utl_readLineAsChunks(reader *bufio.Reader) (chunks []string, err error) {
	for {
		chunk, isPrefix, err := reader.ReadLine()
		if err != nil {
			return nil, err
		}
		chunks = append(chunks, string(chunk))
		if !isPrefix {
			return chunks, nil
		}
	}
}

type utl_Input struct {
	lines [][]string
}

func (i *utl_Input) validateColIndex(index int) error {
	if index < 0 {
		return errors.New(fmt.Sprintf("index is under zero: %d", index))
	}

	return nil
}

func (i *utl_Input) validateRowIndex(index int) error {
	if index >= len(i.lines) {
		return errors.New(fmt.Sprintf("index(%d) is larger than lines(%d)", index, len(i.lines)))
	}

	if index < 0 {
		return errors.New(fmt.Sprintf("index is under zero: %d", index))
	}
	return nil
}

func (i *utl_Input) GetLines(startRowIndex, endRowIndex int) ([][]string, error) {
	if err := i.validateRowIndex(startRowIndex); err != nil {
		return nil, fmt.Errorf("invalid start row index: %v", err)
	}
	if err := i.validateRowIndex(endRowIndex - 1); err != nil {
		return nil, fmt.Errorf("invalid end row index: %v", err)
	}
	return i.lines[startRowIndex:endRowIndex], nil
}

//func (i *Input) MustGetLines(rowIndex, colIndex int) [][]string {
//	lines, err := i.GetLines(rowIndex, colIndex)
//	PanicIfErrorExist(err)
//	return lines
//}
//
//func (i *Input) MustGetIntLines(rowIndex, colIndex int) (lines [][]int) {
//	strLines := i.MustGetLines(rowIndex, colIndex)
//	for _, strLine := range strLines {
//		line, err := toIntLine(strLine)
//		PanicIfErrorExist(err)
//		lines = append(lines, line)
//	}
//	return lines
//}

func (i *utl_Input) GetValue(rowIndex, colIndex int) (string, error) {
	line, err := i.GetLine(rowIndex)
	if err != nil {
		return "", err
	}
	if colIndex < 0 || colIndex >= len(line) {
		return "", fmt.Errorf("Invalid col index: %v ", colIndex)
	}
	return line[colIndex], nil
}

func (i *utl_Input) GetIntValue(rowIndex, colIndex int) (int, error) {
	line, err := i.GetLine(rowIndex)
	if err != nil {
		return 0, err
	}
	if colIndex < 0 || colIndex >= len(line) {
		return 0, fmt.Errorf("Invalid col index: %v ", colIndex)
	}

	intV, err := strconv.Atoi(line[colIndex])
	if err != nil {
		return 0, fmt.Errorf("failed to convert string to int: %v, %v", line[colIndex], err)
	}

	return intV, nil
}

//func (i *Input) MustGetIntValue(rowIndex, colIndex int) int {
//	value := i.MustGetValue(rowIndex, colIndex)
//	intV, err := strconv.Atoi(value)
//	PanicIfErrorExist(err)
//	return intV
//}
//
//func (i *Input) MustGetFirstIntValue(rowIndex int) int {
//	return i.MustGetIntValue(rowIndex, 0)
//}
//
//func (i *Input) MustGetLastIntValue(rowIndex int) int {
//	v := i.MustGetLastValue(rowIndex)
//	intV, err := strconv.Atoi(v)
//	PanicIfErrorExist(err)
//	return intV
//}

//func (i *Input) MustGetValue(rowIndex, colIndex int) string {
//	line, err := i.GetValue(rowIndex, colIndex)
//	PanicIfErrorExist(err)
//	return line
//}

//func (i *Input) MustGetFirstValue(rowIndex int) string {
//	return i.MustGetValue(rowIndex, 0)
//}
//
//func (i *Input) MustGetLastValue(rowIndex int) string {
//	line := i.MustGetLine(rowIndex)
//	return line[len(line)-1]
//}

func (i *utl_Input) GetFirstValue(rowIndex int) (string, error) {
	return i.GetValue(rowIndex, 0)
}

func (i *utl_Input) GetFirstIntValue(rowIndex int) (int, error) {
	return i.GetIntValue(rowIndex, 0)
}

func (i *utl_Input) GetColLine(colIndex int) (newLine []string, err error) {
	if err := i.validateRowIndex(colIndex); err != nil {
		return nil, err
	}

	for i, line := range i.lines {
		if len(line) <= colIndex {
			return nil, errors.New(fmt.Sprintf("col index(%d) is larger than %dth line length(%d)", colIndex, i, len(line)))
		}
		newLine = append(newLine, line[colIndex])
	}

	return newLine, nil
}

func (i *utl_Input) GetColIntLine(colIndex int) (newLine []int, err error) {
	strLine, err := i.GetColLine(colIndex)
	if err != nil {
		return nil, err
	}
	newLine, err = utl_toIntLine(strLine)
	if err != nil {
		return nil, fmt.Errorf("%dth col index: %v", colIndex, err)
	}
	return
}

//func (i *Input) MustGetColLine(colIndex int) (newLine []string) {
//	newLine, err := i.GetColLine(colIndex)
//	PanicIfErrorExist(err)
//	return
//}
//
//func (i *Input) MustGetColIntLine(colIndex int) (newLine []int) {
//	newLine, err := i.GetColIntLine(colIndex)
//	PanicIfErrorExist(err)
//	return
//}

func (i *utl_Input) GetLine(index int) ([]string, error) {
	if err := i.validateRowIndex(index); err != nil {
		return nil, err
	}
	return i.lines[index], nil
}

//func (i *Input) MustGetLine(index int) []string {
//	line, err := i.GetLine(index)
//	PanicIfErrorExist(err)
//	return line
//}

func (i *utl_Input) GetIntLine(index int) ([]int, error) {
	if err := i.validateRowIndex(index); err != nil {
		return nil, err
	}

	newLine, err := utl_toIntLine(i.lines[index])
	if err != nil {
		return nil, fmt.Errorf("%dth index: %v", index, err)
	}
	return newLine, nil
}

func (i *utl_Input) GetInt8Line(index int) ([]int8, error) {
	if err := i.validateRowIndex(index); err != nil {
		return nil, err
	}

	newLine, err := utl_toInt8Line(i.lines[index])
	if err != nil {
		return nil, fmt.Errorf("%dth index: %v", index, err)
	}
	return newLine, nil
}

func (i *utl_Input) GetInt16Line(index int) ([]int16, error) {
	if err := i.validateRowIndex(index); err != nil {
		return nil, err
	}

	newLine, err := utl_toInt16Line(i.lines[index])
	if err != nil {
		return nil, fmt.Errorf("%dth index: %v", index, err)
	}
	return newLine, nil
}

func (i *utl_Input) GetInt32Line(index int) ([]int32, error) {
	if err := i.validateRowIndex(index); err != nil {
		return nil, err
	}

	newLine, err := utl_toInt32Line(i.lines[index])
	if err != nil {
		return nil, fmt.Errorf("%dth index: %v", index, err)
	}
	return newLine, nil
}

func (i *utl_Input) GetInt64Line(index int) ([]int64, error) {
	if err := i.validateRowIndex(index); err != nil {
		return nil, err
	}

	newLine, err := utl_toInt64Line(i.lines[index])
	if err != nil {
		return nil, fmt.Errorf("%dth index: %v", index, err)
	}
	return newLine, nil
}

//func (i *Input) MustGetIntLine(index int) []int {
//	line, err := i.GetIntLine(index)
//	PanicIfErrorExist(err)
//	return line
//}
//func (i *Input) MustGetInt8Line(index int) []int8 {
//	line, err := i.GetInt8Line(index)
//	PanicIfErrorExist(err)
//	return line
//}
//func (i *Input) MustGetInt16Line(index int) []int16 {
//	line, err := i.GetInt16Line(index)
//	PanicIfErrorExist(err)
//	return line
//}
//func (i *Input) MustGetInt32Line(index int) []int32 {
//	line, err := i.GetInt32Line(index)
//	PanicIfErrorExist(err)
//	return line
//}
//func (i *Input) MustGetInt64Line(index int) []int64 {
//	line, err := i.GetInt64Line(index)
//	PanicIfErrorExist(err)
//	return line
//}

func utl_toInt8Line(line []string) (int8Line []int8, err error) {
	newLine, err := utl_toSpecificBitIntLine(line, 8)
	if err != nil {
		return nil, err
	}
	for _, v := range newLine {
		int8Line = append(int8Line, int8(v))
	}
	return
}

func utl_toInt16Line(line []string) (int16Line []int16, err error) {
	newLine, err := utl_toSpecificBitIntLine(line, 16)
	if err != nil {
		return nil, err
	}
	for _, v := range newLine {
		int16Line = append(int16Line, int16(v))
	}
	return
}

func utl_toInt32Line(line []string) (int32Line []int32, err error) {
	newLine, err := utl_toSpecificBitIntLine(line, 32)
	if err != nil {
		return nil, err
	}
	for _, v := range newLine {
		int32Line = append(int32Line, int32(v))
	}
	return
}

func utl_toInt64Line(line []string) ([]int64, error) {
	return utl_toSpecificBitIntLine(line, 64)
}

func utl_toIntLine(line []string) (intLine []int, err error) {
	for j, v := range line {
		intV, err := strconv.Atoi(v)
		if err != nil {
			return nil, fmt.Errorf(fmt.Sprintf("%dth value: %v", j, err.Error()))
		}
		intLine = append(intLine, intV)
	}
	return intLine, nil
}

func utl_toSpecificBitIntLine(line []string, bitSize int) (intLine []int64, err error) {
	for j, v := range line {
		intV, err := strconv.ParseInt(v, 10, bitSize)
		if err != nil {
			return nil, fmt.Errorf(fmt.Sprintf("%dth value: %v", j, err.Error()))
		}
		intLine = append(intLine, intV)
	}
	return intLine, nil
}

func utl_NewInput(scanner *bufio.Scanner) *utl_Input {
	return &utl_Input{
		lines: utl_toLines(scanner),
	}
}

func utl_NewInputFromReader(reader *bufio.Reader) (*utl_Input, error) {
	lines, err := utl_toLinesFromReader(reader)
	if err != nil {
		return nil, fmt.Errorf("failed to create new Input from reader: %v", err)
	}
	return &utl_Input{
		lines: lines,
	}, nil
}

func utl_MustSubtractIntBy(values1 []int, values2 []int, f func(v int) int) (newInts []int) {
	newInts, err := utl_SubtractIntBy(values1, values2, f)
	if err != nil {
		panic(err)
	}
	return newInts
}

func utl_MustSubtractInt(values1 []int, values2 []int) (newInts []int) {
	newInts, err := utl_SubtractInt(values1, values2)
	if err != nil {
		panic(err)
	}
	return newInts
}

func utl_MustRDiffIntBy(values []int, f func(v int) int) (newInts []int) {
	newInts, err := utl_RDiffIntBy(values, f)
	if err != nil {
		panic(err)
	}
	return newInts
}

func utl_MustRDiffInt(values []int) (newInts []int) {
	newInts, err := utl_RDiffInt(values)
	if err != nil {
		panic(err)
	}
	return newInts
}

func utl_MustSubtractInt8By(values1 []int8, values2 []int8, f func(v int8) int8) (newInt8s []int8) {
	newInt8s, err := utl_SubtractInt8By(values1, values2, f)
	if err != nil {
		panic(err)
	}
	return newInt8s
}

func utl_MustSubtractInt8(values1 []int8, values2 []int8) (newInt8s []int8) {
	newInt8s, err := utl_SubtractInt8(values1, values2)
	if err != nil {
		panic(err)
	}
	return newInt8s
}

func utl_MustRDiffInt8By(values []int8, f func(v int8) int8) (newInt8s []int8) {
	newInt8s, err := utl_RDiffInt8By(values, f)
	if err != nil {
		panic(err)
	}
	return newInt8s
}

func utl_MustRDiffInt8(values []int8) (newInt8s []int8) {
	newInt8s, err := utl_RDiffInt8(values)
	if err != nil {
		panic(err)
	}
	return newInt8s
}

func utl_MustSubtractInt16By(values1 []int16, values2 []int16, f func(v int16) int16) (newInt16s []int16) {
	newInt16s, err := utl_SubtractInt16By(values1, values2, f)
	if err != nil {
		panic(err)
	}
	return newInt16s
}

func utl_MustSubtractInt16(values1 []int16, values2 []int16) (newInt16s []int16) {
	newInt16s, err := utl_SubtractInt16(values1, values2)
	if err != nil {
		panic(err)
	}
	return newInt16s
}

func utl_MustRDiffInt16By(values []int16, f func(v int16) int16) (newInt16s []int16) {
	newInt16s, err := utl_RDiffInt16By(values, f)
	if err != nil {
		panic(err)
	}
	return newInt16s
}

func utl_MustRDiffInt16(values []int16) (newInt16s []int16) {
	newInt16s, err := utl_RDiffInt16(values)
	if err != nil {
		panic(err)
	}
	return newInt16s
}

func utl_MustSubtractInt32By(values1 []int32, values2 []int32, f func(v int32) int32) (newInt32s []int32) {
	newInt32s, err := utl_SubtractInt32By(values1, values2, f)
	if err != nil {
		panic(err)
	}
	return newInt32s
}

func utl_MustSubtractInt32(values1 []int32, values2 []int32) (newInt32s []int32) {
	newInt32s, err := utl_SubtractInt32(values1, values2)
	if err != nil {
		panic(err)
	}
	return newInt32s
}

func utl_MustRDiffInt32By(values []int32, f func(v int32) int32) (newInt32s []int32) {
	newInt32s, err := utl_RDiffInt32By(values, f)
	if err != nil {
		panic(err)
	}
	return newInt32s
}

func utl_MustRDiffInt32(values []int32) (newInt32s []int32) {
	newInt32s, err := utl_RDiffInt32(values)
	if err != nil {
		panic(err)
	}
	return newInt32s
}

func utl_MustSubtractInt64By(values1 []int64, values2 []int64, f func(v int64) int64) (newInt64s []int64) {
	newInt64s, err := utl_SubtractInt64By(values1, values2, f)
	if err != nil {
		panic(err)
	}
	return newInt64s
}

func utl_MustSubtractInt64(values1 []int64, values2 []int64) (newInt64s []int64) {
	newInt64s, err := utl_SubtractInt64(values1, values2)
	if err != nil {
		panic(err)
	}
	return newInt64s
}

func utl_MustRDiffInt64By(values []int64, f func(v int64) int64) (newInt64s []int64) {
	newInt64s, err := utl_RDiffInt64By(values, f)
	if err != nil {
		panic(err)
	}
	return newInt64s
}

func utl_MustRDiffInt64(values []int64) (newInt64s []int64) {
	newInt64s, err := utl_RDiffInt64(values)
	if err != nil {
		panic(err)
	}
	return newInt64s
}

func utl_MustSubtractFloat32By(values1 []float32, values2 []float32, f func(v float32) float32) (newFloat32s []float32) {
	newFloat32s, err := utl_SubtractFloat32By(values1, values2, f)
	if err != nil {
		panic(err)
	}
	return newFloat32s
}

func utl_MustSubtractFloat32(values1 []float32, values2 []float32) (newFloat32s []float32) {
	newFloat32s, err := utl_SubtractFloat32(values1, values2)
	if err != nil {
		panic(err)
	}
	return newFloat32s
}

func utl_MustRDiffFloat32By(values []float32, f func(v float32) float32) (newFloat32s []float32) {
	newFloat32s, err := utl_RDiffFloat32By(values, f)
	if err != nil {
		panic(err)
	}
	return newFloat32s
}

func utl_MustRDiffFloat32(values []float32) (newFloat32s []float32) {
	newFloat32s, err := utl_RDiffFloat32(values)
	if err != nil {
		panic(err)
	}
	return newFloat32s
}

func utl_MustSubtractFloat64By(values1 []float64, values2 []float64, f func(v float64) float64) (newFloat64s []float64) {
	newFloat64s, err := utl_SubtractFloat64By(values1, values2, f)
	if err != nil {
		panic(err)
	}
	return newFloat64s
}

func utl_MustSubtractFloat64(values1 []float64, values2 []float64) (newFloat64s []float64) {
	newFloat64s, err := utl_SubtractFloat64(values1, values2)
	if err != nil {
		panic(err)
	}
	return newFloat64s
}

func utl_MustRDiffFloat64By(values []float64, f func(v float64) float64) (newFloat64s []float64) {
	newFloat64s, err := utl_RDiffFloat64By(values, f)
	if err != nil {
		panic(err)
	}
	return newFloat64s
}

func utl_MustRDiffFloat64(values []float64) (newFloat64s []float64) {
	newFloat64s, err := utl_RDiffFloat64(values)
	if err != nil {
		panic(err)
	}
	return newFloat64s
}

func utl_MustZipRune(valuesList ...[]rune) (newValuesList [][]rune) {
	newValuesList, err := utl_ZipRune(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkRuneByBits(values []rune, bits []bool) (newValues [][]rune) {
	newValues, err := utl_ChunkRuneByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func utl_MustZipString(valuesList ...[]string) (newValuesList [][]string) {
	newValuesList, err := utl_ZipString(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkStringByBits(values []string, bits []bool) (newValues [][]string) {
	newValues, err := utl_ChunkStringByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func utl_MustZipInt(valuesList ...[]int) (newValuesList [][]int) {
	newValuesList, err := utl_ZipInt(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkIntByBits(values []int, bits []bool) (newValues [][]int) {
	newValues, err := utl_ChunkIntByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func utl_MustZipInt8(valuesList ...[]int8) (newValuesList [][]int8) {
	newValuesList, err := utl_ZipInt8(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkInt8ByBits(values []int8, bits []bool) (newValues [][]int8) {
	newValues, err := utl_ChunkInt8ByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func utl_MustZipInt16(valuesList ...[]int16) (newValuesList [][]int16) {
	newValuesList, err := utl_ZipInt16(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkInt16ByBits(values []int16, bits []bool) (newValues [][]int16) {
	newValues, err := utl_ChunkInt16ByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func utl_MustZipInt32(valuesList ...[]int32) (newValuesList [][]int32) {
	newValuesList, err := utl_ZipInt32(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkInt32ByBits(values []int32, bits []bool) (newValues [][]int32) {
	newValues, err := utl_ChunkInt32ByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func utl_MustZipInt64(valuesList ...[]int64) (newValuesList [][]int64) {
	newValuesList, err := utl_ZipInt64(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkInt64ByBits(values []int64, bits []bool) (newValues [][]int64) {
	newValues, err := utl_ChunkInt64ByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func utl_MustZipFloat32(valuesList ...[]float32) (newValuesList [][]float32) {
	newValuesList, err := utl_ZipFloat32(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkFloat32ByBits(values []float32, bits []bool) (newValues [][]float32) {
	newValues, err := utl_ChunkFloat32ByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func utl_MustZipFloat64(valuesList ...[]float64) (newValuesList [][]float64) {
	newValuesList, err := utl_ZipFloat64(valuesList...)
	if err != nil {
		panic(err)
	}
	return newValuesList
}

func utl_MustChunkFloat64ByBits(values []float64, bits []bool) (newValues [][]float64) {
	newValues, err := utl_ChunkFloat64ByBits(values, bits)
	if err != nil {
		panic(err)
	}
	return newValues
}

func (i *utl_Input) MustGetLines(startRowIndex, endRowIndex int) [][]string {
	v, err := i.GetLines(startRowIndex, endRowIndex)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetValue(rowIndex, colIndex int) string {
	v, err := i.GetValue(rowIndex, colIndex)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetIntValue(rowIndex, colIndex int) int {
	v, err := i.GetIntValue(rowIndex, colIndex)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetFirstValue(rowIndex int) string {
	v, err := i.GetFirstValue(rowIndex)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetFirstIntValue(rowIndex int) int {
	v, err := i.GetFirstIntValue(rowIndex)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetColLine(colIndex int) (newLine []string) {
	newLine, err := i.GetColLine(colIndex)
	if err != nil {
		panic(err)
	}
	return newLine
}

func (i *utl_Input) MustGetColIntLine(colIndex int) (newLine []int) {
	newLine, err := i.GetColIntLine(colIndex)
	if err != nil {
		panic(err)
	}
	return newLine
}

func (i *utl_Input) MustGetLine(index int) []string {
	v, err := i.GetLine(index)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetIntLine(index int) []int {
	v, err := i.GetIntLine(index)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetInt8Line(index int) []int8 {
	v, err := i.GetInt8Line(index)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetInt16Line(index int) []int16 {
	v, err := i.GetInt16Line(index)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetInt32Line(index int) []int32 {
	v, err := i.GetInt32Line(index)
	if err != nil {
		panic(err)
	}
	return v
}

func (i *utl_Input) MustGetInt64Line(index int) []int64 {
	v, err := i.GetInt64Line(index)
	if err != nil {
		panic(err)
	}
	return v
}

func utl_MustNewInputFromReader(reader *bufio.Reader) *utl_Input {
	v, err := utl_NewInputFromReader(reader)
	if err != nil {
		panic(err)
	}
	return v
}

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

func utl_TrimSpaceAndNewLineCodeAndTab(s string) string {
	return strings.TrimFunc(s, func(r rune) bool {
		return r == ' ' || r == '\r' || r == '\n' || r == '\t'
	})
}