package main

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

func solve() {
	n := readInt()
	k := readInt()
	a := make([]int, k)
	if k == 1 {
		a[0] = n
		k = 0
	}
	for i := 2; i <= n && k > 1; i++ {
		for n%i == 0 {
			k--
			n /= i
			a[k] = i
			if k == 1 {
				if n != 1 {
					a[0] = n
					k--
				}
				break
			}
		}
	}
	if k == 0 {
		for i := 0; i < len(a); i++ {
			if i > 0 {
				fmt.Print(" ")
			}
			fmt.Print(a[i])
		}
	} else {
		fmt.Println(-1)
	}
}

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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


// Codeforces 655B done
package main

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

func main() {
	// reading n,k
	in := bufio.NewReader(os.Stdin)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		return
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	n, err1 := strconv.Atoi(ss[0])
	if err1 != nil {
		fmt.Println("n atoi failure", err1)
		return
	}
	k, err2 := strconv.Atoi(ss[1])
	if err2 != nil {
		fmt.Println("k atoi failure", err1)
		return
	}

	// calculating
	cnt := int64(0)
	for i:=0; i<k; i++ {
		if i<n/2 {
			n2k := n-2*i-2
			cnt += int64(n2k*2+1)
		}
	}

	// print result
	fmt.Println(cnt)
}


package main

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

func cf46A(in io.Reader, out io.Writer) {
	var k, n, w, sum int
	fmt.Fscan(in, &k, &n, &w)
	// fmt.Print(k, n, w)
	for i := 1; i <= w; i++ {
		sum = sum + (i * k)
	}
	if sum <= n {
		fmt.Println("0")
	} else {
		fmt.Println(sum - n)
	}

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


package main

import (
	"fmt"
)

func ReadArr(n int) []int{
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
	}
	return arr
}

var (
	l, s, r, p [4]bool
)

func Read() {
	for i := 0; i < 4; i++ {
		var li, si, ri, pi int
		fmt.Scan(&li, &si, &ri, &pi)
		l[i] = li == 1
		s[i] = si == 1
		r[i] = ri == 1
		p[i] = pi == 1
	}
}

func main() {
	Read()
	for i := 0; i < 4; i++ {
		if p[i] {
			if l[i] || s[i] || r[i] ||
				l[(i+1)%4] || s[(i+2)%4] || r[(i+3)%4] {
				yes()
				return
			}
		}
	}
	no()
}

func yes() {
	fmt.Println("YES")
}

func no() {
	fmt.Println("NO")
}


/*********************************************************************************
*     File Name           :     B.go
*     Created By          :     YIMMON, yimmon.zhuang@gmail.com
*     Creation Date       :     [2014-03-05 09:45]
*     Last Modified       :     [2014-03-05 11:09]
*     Description         :
**********************************************************************************/

package main

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

func op(st []byte) (ss []byte, inc int64, err error) {
    ss, inc, err = st, 0, errors.New("YES")
    defer func() {
        if x := recover(); x != nil {
            err = errors.New("NO")
        }
    }()
    if ss[0] == 'R' {
        var i int
        for i = 0; i < len(ss) && ss[i] == 'R'; i++ {
            ss[i] = 'B'
        }
        ss[i] = 'R'
        inc = 1
    } else {
        for ; int(inc) < len(ss) && ss[inc] == 'B'; inc++ {
            ss[inc] = 'R'
        }
        inc = 1<<uint(inc) - 1
    }
    err = nil
    return
}

var n int

func main() {
    scanner.Split(bufio.ScanWords)

    n = scanner.nextInt()
    var st = []byte(scanner.next())
    var ans int64 = 0
    for {
        ss, inc, err := op(st)
        if err != nil {
            break
        }
        ans += inc
        st = ss
    }
    fmt.Println(ans)
}

type Scanner struct {
    *bufio.Scanner
}

var scanner = Scanner{bufio.NewScanner(os.Stdin)}

func (self *Scanner) next() string {
    if !self.Scan() {
        panic(self.Err())
    }
    return self.Text()
}

func (self *Scanner) nextInt() int {
    x, err := strconv.Atoi(self.next())
    if err != nil {
        panic(err)
    }
    return x
}


package main

import "fmt"

func main() {
	var a1, a2, a3, b1, b2, b3 int
	var n int
	fmt.Scan(&a1, &a2, &a3, &b1, &b2, &b3, &n)

	cpus := a1 + a2 + a3
	medals := b1 + b2 + b3

	shelves := (cpus+4)/5 + (medals+9)/10
	if shelves <= n {
		fmt.Print("YES")
	} else {
		fmt.Print("NO")
	}
}


package main

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

func zcy(n int64) int64 {
	keta := int64(0)

	m := n
	for m > 0 {
		m /= 10
		keta++
	}
	a := pow(10, keta) * n
	for p := keta - 1; p >= 0; p-- {
		a += (n % 10) * pow(10, p)
		n /= 10
	}
	return a

}

//aのb乗をします O(log b)
func pow(a int64, b int64) int64 {
	total := int64(1)
	tmp := a
	for b > 0 {
		if b%2 == 1 {
			total *= tmp
		}
		b /= 2
		tmp *= tmp
	}
	return total
}

func main() {
	sc := NewScanner()
	k, p := sc.NextInt(), sc.NextInt()

	sum := int64(0)
	for i := 1; i <= k; i++ {
		sum += zcy(int64(i))
		sum %= int64(p)
	}
	fmt.Println(sum)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


package main

import "fmt"

func main() {
	n := 0
	fmt.Scanf("%d", &n)
	fmt.Println(n + 1)
}


package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var a, b, k int64
	Scan(&a, &b)
	if a > b {
		a, b = b, a
	}
	delta := b - a
	minLCM := int64(1e18)
	calcK := func(x int64) {
		ak := (a + x - 1) / x * x
		if lcm := ak / x * (ak + delta); lcm <= minLCM {
			minLCM = lcm
			k = ak - a
		}
	}
	for i := int64(1); i*i <= delta; i++ {
		if delta%i == 0 {
			calcK(i)
			calcK(delta / i)
		}
	}
	Print(k)
}


package main

import "fmt"

func main() {
    var n int
    ans := [...]string{"Sheldon","Leonard","Penny","Rajesh","Howard"}
    fmt.Scan(&n)
    a := 1
    for n > (5*a) {
        n -= (5*a)
        a *= 2
    }
    fmt.Println(ans[(n-1)/a])
}


package main

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

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

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

	n := nextInt()
	a := make([]int, n)
	bribe := 0

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

	idx := max(a[1:]) + 1

	for a[0] <= a[idx] {
		a[0]++
		a[idx]--
		bribe++
		// println(idx, a, bribe)
		idx = max(a[1:]) + 1
	}

	println(bribe)
}

func max(a []int) int {
	idx := 0

	for i := range a {
		if a[i] > a[idx] {
			idx = i
		}
	}

	return idx
}

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

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

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

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

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

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


package main

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

func max(a, b int) int {
	return -min(-a, -b)
}

func min(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 p1, t1, p2, t2, h, s int
	fmt.Fscan(r, &p1, &t1, &p2, &t2, &h, &s)

	dp := make([]int, h+1)
	for i := range dp {
		if i == 0 { continue }
		dp[i] = min(t1 + dp[max(0, i - (p1-s))], t2 + dp[max(0, i - (p2-s))])
		for j := 1; j <= i; j++ {
			if j*t1 >= t2 { dp[i] = min(dp[i], j*t1 + dp[max(0, i - (j-1)*(p1-s) - (j*t1/t2 - 1)*(p2-s) - (p1+p2-s))]) }
			if j*t2 >= t1 { dp[i] = min(dp[i], j*t2 + dp[max(0, i - (j-1)*(p2-s) - (j*t2/t1 - 1)*(p1-s) - (p1+p2-s))]) }
		}
	}

	fmt.Fprintln(w, dp[h])
}


package main

import (
	"fmt"
	"os"
)

type vector struct {
	x int
	y int
	z int
}

func main() {
	var a, b, c int
	total := 0

	scanf("%d\n", &a)
	scanf("%d\n", &b)
	scanf("%d\n", &c)

	if a+b+c > total {
		total = a + b + c
	}
	if a+b*c > total {
		total = a + b*c
	}
	if a*b+c > total {
		total = a*b + c
	}
	if a*b*c > total {
		total = a * b * c
	}
	if (a+b)*c > total {
		total = (a + b) * c
	}
	if a+(b*c) > total {
		total = a + (b * c)
	}
	if a*(b+c) > total {
		total = a*(b+c)
	}

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

func printf(format string, x ...interface{}) {
	fmt.Fprintf(os.Stdout, format, x...)
}

func scanf(format string, x ...interface{}) {
	if _, err := fmt.Fscanf(os.Stdin, format, x...); err != nil {
		panic(err)
	}
}


// 257A
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m, x int
	fmt.Scan(&n, &m, &x)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Sort(sort.IntSlice(a))
	for i := 0; i < n; i++ {
		if x >= m {
			fmt.Print(i)
			return
		} else {
			x += a[n-i-1] - 1
		}
	}
	if x >= m {
		fmt.Print(n)
	} else {
		fmt.Print(-1)
	}
}


package main

import (
    "strconv"
    "bufio"
    "os"
    "fmt"
)
// var file, _ = os.Open("input.txt")
// var outfile, _ = os.Create("output.txt")
// var in = bufio.NewScanner(file)
// var out = bufio.NewWriter(outfile)
var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
    if !in.Scan() {
        panic("Scan error")
    }
    return in.Text()
}

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

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

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

func swap(a []int, i int, j int) {
    a[i], a[j] = a[j], a[i]
}

func reverse(a []int, i int, j int) {
    for i < j {
        swap(a, i, j)
        i++
        j--
    }
}

func nextPermutation(a []int) bool {
    k := len(a) - 2
    for k > -1 && a[k] > a[k + 1] { k-- }
    if k == -1 { return false }
    l := len(a) - 1
    for k < l && a[k] > a[l] { l-- }
    swap(a, k, l)
    reverse(a, k + 1, len(a) - 1)
    return true
}

func f(a []int) int {
    n := len(a)
    sum := 0
    for i := 0; i < n; i++ {
        for j := i; j < n; j++ {
            min := -1;
            for k := i; k <= j; k++ {
                if min == -1 || min > a[k] {
                    min = a[k]
                }
            }
            sum += min
        }
    }
    return sum
}

func main() {
    defer out.Flush()
    in.Split(bufio.ScanWords)
    n := nextInt()
    m := nextInt()
    a := make([]int, n)
    for i := 0; i < n; i++ {
        a[i] = i + 1
    }
    ms := f(a)
    for nextPermutation(a) {
        sum := f(a)
        if ms < sum { ms = sum }
    }
    for i := 0; i < n; i++ {
        a[i] = i + 1
    }
    if ms == f(a) {
        m--
    }
    if m == 0 {
        for i := 0; i < n; i++ {
            fmt.Fprint(out, strconv.Itoa(a[i]) + " ")
        }
        fmt.Fprintln(out)
        return
    }
    for nextPermutation(a) {
        sum := f(a)
        if ms == sum {
            m--
            if m == 0 {
                for i := 0; i < n; i++ {
                    fmt.Fprint(out, strconv.Itoa(a[i]) + " ")
                }
                fmt.Fprintln(out)
                return
            }
        }
    }
}


package main

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

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func init() {
	ReadString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	// r.Buffer(make([]byte, 1024), int(1e+11)) // for AtCoder
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	// Split sets the split function for the Scanner. The default split function is ScanLines.
	// Split panics if it is called after scanning has started.
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60
const INF_INT32 = math.MaxInt32
const INF_BIT30 = 1 << 30

var a, b, c, d, e, f int

func main() {
	a, b, c, d = ReadInt4()
	e, f = ReadInt2()

	bc := Min(b, c)

	ans := 0
	if e > f {
		// aの方を使う
		m := Min(a, d)
		ans += e * m
		d -= m
		if d > 0 {
			mm := Min(bc, d)
			ans += f * mm
		}
	} else {
		// bcの方を使う
		m := Min(bc, d)
		ans += f * m
		d -= m
		if d > 0 {
			mm := Min(a, d)
			ans += e * mm
		}
	}

	fmt.Println(ans)
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

/*
- まずは全探索を検討しましょう
- MODは最後にとりましたか？
- ループを抜けた後も処理が必要じゃありませんか？
- 和・積・あまりを求められたらint64が必要ではありませんか？
- いきなりオーバーフローはしていませんか？
	- MOD取る系はint64必須ですよ？
*/

/*
ASCII code

ASCII   10進数  ASCII   10進数  ASCII   10進数
!       33      "       34      #       35
$       36      %       37      &       38
'       39      (       40      )       41
*       42      +       43      ,       44
-       45      .       46      /       47
0       48      1       49      2       50
3       51      4       52      5       53
6       54      7       55      8       56
9       57      :       58      ;       59
<       60      =       61      >       62
?       63      @       64      A       65
B       66      C       67      D       68
E       69      F       70      G       71
H       72      I       73      J       74
K       75      L       76      M       77
N       78      O       79      P       80
Q       81      R       82      S       83
T       84      U       85      V       86
W       87      X       88      Y       89
Z       90      [       91      \       92
]       93      ^       94      _       95
`       96      a       97      b       98
c       99      d       100     e       101
f       102     g       103     h       104
i       105     j       106     k       107
l       108     m       109     n       110
o       111     p       112     q       113
r       114     s       115     t       116
u       117     v       118     w       119
x       120     y       121     z       122
{       123     |       124     }       125
~       126             127
*/

/*******************************************************************/


package main

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

var local = false
var scanner *bufio.Scanner

func main() {
	setup()
	cb := readInt()
	digits := make(map[int][]int)

	for i := 0; i < cb; i++ {
		for j := 0; j < 6; j++ {
			face := readInt()
			digits[face] = append(digits[face], i)
		}
	}

	curr, result, stuck := 1, 0, false
	for !stuck {
		used := make(map[int]bool)
		if !rearrange(&digits, curr, &used) {
			stuck = true
		} else {
			result = curr
			curr++
		}
	}

	fmt.Println(result)
}

func rearrange(digits *map[int][]int, target int, pUsed *map[int]bool) bool {
	if target == 0 {
		return true
	}

	success, used, targetDigit := false, *pUsed, target%10
	for _, cube := range (*digits)[targetDigit] {
		if !used[cube] {
			used[cube] = true
			if rearrange(digits, target/10, &used) {
				success = true
				break
			}
			used[cube] = false
		}
	}

	return success
}

func setup() {
	source := os.Stdin
	if local == true {
		file, _ := os.Open("input.txt")
		source = file
	}
	scanner = bufio.NewScanner(source)
	scanner.Split(bufio.ScanWords)
}

func readInt() int {
	scanner.Scan()
	ans, _ := strconv.ParseInt(scanner.Text(), 10, 0)
	return int(ans)
}


package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)
	l := []rune(s)
	if l[0] > 96 {
		l[0] = l[0] - (96 - 64)
	}
	fmt.Println(string(l))
}


package main

import "fmt"

func main() {
	var d int
	fmt.Scanf("%X", &d)
	r := d & 1
	fmt.Println(r)
}


// 185A
package main

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

func main() {
	var n, x, y, m int64
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	fmt.Fscan(in, &n)
	y, x, m = 1, 2, 1000000007
	for n != 0 {
		if n%2 != 0 {
			y = (y * x) % m
		}
		x = (x * x) % m
		n = n / 2
	}
	fmt.Fprint(out, ((y*y+y)/2)%m)
	out.Flush()
}


package main

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

func solve() {
	daysInMonths := []int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	m := readInt()
	d := readInt()
	days := daysInMonths[m-1] + d - 1
	weeks := days / 7
	if days%7 != 0 {
		weeks++
	}
	fmt.Println(weeks)
}

func getStats(str string) map[byte]int {
	stat := map[byte]int{}
	for _, v := range str {
		stat[byte(v)]++
	}
	return stat
}

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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


package main

import "fmt"

func main() {
    var s string
    fmt.Scan(&s)
    four, seven := 0, 0
    for _, v := range s {
        if v == '4' {
            four++
        } else if v == '7' {
            seven++
        }
    }
    if (four+seven) == 0 {
        fmt.Println(-1)
    } else if four >= seven {
        fmt.Println(4)
    } else {
        fmt.Println(7)
    }
}


package main

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

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

	home := readNNums(reader, 2)

	n := readNum(reader)

	items := make([][]int, n)
	for i := 0; i < n; i++ {
		items[i] = readNNums(reader, 2)
	}

	tot, path := solve(home, items)

	var buf bytes.Buffer
	buf.WriteString(fmt.Sprintf("%d\n", tot))

	for _, cur := range path {
		buf.WriteString(fmt.Sprintf("%d ", cur))
	}
	fmt.Print(buf.String())
}

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

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

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

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

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

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

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

	return i
}

const INF = 1 << 29

func solve(home []int, items [][]int) (int, []int) {
	n := 1 + len(items)

	dist := make([][]int, n)

	for i := 0; i < n; i++ {
		dist[i] = make([]int, n)
		for j := 0; j < n; j++ {
			if i != j {
				if i == 0 {
					dist[i][j] = distance(home, items[j-1])
				} else if j > 0 {
					dist[i][j] = distance(items[i-1], items[j-1])
				} else {
					dist[i][j] = distance(items[i-1], home)
				}
			}
		}
	}

	N := 1 << (n - 1)

	dp := make([]int, N)
	parent := make([]int, N)
	for i := 0; i < N; i++ {
		dp[i] = INF
	}
	dp[0] = 0

	for state := 0; state < N; state++ {
		if dp[state] >= INF {
			continue
		}
		for i := 1; i < n; i++ {
			if state&(1<<(i-1)) == 0 {
				// i is not picked yet
				for j := i; j < n; j++ {
					if state&(1<<(j-1)) == 0 {
						if dp[state|(1<<(i-1))|(1<<(j-1))] > dp[state]+dist[i][0]+dist[j][0]+dist[i][j] {
							dp[state|(1<<(i-1))|(1<<(j-1))] = dp[state] + dist[i][0] + dist[j][0] + dist[i][j]
							parent[state|(1<<(i-1))|(1<<(j-1))] = state
						}
					}
				}
				break
			}
		}
	}
	best := dp[N-1]
	res := make([]int, 0, 2*n)
	res = append(res, 0)

	cur := N - 1

	for cur > 0 {

		prev := parent[cur]

		tmp := prev ^ cur

		for i := 1; i < n; i++ {
			if tmp&(1<<(i-1)) > 0 {
				res = append(res, i)
			}
		}
		res = append(res, 0)
		cur = prev
	}

	return best, res
}

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

func distance(a, b []int) int {
	dx := b[0] - a[0]
	dy := b[1] - a[1]
	return dx*dx + dy*dy
}


package main

import (
	"fmt"
	// "math"
)

func main() {
	var problems, parametres int
	fmt.Scan(&problems, &parametres)

	var scores, TIME []int
	for i := 0; i < problems; i++ {
		var problem int
		fmt.Scan(&problem)
		scores = append(scores, problem)
	}

	for i := 0; i < problems; i++ {
		var time int
		fmt.Scan(&time)
		TIME = append(TIME, time)
	}

	var LimakScore, RadewooshScore int
	var time int

	for i := 0; i < problems; i++ {
		time += TIME[i]
		if (scores[i] - parametres * time) < 0 {
			LimakScore += 0
		} else {
			LimakScore += scores[i] - parametres * time
		}
	}

	time = 0

	for i := problems - 1; i >= 0; i-- {
		time += TIME[i]
		if scores[i] - parametres * time < 0 {
			RadewooshScore += 0
		} else {
			RadewooshScore += scores[i] - parametres * time
		}
	}

	// fmt.Println(LimakScore, RadewooshScore)

	if LimakScore > RadewooshScore {
		fmt.Println("Limak")
	} else if LimakScore == RadewooshScore {
		fmt.Println("Tie")
	} else {
		fmt.Println("Radewoosh")
	}
}


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

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

const mod int = 1000000007
const Mod = int64(mod)

func pw(n, k int) int {
	ret := 1
	pv := n % mod
	for ; k > 0; k >>= 1 {
		if (k & 1) > 0 {
			ret = int(int64(ret) * int64(pv) % Mod)
		}
		pv = int(int64(pv) * int64(pv) % Mod)
	}
	return ret
}

func main(){
	// your code goes here
	defer writer.Flush()
	var (
		t, n, k int
	)
	fmt.Fscan(reader, &t)
	for id := 0; id < t; id++ {
		fmt.Fscan(reader, &n, &k)
		if n % 2 == 1 {
			fmt.Fprintln(writer, pw(pw(2,n-1) + 1, k))
		} else {
			ans := pw(pw(2, n-1) - 1, k)
			for j := 1; j <= k; j++ {
				v := int64(n) * int64(j-1) % (Mod - int64(1))
				ans += int( int64(pw(pw(2, n-1) - 1, k-j)) * int64(pw(2, int(v))) % Mod)
				ans %= mod
			}
			fmt.Fprintln(writer, ans)
		}
	}
}


package main
import(
    "fmt"
    "bufio"
    "os"
    "math"
)
type coords struct{
	row int
	column int
}
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var n float64
		fmt.Fscan(in,&n)
		n = math.Pow(float64(2),float64(n))
		fmt.Fprintln(out,int(n)-1)
	}
}


package main

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

func main() {

	givenString := scanString()
	givenString = strings.ToLower(givenString)
	answer := ""
	for _,value := range givenString{
		if !strings.ContainsAny("aoyeui", string(value)){
			answer += "." + string(value)
		}

	}

	printFmt(answer)

	close(channelType)
	oWg.Wait()
}

/*********************** I/O ***********************/

var channelType chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var printFmt func(a ...interface{}) (n int, err error)

func init() {
	printFmt = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	channelType = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range channelType {
			writer.WriteString(line + "\n")
		}
	}()
}

func scanString() string {in.Scan(); return in.Text() }
func scanInt() int {i, _ := strconv.Atoi(scanString()); return i}
func scanInt64() int64 {i, _ := strconv.ParseInt(scanString(), 10, 64); return i}
func scanStringSlice(n int) []string {s := make([]string, n); for i := 0; i < n; i++ {s[i] = scanString()}; return s}
func scanIntSlice(n int) []int {arr := make([]int, n); for i := 0; i < n; i++ {arr[i] = scanInt()}; return arr}
func scanInt64Slice(n int) []int64 {arr := make([]int64, n); for i := 0; i < n; i++ {arr[i] = scanInt64()}; return arr}

/*********************** Utils ***********************/

func stringEquivalent(v interface{}) string {return fmt.Sprintf("%v", v)}
func spaceSeperatedStringFromArray(a []int) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.Itoa(a[i]) + " ")}; return sb.String()}
func spaceSeperatedStringFromArray64(a []int64) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.FormatInt(a[i], 10) + " ")}; return sb.String()}
func minMaxFromArray(args ...int64) (int64, int64) {minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64); for _, v := range args {if v < minVal {minVal = v}; if v > maxVal {maxVal = v}}; return minVal, maxVal}
func minElementFromArray(args ...int64) int64 { mn, _ := minMaxFromArray(args...); return mn }
func maxElementFromArray(args ...int64) int64 { _, mx := minMaxFromArray(args...); return mx }
func lcmCalculation(a, b int64) int64 {return a / gcdCalculation(a, b) * b}
func gcdCalculation(a, b int64) int64 {if (a == 0) {return b}; return gcdCalculation(b%a, a)}
func sortInt64Slice(a []int64) {sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })}
func absoluteValue(x int64) int64 {if x < 0 {return -x}; return x}
func min(args ...int) int { mn, _ := minMaxFinder(args...); return mn }
func max(args ...int) int { _, mx := minMaxFinder(args...); return mx }
func minMaxFinder(args ...int) (int, int) { minVal, maxVal := int(math.MaxInt32), int(math.MinInt32); for _, v := range args { if v < minVal { minVal = v }; if v > maxVal { maxVal = v } }; return minVal, maxVal }


/*
URL:
https://codeforces.com/problemset/problem/1114/C
*/

package main

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

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, b int64
)

func main() {
	n, b = ReadInt64_2()

	if n == 1 {
		fmt.Println(0)
		return
	}

	memo := TrialDivision(b)

	counts := make(map[int64]int64)
	for a := range memo {
		cnt := int64(0)
		cur := a
		for n/cur > 0 {
			cnt += n / cur
			// PrintfDebug("cur: %d, diff: %d\n", cur, n/cur)

			if IsProductOverflow(cur, a, INF_INT64) {
				break
			}

			cur *= a
		}

		counts[a] = cnt
	}
	// PrintfDebug("素因数分解: %v\n", memo)
	// PrintfDebug("カウント: %v\n", counts)

	ans := int64(INF_INT64)
	for a, cnt := range counts {
		e := memo[a]
		ChMin(&ans, cnt/e)
	}
	fmt.Println(ans)
}

func IsProductOverflow(i, j, m int64) bool {
	return float64(i)*float64(j) > float64(m)
}

func IsAddOverflow(i, j, m int64) bool {
	return float64(i)+float64(j) > float64(m)
}

// ChMin accepts a pointer of integer and a target value.
// If target value is SMALLER than the first argument,
//	then the first argument will be updated by the second argument.
func ChMin(updatedValue *int64, target int64) bool {
	if *updatedValue > target {
		*updatedValue = target
		return true
	}
	return false
}

// TrialDivision returns the result of prime factorization of integer N.
func TrialDivision(n int64) map[int64]int64 {
	var i, exp int64
	p := map[int64]int64{}

	if n <= 1 {
		panic(errors.New("[argument error]: TrialDivision only accepts a NATURAL number"))
	}

	for i = 2; i*i <= n; i++ {
		exp = 0
		for n%i == 0 {
			exp++
			n /= i
		}

		if exp == 0 {
			continue
		}
		p[i] = exp
	}
	if n > 1 {
		p[n] = 1
	}

	return p
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}


package main

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

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

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

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

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

var debug = true

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

func main() {
	defer writer.Flush()

	n := getLine2Int()
	input := getLine2Ints(n)
	min, zero := 0, 2
	for i := 0; i < n; i++ {
		if input[i] == 0 {
			zero++
		} else {
			if zero <= 1 {
				min += zero + 1
			} else {
				min++
			}
			zero = 0
		}
	}
	printf("%d\n", min)
}


package main

import (
	"fmt"
	"strings"
)

func is_palindrome(t string) bool {
	var c []string = strings.Split(t, "")

	for i, j := 0, len(c)-1; i < j; i, j = i+1, j-1 {
		c[i], c[j] = c[j], c[i]
	}

	u := strings.Join(c, "")

	if t == u {
		return true
	}

	return false
}

func get_trailing_scores_count(t string) int {

	count := 0

	for i := len(t) - 1; i > 0; i = i - 1 {
		if t[i] == '0' {
			count += 1
		} else {
			break
		}
	}

	return count
}

func add_leading_zeros(t string, c int) string {
	u := t

	for i := 0; i < c; i = i + 1 {
		u = "0" + u
	}

	return u
}

func solve(t string) bool {

	if is_palindrome(t) {
		return true
	}

	trailing_zeros := get_trailing_scores_count(t)

	u := add_leading_zeros(t, trailing_zeros)

	if is_palindrome(u) {
		return true
	}

	return false
}

func main() {
	var t string

	fmt.Scanf("%s", &t)

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


package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanln(&n)
	var a = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}

	var m, v int // 2 -spr 1 -cnt
	for i := 0; i < n; i++ {
		if a[i] == 0 {
			v++
			m = 0
		} else if a[i] == 1 && m != 1 {
			m = 1
		} else if a[i] == 2 && m != 2 {
			m = 2
		} else if a[i] == 3 {
			if m == 1 {
				m = 2
			} else if m == 2 {
				m = 1
			} else {
				if i+1 < n {
					if a[i+1] == 1 {
						m = 2
					} else if a[i+1] == 2 {
						m = 1
					}
				} else {
					m = 0
				}
			}
		} else {
			v++
			m = 0
		}
	}
	fmt.Println(v)
}


package main

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

var bufin *bufio.Reader
var bufout *bufio.Writer

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()

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

	var s string
	fmt.Fscanf(bufin, "%s\n", &s)

	for i := 0; i < n; i++ {
		if (i+2 < n) && (s[i] == 'o') && (s[i+1] == 'g') && (s[i+2] == 'o') {
			j := i + 3
			for (j+1 < n) && (s[j] == 'g') && (s[j+1] == 'o') {
				j += 2
			}
			i = j - 1
			fmt.Fprintf(bufout, "***")
		} else {
			fmt.Fprintf(bufout, "%c", s[i])
		}
	}
}


package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}

func smallestPrimeFactor(x int64) int64 {
  for a := int64(2); a * a <= x; a++ {
    if x % a == 0 {
      return a
    }
  }
  return x
}

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

  n := getI64()
  x := n
  factors := []int64{}
  for len(factors) < 3 {
    a := smallestPrimeFactor(x)
    if a == 1 {
      break
    }
    factors = append(factors, a)
    x /= a
  }
  if len(factors) < 2 {
    writer.WriteString("1\n0\n")
  } else if len(factors) == 2 {
    writer.WriteString("2\n")
  } else {
    writer.WriteString(fmt.Sprintf("1\n%d\n", factors[0] * factors[1]))
  }
}


package main

import "fmt"

func check(a int) bool {
	var count int
	for a != 0 {
		if a%10 != 0 {
			count++
		}
		if count == 2 {
			return false
		}
		a = a / 10
	}
	return true
}

func lenint(a int) int {
	var count int
	for a != 0 {
		a = a / 10
		count++
	}
	return count
}

func main() {
	var n int
	var tmp, tmp2 int
	fmt.Scanf("%d", &n)
	tmp2 = n
	tmp = lenint(n)
	if tmp == 1 {
		fmt.Println("1")
	} else {
		for i := 0; i < tmp-1; i++ {
			n = n / 10
		}
		n++
		for i := 0; i < tmp-1; i++ {
			n = n * 10
		}
		fmt.Println(n - tmp2)
	}
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)
	d := make([]int, n)
	used := make([]bool, 10001)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &d[i])
	}
	sort.Ints(d)
	var biggest = d[n-1]
	for i := n - 1; i >= 0; i-- {
		if biggest%d[i] != 0 || used[d[i]] {
			fmt.Println(biggest, d[i])
			break
		}
		used[d[i]] = true
	}
	return
}


package main

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

func solve() {
	a := readInt()
	b := readInt()
	if (a+1 == b || b+1 == a || a == b) && !(a == 0 && b == 0) {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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


package main

import "fmt"

func main() {
	var h int
	var n int64
	fmt.Scanf("%d %d", &h, &n)
	n -= 1
	tn := int64(1)
	r := int64(0)
	for i := 0; i < h; i++ {
		tn *= 2
	}
	isLeft := true
	for i := 0; i < h; i++ {
		tn /= 2
		r += 1
		if tn&n > 0 {
			if isLeft {
				r += 2*tn - 1
			}
			isLeft = true
		} else {
			if !isLeft {
				r += 2*tn - 1
			}
			isLeft = false
		}
	}
	fmt.Println(r)
}


package main

import "fmt"

func main() {
    var n,i int

    fmt.Scan(&n)
    if n<=2 {
    fmt.Println(-1)
}else{
        for i=n;i>=1;i--{
        fmt.Println(i)
    }
}
}


package main

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

var (
	p int
	ibuf []byte
)

func IsSpace(b byte) bool {
	switch b {
	case ' ', '\t', '\n', '\r':
		return true
	default:
		return false
	}
}

func IsDigit(b byte) bool {
	return '0' <= b && b <= '9'
}

func ReadWord() string {
	for ; p < len(ibuf) && IsSpace(ibuf[p]); p++ {
	}
	buf := make([]byte, 0)
	for ; p < len(ibuf) && IsSpace(ibuf[p]); p++ {
		buf = append(buf, ibuf[p])
	}
	return string(buf)
}

func ReadInt() int {
	for ; p < len(ibuf) && !IsDigit(ibuf[p]) && ibuf[p] != '-'; p++ {
	}
	s := 1
	if ibuf[p] == '-' {
		s = -1
		p++
	}

	d := 0
	for ; p < len(ibuf) && IsDigit(ibuf[p]); p++ {
		d = 10 * d + int(ibuf[p] - '0')
	}
	return s * d
}

func ReadInt64() int64 {
	for ; p < len(ibuf) && !IsDigit(ibuf[p]) && ibuf[p] != '-'; p++ {
	}
	s := int64(1)
	if ibuf[p] == '-' {
		s = int64(-1)
		p++
	}
	d := int64(0)
	for ; p < len(ibuf) && IsDigit(ibuf[p]); p++ {
		d = int64(10) * d + int64(ibuf[p] - '0')
	}
	return s * d
}

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

func Min(a, b int64) int64 {
	if a < b {
		return a
	} else {
		return b
	}
}

func Abs(a int64) int64 {
	if a < 0 {
		return -a
	} else {
		return a
	}
}

func LowerBound(a []int64, x int64) int {
	ub, lb := len(a), 0
	for ub - lb > 1 {
		mid := (ub + lb) / 2
		if a[mid] < x {
			lb = mid
		} else {
			ub = mid
		}
	}
	return ub
}

func UpperBound(a []int64, x int64) int {
	ub, lb := len(a), 0
	for ub - lb > 1 {
		mid := (ub + lb) / 2
		if a[mid] > x {
			ub = mid
		} else {
			lb = mid
		}
	}
	return ub
}

type Container []int64

func (a Container) Len() int {
	return len(a)
}

func (a Container) Swap(i, j int) {
	a[i], a[j] = a[j], a[i]
}

func init() {
	p = 0
	ibuf, _ = ioutil.ReadAll(os.Stdin)
}

func solve(n, a, b int64) (int64, int64) {
	ra, rb := int64(1) << 30, int64(1) << 30
	min_b := b
	for a < n {
		b = (n - 1) / a + 1
		if b < min_b {
			break
		}
		if a * b < ra * rb {
			ra, rb = a, b
		}
		a = (n - 1) / (b - 1) + 1
	}
	return ra, rb
}

func main() {
	n, a, b := 6 * ReadInt64(), ReadInt64(), ReadInt64()
	if n <= a * b {
		fmt.Println(a * b)
		fmt.Println(a, b)
		return;
	}
	a1, b1 := solve(n, a, b)
	b2, a2 := solve(n, b, a)
	if (a1 * b1 < a2 * b2) {
		fmt.Println(a1 * b1)
		fmt.Println(a1, b1)
	} else {
		fmt.Println(a2 * b2)
		fmt.Println(a2, b2)
	}
}


package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	if n == 2 {
		fmt.Println(2)
	} else {
		fmt.Println(1)
	}
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanInt := func() int {
		scanner.Scan()
		num, err := strconv.Atoi(scanner.Text())
		if err != nil {
			log.Fatal(err)
		}
		return num
	}

	n, index := scanInt(), scanInt()-1
	c := make([]bool, n)
	for i := 0; i < n; i++ {
		c[i] = scanInt() == 1
	}

	total := 0
	if c[index] {
		total = 1
	}
	for i := 1; i < 100; i++ {
		l, r := index-i, index+i
		if (l < 0) && (r >= n) {
			break
		}
		if (l >= 0) && (r < n) && c[l] && c[r] {
			total += 2
		}
		if (l >= 0) && (r >= n) && c[l] {
			total++
		}
		if (l < 0) && (r < n) && c[r] {
			total++
		}
	}
	fmt.Println(total)
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var n float64
	fmt.Scanf("%f", &n)
	fmt.Println(int64(math.Pow(2, n+1)) - 2)
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	pos := true
	toBin := func(r rune) rune {
		if r - '0' > 0 {
			pos = true
			return '1'
		}
		return '0'
	}
	dec := func(r rune) rune {
		if r - '0' > 0 {
			return r - 1
		}
		return '0'
	}

	res := ""
	k := 0
	for ; pos; k++ {
		pos = false
		buf := strings.Map(toBin, s)
		if pos == false {
			break
		}
		i := 0
		for ; buf[i] == '0'; i++ {}
		res += " " + buf[i:]
		s = strings.Map(dec, s)
	}
	fmt.Println(k)
	fmt.Println(res[1:])
}


package main

import "fmt"

func main() {
	var s string
	var arr []byte
	var flag bool
	fmt.Scanf("%s", &s)
	for i := range s {
		flag = false
		for j := 0; j < len(arr); j++ {
			if s[i] == arr[j] {
				flag = true
				break
			}
		}
		if !flag {
			arr = append(arr, s[i])
		}
	}
	if len(arr)%2 == 0 {
		fmt.Println("CHAT WITH HER!")
	} else {
		fmt.Println("IGNORE HIM!")
	}
}


package main

import (
	"fmt"
)

func readNIntegersAndSave(n int, registry *Registry) ([]int) {
	result := make([]int, n)
	for i := range result[:n] {
		fmt.Scanf("%d", &result[i])
		(*registry)[result[i]] = true
	}
	return result
}

type Registry map[int]bool

func main() {
	fmt.Println("Karen")
	return
	var n int
	registry := make(Registry)

	fmt.Scanf("%d", &n)

	counter := 0
	koyomi, karen := readNIntegersAndSave(n, &registry), readNIntegersAndSave(n, &registry)

	for i := range koyomi {
		for j := range karen {
			if registry[koyomi[i]^karen[j]] {
				counter++
			}
		}
	}

	if (counter%2 == 0) {
		fmt.Println("Karen")
	} else {
		fmt.Println("Koyomi")
	}
}


package main

import "fmt"

func gcd(a int, b int, x *int, y *int) int {
    if a == 0 {
        *x, *y = 0, 1
        return b
    }
    var xx, yy int
    g := gcd(b%a, a, &xx, &yy)
    *x = yy - (b/a)*xx
    *y = xx
    return g
}

func normal(n int, mod *int) int {
    n %= (*mod)
    if n < 0 {
        n += (*mod)
    }
    return n
}

func inv(a int, mod *int) int {
    var x, y int
    gcd(a, *mod, &x, &y)
    return normal(x, mod)
}

func addmod(a, b int, mod *int) int {
    if a + b >= (*mod) {
        return a + b - (*mod)
    } else {
        return a + b
    }
}

func submod(a, b int, mod *int) int {
    if a - b < 0 {
        return a - b + (*mod)
    } else {
        return a - b
    }
}

func mulmod(a, b int, mod *int) int {
    return int((int64(a)*int64(b))%int64(*mod))
}

func divmod(a, b int, mod *int) int {
    return mulmod(a, inv(b, mod), mod)
}

func binpowmod(a, b int, mod *int) int {
    ans := 1
    for b > 0 {
        if b%2 == 1 {
            ans = mulmod(ans, a, mod)
        }
        a = mulmod(a, a, mod)
        b = b/2
    }
    return ans
}

func calc(y []int, x int, mod *int) int {
    ans := 0
    k := 1
    for j := 1; j < len(y); j++ {
        k = mulmod(k, normal(x - j, mod), mod)
        k = divmod(k, normal(0 - j, mod), mod)
    }
    for i := 0; i < len(y); i++ {
        ans = addmod(ans, mulmod(y[i], k, mod), mod)
        if (i + 1) >= len(y) {
            break
        }
        k = mulmod(k, divmod(normal(x - i, mod), normal(x - (i + 1), mod), mod), mod)
        k = mulmod(k, divmod(normal(i - (len(y) - 1), mod), normal(i + 1, mod), mod), mod)
    }
    return ans
}

func main() {
    var n, k int
    var mod int = 1000000007
    var y []int = make([]int, 0)
    s := 0
    y = append(y, s)
    fmt.Scanf("%d %d", &n, &k)
    for i := 0; i < k + 1; i++ {
        s = addmod(s, binpowmod(i + 1, k, &mod), &mod) //k-th powwer of (i+1)
        y = append(y, s)
    }
    if n < len(y) {
        fmt.Printf("%d", y[n])
    } else {
        p := calc(y, n, &mod)
        fmt.Printf("%d", p)
    }
}


package main

import (
    "strconv"
    "bufio"
    "os"
    "fmt"
)
// var file, _ = os.Open("input.txt")
// var outfile, _ = os.Create("output.txt")
// var in = bufio.NewScanner(file)
// var out = bufio.NewWriter(outfile)
var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
    if !in.Scan() {
        panic("Scan error")
    }
    return in.Text()
}

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

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

func intersect(l1 int, r1 int, l2 int, r2 int) bool {
    if l1 > r1 {
        l1, r1 = r1, l1
    }
    if l2 > r2 {
        l2, r2 = r2, l2
    }
    return l1 < l2  && l2 < r1 && r1 < r2 || l2 < l1 && l1 < r2 && r2 < r1
}

func main() {
    defer out.Flush()
    in.Split(bufio.ScanWords)
    n := nextInt()
    a := make([]int, n)
    for i := 0; i < n; i++ {
        a[i] = nextInt()
    }

    for i := 0; i < n - 1; i++ {
        for j := i + 1; j < n - 1; j++ {
            if intersect(a[i], a[i + 1], a[j], a[j + 1]) {
                fmt.Fprintln(out, "yes")
                return
            }
        }
    }
    fmt.Fprintln(out, "no")
}


package main

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

var stdReader *bufio.Reader = bufio.NewReader(os.Stdin)

func readInt() (result int) {
	var negative, started bool
READER_LOOP:
	for {
		char, err := stdReader.ReadByte()
		switch {
		case err != nil:
			break READER_LOOP
		case char == '-':
			negative = true
		case unicode.IsDigit(rune(char)):
			started = true
			result = result*10 + int(char&0xf)
		case started:
			break READER_LOOP
		}
	}
	if negative {
		result = -result
	}
	return
}

func main() {
	n := readInt()
	maj := make([]int, n)
	var sum int
	for i := range maj {
		maj[i] = readInt()
		sum += maj[i]
	}

	one := sum / (n / 2)
LOOP:
	for i := range maj {
		if maj[i] == 0 {
			continue
		}
		for j := len(maj) - 1; j > i; j-- {
			if maj[i]+maj[j] == one {
				maj[i] = 0
				maj[j] = 0
				fmt.Printf("%d %d\n", i+1, j+1)
				continue LOOP
			}
		}
	}
}


// Author: sighduck
// URL: https://codeforces.com/contest/1216/problem/C

package main

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

type Point struct {
	X int
	Y int
}

type Rectangle struct {
	BottomLeft Point
	TopRight   Point
}

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

func min(x int, y int) int {
	if x < y {
		return x
	}
	return y
}

func intersection(R1, R2 Rectangle) Rectangle {
	bottomLeft := Point{
		X: max(R1.BottomLeft.X, R2.BottomLeft.X),
		Y: max(R1.BottomLeft.Y, R2.BottomLeft.Y),
	}
	topRight := Point{
		X: min(R1.TopRight.X, R2.TopRight.X),
		Y: min(R1.TopRight.Y, R2.TopRight.Y),
	}
	if topRight.X <= bottomLeft.X || topRight.Y <= bottomLeft.Y {
		return Rectangle{BottomLeft: Point{0, 0}, TopRight: Point{0, 0}}
	}
	return Rectangle{BottomLeft: bottomLeft, TopRight: topRight}
}

func area(R Rectangle) int64 {
	return int64(R.TopRight.X-R.BottomLeft.X) * int64(R.TopRight.Y-R.BottomLeft.Y)
}

func Solve(R1, R2, R3 Rectangle) string {
	R4 := intersection(R1, R2)
	R5 := intersection(R1, R3)
	R6 := intersection(R4, R5)
	coveredArea := area(R4) + area(R5) - area(R6)
	if area(R1) > coveredArea {
		return "YES"
	}
	return "NO"
}

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

	var R1, R2, R3 Rectangle
	fmt.Fscanf(reader, "%d %d %d %d\n", &R1.BottomLeft.X, &R1.BottomLeft.Y, &R1.TopRight.X, &R1.TopRight.Y)
	fmt.Fscanf(reader, "%d %d %d %d\n", &R2.BottomLeft.X, &R2.BottomLeft.Y, &R2.TopRight.X, &R2.TopRight.Y)
	fmt.Fscanf(reader, "%d %d %d %d\n", &R3.BottomLeft.X, &R3.BottomLeft.Y, &R3.TopRight.X, &R3.TopRight.Y)

	fmt.Fprintf(writer, "%s\n", Solve(R1, R2, R3))
}


package main

import (
	"fmt"
	"math"
)

func gcd(a, b int64) int64 {
	switch {
	case a == 0 && b > 0:
		return b
	case a > 0 && b == 0:
		return a
	case a == b:
		return a
	case a == 1 && b > 0:
		return 1
	case a > 0 && b == 1:
		return 1
	case a%2 == 0 && b%2 == 0:
		return 2 * gcd(a/2, b/2)
	case a%2 == 0 && b%2 == 1:
		return gcd(a/2, b)
	case a%2 == 1 && b%2 == 0:
		return gcd(a, b/2)
	case b > a:
		return gcd((b-a)/2, a)
	case b < a:
		return gcd((a-b)/2, b)
	default:
		panic("not reachable")
	}
}

func main() {
	var n, k int64
	fmt.Scanf("%d %d", &n, &k)
	k = int64(math.Pow10(int(k)))
	fmt.Println(n * k / gcd(n, k))
}


package main

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

func main() {
	n, m := scanInt(), scanInt()
	if 9 * n < m || (m < 1 && n > 1){
		printFmt("-1 -1")
		return
	}
	min := getMin(n,m)
	max := getMax(n,m)

	printFmt(min, max)

	close(channelType)
	oWg.Wait()
}

func getMax(n, m int) string{
	var max string
	for m > 9{
		max = max + "9"
		m -= 9
		n--
	}

	max = max + strconv.Itoa(m)
	n--
	for i := 0; i < n; i++{
		max = max + "0"
	}
	return max
}

func getMin(n, m int) string{
	var min string
	for m > 9{
		min = "9" + min
		m -= 9
		n--
	}

	if n == 1{
		min = strconv.Itoa(m) + min
	}else{
		if m > 1{
			min = strconv.Itoa(m-1) + min
			n--
		}

		for i:= 0; i < n-1; i++{
			min = "0" + min
		}
		min = "1" + min
	}
	return min
}

/*********************** I/O ***********************/

var channelType chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var printFmt func(a ...interface{}) (n int, err error)

func init() {
	printFmt = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	channelType = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range channelType {
			writer.WriteString(line + "\n")
		}
	}()
}

func scanString() string {in.Scan(); return in.Text() }
func scanInt() int {i, _ := strconv.Atoi(scanString()); return i}
func scanInt64() int64 {i, _ := strconv.ParseInt(scanString(), 10, 64); return i}
func scanStringSlice(n int) []string {s := make([]string, n); for i := 0; i < n; i++ {s[i] = scanString()}; return s}
func scanIntSlice(n int) []int {arr := make([]int, n); for i := 0; i < n; i++ {arr[i] = scanInt()}; return arr}
func scanInt64Slice(n int) []int64 {arr := make([]int64, n); for i := 0; i < n; i++ {arr[i] = scanInt64()}; return arr}

/*********************** Utils ***********************/

func stringEquivalent(v interface{}) string {return fmt.Sprintf("%v", v)}
func spaceSeperatedStringFromArray(a []int) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.Itoa(a[i]) + " ")}; return sb.String()}
func spaceSeperatedStringFromArray64(a []int64) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.FormatInt(a[i], 10) + " ")}; return sb.String()}
func minMaxFromArray(args ...int64) (int64, int64) {minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64); for _, v := range args {if v < minVal {minVal = v}; if v > maxVal {maxVal = v}}; return minVal, maxVal}
func minElementFromArray(args ...int64) int64 { mn, _ := minMaxFromArray(args...); return mn }
func maxElementFromArray(args ...int64) int64 { _, mx := minMaxFromArray(args...); return mx }
func lcmCalculation(a, b int64) int64 {return a / gcdCalculation(a, b) * b}
func gcdCalculation(a, b int64) int64 {if (a == 0) {return b}; return gcdCalculation(b%a, a)}
func sortInt64Slice(a []int64) {sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })}
func absoluteValue(x int64) int64 {if x < 0 {return -x}; return x}
func min(args ...int) int { mn, _ := minMaxFinder(args...); return mn }
func max(args ...int) int { _, mx := minMaxFinder(args...); return mx }
func minMaxFinder(args ...int) (int, int) { minVal, maxVal := int(math.MaxInt32), int(math.MinInt32); for _, v := range args { if v < minVal { minVal = v }; if v > maxVal { maxVal = v } }; return minVal, maxVal }


/*
URL:
https://codeforces.com/problemset/problem/1312/D
*/

package main

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

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 998244353
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n, m int64
)

func main() {
	n, m = ReadInt64_2()

	if n == 2 {
		fmt.Println(0)
		return
	}

	cf := NewCombFactorial(500000)

	ans := int64(1)
	ans *= cf.C(m, n-1)
	ans %= MOD
	ans *= n - 2
	ans %= MOD
	ans *= cf.modpow(2, n-3)
	ans %= MOD

	fmt.Println(ans)
}

// cf := NewCombFactorial(500000) // maxNum == "maximum n" * 2 (for H(n,r))
// res := cf.C(n, r) 	// 組み合わせ
// res := cf.H(n, r) 	// 重複組合せ
// res := cf.P(n, r) 	// 順列

type CombFactorial struct {
	factorial, invFactorial []int64
	maxNum                  int64
}

func NewCombFactorial(maxNum int64) *CombFactorial {
	cf := new(CombFactorial)
	cf.maxNum = maxNum
	cf.factorial = make([]int64, maxNum+50)
	cf.invFactorial = make([]int64, maxNum+50)
	cf.initCF()

	return cf
}
func (c *CombFactorial) modInv(a int64) int64 {
	return c.modpow(a, MOD-2)
}
func (c *CombFactorial) modpow(a, e int64) int64 {
	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := c.modpow(a, halfE)
		return half * half % MOD
	}

	return a * c.modpow(a, e-1) % MOD
}
func (c *CombFactorial) initCF() {
	var i int64

	for i = 0; i <= c.maxNum; i++ {
		if i == 0 {
			c.factorial[i] = 1
			c.invFactorial[i] = c.modInv(c.factorial[i])
			continue
		}

		num := i * c.factorial[i-1]
		num %= MOD
		c.factorial[i] = num
		c.invFactorial[i] = c.modInv(c.factorial[i])
	}
}
func (c *CombFactorial) C(n, r int64) int64 {
	var res int64

	res = 1
	res *= c.factorial[n]
	res %= MOD
	res *= c.invFactorial[r]
	res %= MOD
	res *= c.invFactorial[n-r]
	res %= MOD

	return res
}
func (c *CombFactorial) P(n, r int64) int64 {
	var res int64

	res = 1
	res *= c.factorial[n]
	res %= MOD
	res *= c.invFactorial[n-r]
	res %= MOD

	return res
}
func (c *CombFactorial) H(n, r int64) int64 {
	return c.C(n-1+r, r)
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}


package main

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

var scanner = bufio.NewScanner(os.Stdin)

func readInt() int {
	scanner.Scan()
	n, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic(err)
	}
	return n
}

func readLong() int64 {
	scanner.Scan()
	n, err := strconv.ParseInt(scanner.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return n
}

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

func main() {
	scanner.Split(bufio.ScanWords)

	n, a, x, b, y := readInt(), readInt(), readInt(), readInt(), readInt()

	a--
	x--
	b--
	y--
	for {
		if a == b {
			fmt.Println("YES")
			return
		}
		if a == x || b == y {
			break
		}
		a = (a + 1) % n
		b = (b - 1 + n) % n
	}
	fmt.Println("NO")
}


package main

import "fmt"

func main() {

	var a, b int
	fmt.Scanf("%d %d\n", &a, &b)

	if a == b {
		fmt.Printf("%d0 %d1", a, b)
	} else if a == b-1 {
		fmt.Printf("%d9 %d0", a, b)
	} else if a == 9 && b == 1 {
		fmt.Println("9 10")
	} else {
		fmt.Println(-1)
	}
}


package main

import (
	"fmt"
)

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

	xys := [2][2]int{}
	xyc := [2]int{}

	for i := 0; i < n; i++ {
		var xy [2]int
		if _, err := fmt.Scanf("%d %d\n", &xy[0], &xy[1]); err != nil {
			return
		}
		for j := 0; j < 2; j++ {
			if xyc[j] == 0 {
				xys[j][0] = xy[j]
				xyc[j] += 1
			} else if xys[j][0] != xy[j] {
				xys[j][1] = xy[j]
				xyc[j] += 1
			}
		}
	}

	if xyc[0] < 2 || xyc[1] < 2 {
		fmt.Println(-1)
	} else {
		fmt.Println(abs(xys[0][0]-xys[0][1]) * abs(xys[1][0]-xys[1][1]))
	}
}

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


package main

import (
	"fmt"
)

func main() {
	var l, r int64
	fmt.Scan(&l, &r)

	var p uint64
	for i := uint64(1); l != 0 || r != 0; i++ {
		if l&1^r&1 == 1 {
			p = (1 << i) - 1
		}
		l >>= 1
		r >>= 1
	}
	fmt.Println(p)
}


package main

import (
	"fmt"
)

func find_lcm(n,m int)(res int){
	x:=n
	y:=m
	for ;n!=m;{
		if n>m{
			n=n-m
		}else{
			m=m-n
		}
	}
	res=x*y/n
	return

}

func main(){

	/*a:= bufio.NewReader(os.Stdin)
	input,_:= a.ReadString('\n')
	n,m,z:= strings.Split(input," ")
	fmt.Println(n,m,z) */

	var n,m,z int
	fmt.Scan(&n, &m, &z);

	lcm := find_lcm(n,m)

	 fmt.Println(z/lcm)
}


package main

import (
	"fmt"
	"sort"
)

func main(){
	bags:=make([]int,4)
	for i:=0;i<len(bags);i++{
		fmt.Scanf("%d",&bags[i])
	}
	sort.Ints(bags)
	max:=bags[3]
	if (max==bags[0]+bags[1]+bags[2]){
		fmt.Println("YES")
	}else if (max+bags[0]==bags[1]+bags[2]){
		fmt.Println("YES")
	}else{
		fmt.Print("NO")
	}
}


package main

import "fmt"

var w1, h1, w2, h2, result int64

func main() {
	fmt.Scan(&w1)
	fmt.Scan(&h1)
	fmt.Scan(&w2)
	fmt.Scan(&h2)

	result = (2*(w1+h1) + 4) + (2*h2 + w2 + 2) - w2 - 2
	fmt.Println(result)
}


package main

import "fmt"

var MOD int64 = 1000000007

func expo(base, exponent, modulus int64) int64 {
	if modulus == 1 {
		return 0
	}
	if exponent == 0 {
		return 1
	}

	result := expo(base, exponent/2, modulus)
	result = (result * result) % modulus
	if exponent&1 != 0 {
		return ((base % modulus) * result) % modulus
	}
	return result % modulus
}

func main() {
	var n, m int64
	fmt.Scanf("%d %d", &n, &m)
	fmt.Println(expo((expo(2, m, MOD)-1+MOD)%MOD, n, MOD))
}


package main

import "fmt"

func main() {
    var h,m int
    fmt.Scanf("%d:%d\n",&h,&m)
    for {
        m++
        if m > 59 {
            m = 0
            h++
            if h > 23 { h = 0 }
        }
        if (h%10 == m/10) && (h/10 == m%10) { break }
    }
    fmt.Printf("%02d:%02d\n",h,m)
}


// http://codeforces.com/problemset/problem/651/A
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

const (
	MOD = 1e9 + 7
)

type (

)

func main () {
	var (
		n1, n2 int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)
	fmt.Fscanln(input, &n1, &n2)

	ans := 0
	for n1 > 0 && n2 > 0  {
		//fmt.Println(n1, n2)
		if n1 > 2 {
			n1 -= 2
			n2++
			ans++
		} else {
			n1, n2 = n2, n1

			if (n1 == 2 && n2 == 2) || (n1 * n2 == 2) {
				ans++
				break
			}

			if n1 * n2 < 2 {
				break
			}
		}
	}

	fmt.Println(ans)
}


package main

import "fmt"

var mem [205][205][205]bool

func can(r, g, b int) {
	if mem[r][g][b] {
		return
	}
	mem[r][g][b] = true
	if r >= 1 && g >= 1 {
		can(r-1, g-1, b+1)
	}
	if r >= 1 && b >= 1 {
		can(r-1, g+1, b-1)
	}
	if g >= 1 && b >= 1 {
		can(r+1, g-1, b-1)
	}
	if r >= 2 {
		can(r-1, g, b)
	}
	if g >= 2 {
		can(r, g-1, b)
	}
	if b >= 2 {
		can(r, g, b-1)
	}
}

func main() {
	var n int
	fmt.Scan(&n)
	var s string
	fmt.Scan(&s)
	var r, g, b int
	for _, c := range s {
		switch c {
		case 'B':
			b++
		case 'G':
			g++
		case 'R':
			r++
		default:
			panic(c)
		}
	}

	can(r, g, b)

	var res []byte
	if mem[0][0][1] {
		res = append(res, 'B')
	}
	if mem[0][1][0] {
		res = append(res, 'G')
	}
	if mem[1][0][0] {
		res = append(res, 'R')
	}
	fmt.Printf("%s\n", res)
}


package main

// @snippet <contest.go#0.0.0:header/import.go>
import "fmt"
import "io"
import "os"
import "strings"
import "text/scanner"
// @snippet <contest.go#0.0.0:header/typedef.go>
type Int int64
type IntSlice []Int
// @snippet <contest.go#0.0.0:utils/read.go>
var sc scanner.Scanner

func ReadInt(n *Int) bool {
  tok := sc.Scan()
  if tok != scanner.EOF {
    fmt.Sscan(sc.TokenText(), &n)
    return true
  } else {
    return false
  }
}

func ReadString(s *string) bool {
  tok := sc.Scan()
  if tok != scanner.EOF {
    *s = sc.TokenText()
    return true
  } else {
    return false
  }
}
// @snippet <contest.go#0.0.0:utils/stream.go>
func Stdin() io.Reader {
  return os.Stdin
}

func Strin(s string) io.Reader {
  return strings.NewReader(s)
}
// @snippet <contest.go#0.0.0:main.go>

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

func findMin(s string) string {
  res := ""
  for i, c := range s {
    if i == 0 && c == '9' {
      res += "9"
    } else {
      res += string(min(c, '9' - c + '0'))
    }
  }
  return res
}

func main() {
  sc.Init(Stdin())
  var s string
  for ReadString(&s) {
    fmt.Println(findMin(s))
  }
}


package main

import (
	"fmt"
)

var (
	n      int
	m      int
	result int
)

func in() {
	fmt.Scanf("%d %d\n", &n, &m)
}

func out() {
	fmt.Println(result)
}

func run() {
	var remain int = n
	var d int = 1
	for ; remain > 0; d++ {
		if d%m != 0 {
			remain--
		}
	}
	result = d - 1
}

func main() {
	in()
	run()
	out()
}


package main

import "fmt"

func main() {
	var l1, r1, l2, r2, k int64
	fmt.Scan(&l1, &r1, &l2, &r2, &k)

	l := l1
	if l2 > l1 {
		l = l2
	}
	r := r1
	if r2 < r1 {
		r = r2
	}

	result := r - l + 1
	if k >= l && k <= r {
		result--
	}

	if result < 0 {
		result = 0
	}

	fmt.Println(result)
}


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

func main(){
	var i,c int
	var s string
	var cmax rune
	fmt.Scan(&s)
	out := bufio.NewWriter(os.Stdout)
	r:=make([]rune,len(s))
	for i,v:=range s {
		r[i]=v
	}
	for i=0;i<len(s);i++ {
		if r[i]>cmax {
			cmax=r[i]
			c=1
		} else if r[i]==cmax {
			c++
		}
	}
	for i=0;i<c;i++ {
		out.WriteRune(cmax)
	}
	out.Flush()
}


package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

var (
	r *bufio.Reader
	w *bufio.Writer
)

func init() {
	if f, err := os.Open("in.txt"); err == nil {
		r = bufio.NewReader(f)
	} else {
		r = bufio.NewReader(os.Stdin)
	}
	w = bufio.NewWriter(os.Stdout)
}

func main() {
	defer w.Flush()
	var n int
	for I(&n, " ") == nil {
		solve(n)
	}
}

func solve(n int) {
	var m int
	I(&m, "\n")
	o := 0
	ans := 1
	for i := 0; i < n; i++ {
		var t int
		s := " "
		if i == n-1 {
			s = "\n"
		}
		I(&t, s)
		if o+t <= m {
			o += t
		} else {
			ans++
			o = t
		}
	}
	O(ans, "\n")
}


package main
import (
		"fmt"
       )
func main() {
	var m, n int
	fmt.Scan(&m, &n)
	fmt.Print((m*n)/2)
}


package main

import "fmt"

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

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

func main(){
	var n int
	fmt.Scanln(&n)
	fmt.Println(2 * n * (n - 1) + 1)
}


package main

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

func main() {
	var s, t string
	//fmt.Scanf("%s", &s)
	//fmt.Scanf("%s", &t)
	reader := bufio.NewReader(os.Stdin)
	s, _ = reader.ReadString('\n')
	t, _ = reader.ReadString('\n')
	res := solve(s, t)
	fmt.Println(len(res))
	for _, x := range res {
		fmt.Println(x)
	}
}

func solve(s, t string) []string {
	dx := int(t[0]) - int(s[0])
	dy := int(t[1]) - int(s[1])
	res := make([]string, 0, 8)
	if dx != 0 && dy != 0 {
		cnt := min(abs(dx), abs(dy))
		var a = "R"
		if dx < 0 {
			a = "L"
			dx += cnt
		} else {
			dx -= cnt
		}
		var b = "U"
		if dy < 0 {
			b = "D"
			dy += cnt
		} else {
			dy -= cnt
		}
		for cnt > 0 {
			res = append(res, a+b)
			cnt--
		}
	}

	if dx != 0 {
		a := "R"
		if dx < 0 {
			a = "L"
		}
		cnt := abs(dx)
		for cnt > 0 {
			res = append(res, a)
			cnt--
		}
	}
	if dy != 0 {
		b := "U"
		if dy < 0 {
			b = "D"
		}
		cnt := abs(dy)
		for cnt > 0 {
			res = append(res, b)
			cnt--
		}
	}
	return res
}

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

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


package main

import (
	"fmt"
	"os"
	"io"
	"bufio"
)
var input io.Reader

func main() {
	var n, k int
	input = bufio.NewReader(os.Stdin)
	fmt.Fscanln(input, &n, &k)
	l, r := 0, n
	for l < r {
		mid := l + (r - l) / 2
		d := k
		lines := mid
		for lines < n && mid / d > 0 {
			lines += mid/d
			d *= k
		}
		if lines < n {
			l = mid + 1
		} else {
			r = mid
		}
	}

	fmt.Println(r)
}


package main

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

var scanner *bufio.Scanner

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

var validChars = "_0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

func valid(s string) bool {
  if len(s) < 1 || len(s) > 16 {
    return false
  }
  for _, ch := range s {
    if strings.IndexRune(validChars, ch) == -1 {
      return false
    }
  }
  return true
}

func validate(s string) bool {
  if strings.Count(s, "@") != 1 || strings.Count(s, "/") > 1 {
    return false
  }

  parts := strings.Split(s, "@")
  username, hostname := parts[0], parts[1]
  if !valid(username) {
    return false
  }

  if strings.Count(hostname, "/") == 1 {
    parts = strings.Split(hostname, "/")
    hostname = parts[0]
    resource := parts[1]
    if !valid(resource) {
      return false
    }
  }

  parts = strings.Split(hostname, ".")
  for _, part := range parts {
    if !valid(part) {
      return false
    }
  }

  return true
}

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

  s := getS()
  result := "YES"
  if !validate(s) {
    result = "NO"
  }
  writer.WriteString(fmt.Sprintf("%s\n", result))
}


package main

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

func get_len(n int64) int64 {
	if n > 1 {
		return 2 * get_len(n/2) + 1
	}
	return n
}

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

func solve(n, l, r int64) int64 {
	var s int64
	if n > 0 {
		k := get_len(n / 2)
		if l < k {
			s += solve(n/2, l, min(r, k - 1))
		}
		if l <= k && k <= r {
			s += n % 2
		}
		if r > k {
			s += solve(n/2, max(l - k - 1, 0), r - k - 1)
		}
		// fmt.Printf("%d %d %d %d\n", n, k, l, r)
	}
	return s
}

func main() {
	cin := NewParser(bufio.NewReaderSize(os.Stdin, 1<<16))
	n := cin.nextInt64()
	l := cin.nextInt64() - 1
	r := cin.nextInt64() - 1
	fmt.Printf("%v", solve(n, l, r))
}

// some io

type ParserReader struct {
	r   io.ByteReader
	err error
	c   byte
}

func NewParser(r io.ByteReader) *ParserReader {
	return &ParserReader{r, nil, 0}
}

func (p *ParserReader) next() error {
	p.c, p.err = p.r.ReadByte()
	return p.err
}

func isDigit(c byte) bool {
	return '0' <= c && c <= '9'
}

func (p *ParserReader) nextUInt64() uint64 {
	for !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var r uint64
	for isDigit(p.c) && p.err == nil {
		r = r*10 + uint64(p.c - '0')
		p.next()
	}
	return r
}

func (p *ParserReader) nextUInt() uint {
	for !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var r uint
	for isDigit(p.c) && p.err == nil {
		r = r*10 + uint(p.c - '0')
		p.next()
	}
	return r
}

func (p *ParserReader) nextInt64() int64 {
	for p.c != '-' && !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var sign bool
	if p.c == '-' {
		sign = true
	}
	r := int64(p.nextUInt64())
	if sign {
		return -r
	}
	return r
}

func (p *ParserReader) nextInt() int {
	for p.c != '-' && !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var sign bool
	if p.c == '-' {
		sign = true
	}
	r := int(p.nextUInt())
	if sign {
		return -r
	}
	return r
}


package main

import "fmt"

func main() {
    var n, k, x, res int
    var a []int

    fmt.Scan(&n, &k, &x)

    a = make([]int, n)

    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
    }

    for i := 0; i < n - k; i++ {
        res += a[i]
    }

    fmt.Print(res + k * x)
}


package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	n := len(s)
	for i := 0; i < n - 2; i++ {
		mark := make([]bool, 3)
		for j := 0; j < 3; j++ {
			if s[i + j] != '.' {
				mark[int(s[i + j]) - int('A')] = true
			}
		}
		valid := true
		for j := 0; j < 3; j++ {
			if !mark[j] {
				valid = false
			}
		}
		if valid {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


package main

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

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

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

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

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

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

/**
TO SEND
Run solve the problem CF1619B
Date: 3/01/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1619/B
Problem: CF1619B
**/
func (in *CF1619B) Run() {
	mapa := make(map[int64]int)
	arr := make([]int64, 0)
	to := int64(math.Sqrt(1000000000))
	for i := int64(1); i <= to; i++ {
		if _, ok := mapa[i*i]; !ok {
			arr = append(arr, int64(i*i))
			mapa[i*i] = 1
		}
		if _, ok := mapa[i*i*i]; !ok {
			arr = append(arr, int64(i*i*i))
			mapa[i*i*i] = 1
		}
	}
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt64()
		count := 0
		for i := 0; i < len(arr); i++ {
			if arr[i] <= n {
				count++
			}
		}
		fmt.Println(count)
	}
}

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

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


package main

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

var scanner *bufio.Scanner

func init() {
	scanner = bufio.NewScanner(bufio.NewReader(os.Stdin))
	//scanner.Buffer(make([]byte, 311000), 311000)
	scanner.Split(bufio.ScanWords)
}

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

func nextInt() int {
	num, err := strconv.Atoi(next())
	if err != nil {
		panic(err)
	}
	return num
}

func main() {
	N := nextInt()
	data := make([]int, N)
	for i := 0; i < N; i++ {
		data[i] = nextInt()
	}

	del := 0
	start := 0
	for cur := 0; cur < N; cur++ {
		if cur+1 == N || data[cur]+1 != data[cur+1] {
			rem := cur - start - 1
			if start == 0 && cur > 0 && data[1] == 2 {
				rem++
			}

			if cur == N-1 && rem >= 0 && len(data) > 1 && data[len(data)-2] == 999 {
				rem++
			}
			if rem > del {
				//fmt.Println("st", start, "cur", cur, "rem", rem)
				del = rem
			}
			start = cur + 1
		}
	}
	//fmt.Println("xx", del)
	fmt.Println(del)
}


package main

import "fmt"

func calcDigit(q int) int {
    switch q {
        case 0: return 6
        case 1: return 2
        case 2: return 5
        case 3: return 5
        case 4: return 4
        case 5: return 5
        case 6: return 6
        case 7: return 3
        case 8: return 7
        case 9: return 6
    }
    return 0
}

func calcInt(q int) int {
    if q == 0 {
        return 6
    }
    var result int = 0
    for q > 0 {
        result += calcDigit(q%10)
        q /= 10
    }
    return result
}

func main() {
    var a, b int
    fmt.Scanf("%d %d", &a, &b)
    totalCount := 0
    for q := a; q <= b; q++ {
        totalCount += calcInt(q)
    }
    fmt.Printf("%d", totalCount)
}


package main

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

func solve() {
	board := make([][]byte, 9)
	for i, _ := range board {
		board[i] = make([]byte, 9)
	}

	for i := 0; i < 27; i++ {
		s := readString()
		for j, c := range s {
			x := j + ((i % 3) * 3)
			y := i / 3
			board[x][y] = byte(c)
		}
	}
	lasty := readInt() - 1
	lastx := readInt() - 1
	newx := (lastx % 3) * 3
	newy := (lasty % 3) * 3
	if isfull(board, newx, newy) {
		fillall(board)
	} else {
		fill(board, newx, newy)
	}

	for y := 0; y < 9; y++ {
		for x := 0; x < 9; x++ {
			fmt.Printf("%c", board[x][y])
			if x == 2 || x == 5 {
				fmt.Print(" ")
			}
		}
		fmt.Println()
		if y == 2 || y == 5 {
			fmt.Println()
		}
	}
}

func isfull(board [][]byte, x, y int) bool {
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			if board[x+i][y+j] == '.' {
				return false
			}
		}
	}
	return true
}

func fill(board [][]byte, x, y int) {
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			if board[x+i][y+j] == '.' {
				board[x+i][y+j] = '!'
			}
		}
	}
}

func fillall(board [][]byte) {
	fill(board, 0, 0)
	fill(board, 0, 3)
	fill(board, 0, 6)

	fill(board, 3, 0)
	fill(board, 3, 3)
	fill(board, 3, 6)

	fill(board, 6, 0)
	fill(board, 6, 3)
	fill(board, 6, 6)
}

var scanner *bufio.Scanner

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

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

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

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


package main

import(
    "fmt"
)

func main(){
    var(
        n,k,i int
    )
    fmt.Scan(&n,&k)
    t := 240-k
    temp := (5*(n*(n+1)))/2
    if t>=temp{
        fmt.Println(n)
    }else{
        res:=0
        for i=1;i<=n;i++{
            res = (5*(i*(i+1)))/2
            if res >t{
                break
            }
        }
        fmt.Println(i-1)
    }
}


package main

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

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

	var home string
	destinations := make(map[string]bool)

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)

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

	for i := 0; i < n; i++ {
		if s, err := reader.ReadString('\n'); err != nil {
			if err == io.EOF {
				break
			} else {
				return
			}
		} else {
			s = re.ReplaceAllString(s, "")
			ss := strings.Split(s, "->")
			var dest string
			if ss[0] == home {
				dest = ss[1]
			} else {
				dest = ss[0]
			}
			if destinations[dest] {
				delete(destinations, dest)
			} else {
				destinations[dest] = true
			}
		}
	}

	if len(destinations) == 0 {
		fmt.Println("home")
	} else {
		fmt.Println("contest")
	}
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF978G(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()
	type pair struct{ i, d int }

	var n, m, s, d int
	Fscan(in, &n, &m)
	pr := make([]int, m)
	todo := make([][]pair, n+1)
	has := make([]bool, n+1)
	for i := range pr {
		Fscan(in, &s, &d, &pr[i])
		for j := s; j < d; j++ {
			todo[j] = append(todo[j], pair{i, d})
		}
		if has[d] {
			Fprint(out, -1)
			return
		}
		has[d] = true
	}
	var ans []interface{}
o:
	for i := 1; i <= n; i++ {
		if has[i] {
			ans = append(ans, m+1)
			continue
		}
		sort.Slice(todo[i], func(j, k int) bool { return todo[i][j].d < todo[i][k].d })
		for _, p := range todo[i] {
			if pr[p.i] > 0 {
				pr[p.i]--
				ans = append(ans, p.i+1)
				continue o
			}
		}
		ans = append(ans, 0)
	}
	for _, left := range pr {
		if left > 0 {
			Fprint(out, -1)
			return
		}
	}
	Fprint(out, ans...)
}

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


package main

import (
	"fmt"
	"math"
)

func main() {
	var dp [2*(1e7) + 1] int64
	var n int
	var x, y int64
	fmt.Scan(&n, &x, &y)
	dp[1] = x;
	for i := 2; i <= n; i++ {
		dp[i] = int64(math.Min(float64(dp[i-1]+x), float64(dp[(i+1)/2]+y+int64(i%2)*x)))
		dp[i-1] = int64(math.Min(float64(dp[i-1]), float64(dp[i]+x)))
	}

	fmt.Println(dp[n])

}


package main

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

var scanner *bufio.Scanner

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

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

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

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

	writer.WriteString(fmt.Sprintf("%d", Problem888B()))
}

func Problem888B() int {
	n := getI()
	x := 0
	y := 0
	s := getS()
	for _, char := range s {
		switch char {
		case 'U':
			y+=1
			break
		case 'D':
			y-=1
			break
		case 'L':
			x-=1
			break
		case 'R':
			x+=1
			break
		default:
			break
		}
	}
	return n - (int(math.Abs(float64(x)))+int(math.Abs(float64(y))))
}


package main

import (
	"fmt"
	"os"
)

func main() {
	var a, count0,count1 int
	var s string
	fmt.Scanf("%d\n", &a)
	fmt.Scanf("%s\n", &s)
	for _, v := range s{
		if v == '0'{
			count0++
		} else if v == '1'{
			count1++
		}
	}
	if count0 == 1 && count1 == 0{
		fmt.Println(0)
		os.Exit(0)
	}
	var ss = "1"
	for i:=0;i<count0;i++{
		ss+="0"
	}
	fmt.Println(ss)
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF894B(in io.Reader, out io.Writer) {
	const mod int64 = 1e9 + 7
	pow := func(x, n int64) int64 {
		res := int64(1)
		for ; n > 0; n >>= 1 {
			if n&1 == 1 {
				res = res * x % mod
			}
			x = x * x % mod
		}
		return res
	}
	var n, m, k int64
	Fscan(in, &n, &m, &k)
	if k == -1 && n&1 != m&1 {
		Fprint(out, 0)
	} else {
		Fprint(out, pow(pow(2, n-1), m-1))
	}
}

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


package main

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

type point struct {
	x, y int
}

var ans int64

const (
	mod = int(1e9 + 7)
)

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

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := 1
	for ii := 0; ii < t; ii++ {
		n, p, w, d := int64(0), int64(0), int64(0), int64(0)
		fmt.Fscanf(in, "%d %d %d %d\n", &n, &p, &w, &d)
		if n*w < p {
			fmt.Fprintf(out, "%d\n", -1)
			return
		}
		a := p / w
		m := make(map[int64]bool)
		for true {
			if a == -1 {
				fmt.Fprintf(out, "%d\n", -1)
				return
			}
			remain := p - a*w
			if remain%d == 0 {
				if a+remain/d > n {
					fmt.Fprintf(out, "%d\n", -1)
					return
				}
				fmt.Fprintf(out, "%d %d %d\n", a, remain/d, n-a-remain/d)
				return
			}
			if m[remain%d] {
				fmt.Fprintf(out, "%d\n", -1)
				return
			}
			m[remain%d] = true
			a--
		}
	}
	return
}

func help(i int, n int, total int, t []int, g []int, cur int, c1, c2, c3 int, remaining int) {
	//fmt.Println(i, cur)
	if i == n {
		if cur == total {
			cal(c1, c2, c3)
		}
		return
	}
	if cur > total {
		return
	}
	if cur+remaining < total {
		return
	}
	switch g[i] {
	case 1:
		help(i+1, n, total, t, g, cur+t[i], c1+1, c2, c3, remaining-t[i])
	case 2:
		help(i+1, n, total, t, g, cur+t[i], c1, c2+1, c3, remaining-t[i])
	case 3:
		help(i+1, n, total, t, g, cur+t[i], c1, c2, c3+1, remaining-t[i])
	}
	help(i+1, n, total, t, g, cur, c1, c2, c3, remaining-t[i])
}

func cal(c1, c2, c3 int) {
	a := []int{c1, c2, c3}
	sort.Ints(a)
	tmp := int64(try(c1, c2, c3, 0))
	tmp %= int64(mod)
	for i := 1; i <= c1; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	for i := 1; i <= c2; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	for i := 1; i <= c3; i++ {
		tmp *= int64(i)
		tmp %= int64(mod)
	}
	ans += tmp
	ans %= int64(mod)
}

func try(a, b, c int, last int) int64 {
	if a == 0 && b == 0 && c == 0 {
		return 1
	}
	if a < 0 || b < 0 || c < 0 {
		return 0
	}
	if last == 0 {
		return try(a-1, b, c, 1) + try(a, b-1, c, 2) + try(a, b, c-1, 3)
	}
	if last == 1 {
		return try(a, b-1, c, 2) + try(a, b, c-1, 3)
	}
	if last == 2 {
		return try(a-1, b, c, 1) + try(a, b, c-1, 3)
	}
	return try(a-1, b, c, 1) + try(a, b-1, c, 2)
}


package main

import "fmt"

var (
	n, input, ans, sum1, sum2 int
	mp1 map[int]int
)

func main() {
	fmt.Scanln(&n)

	mp1 = make(map[int]int)
	ans = 1

	for i := 0; i < n; i++ {
		fmt.Scan(&input)
		mp1[int(input)] = 1
		sum1 += input
	}

	for i := 0; i < n; i++ {
		fmt.Scan(&input)
		if input != 0 && mp1[int(input)] == 0 {
			ans = 0
		}
		sum2 += input
	}

	if sum1 >= sum2 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

import (
	"fmt"
)

var count [10]int
var numbers []int

func initCount(n int64) int {
	var cnt int
	for ; n > 0; {
		count[n%10]++
		numbers = append(numbers, int(n%int64(10)))
		n /= 10
		cnt ++
	}
	return cnt
}

var dp [1<<18][100]int64

func main() {
	var n, m int64
	fmt.Scanf("%d %d", &n, &m)
	cnt := initCount(n)
	dp[0][0] = 1
	var mask int = int(uint(1)<<uint(cnt))
	for i := 1; i < mask; i++ {
		for j, mm := 0, 1; j < cnt; j, mm = j+1, mm<<uint(1) {
			if (i&mm) == 0 {
				continue
			}
			if i == mm && numbers[j] == 0 {
				continue
			}
			for k := int64(0); k < m; k++ {
				dp[i][(k*int64(10) + int64(numbers[j]))%m] += dp[i^mm][k]
			}
		}
	}

	//fmt.Println(dp[mask-1][0])

	for i := 0; i <= 9; i++ {
		for j := 2; j <= count[i]; j++ {
			dp[mask-1][0] /= int64(j)
		}
	}

	fmt.Println(dp[mask-1][0])
}


package main

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

func main() { fmt.Println(sol()) }

func sol() int64 {
	n := getInt()
	a := getInt()
	b := getInt()
	c := getInt()
	d := getInt()

	e, f, g, h := a+b, b+d, d+c, c+a
	mx := max(max(e, f), max(g, h))
	mn := min(min(e, f), min(g, h))

	x := mx + 1 - mn
	if n-x < 0 {
		return 0
	}
	return int64(n-x+1) * int64(n)
}

type Input struct {
	*bufio.Scanner
}

var globalInput = wrapStdin()

func wrapStdin() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return Input{Scanner: sc}
}
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 main() {
	var l, r, k int64
	fmt.Scanf("%d %d %d", &l, &r, &k)
	m := foo(l, r, k)
	fmt.Print(m)
}
func foo(l, r, k int64) int64 {
	min := Min(l, r)
	max := Max(l, r)
	if min+k < max {
		return 2 * (min + k)
	} else {
		m := 2 * max
		k = k - (max - min)
		k = (k / 2) * 2
		return m + k
	}
}
func Min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}
func Max(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}


package main

import (
    "fmt"
    "sort"
)

func main() {
    var n,d,m int
    fmt.Scan(&n,&d)
    a := make([]int,n)
    for i := 0; i < n; i++ { fmt.Scan(&a[i]) }
    sort.Ints(a)
    fmt.Scan(&m)
    ans := 0
    for i := 0; i < m; i++ {
        if i < n {
            ans += a[i]
        } else {
            ans -= d
        }
    }
    fmt.Println(ans)
}


package main

import "fmt"

func readTime() int {
	var hh, mm int

	fmt.Scanf("%d:%d\n", &hh, &mm)

	return hh*60 + mm
}

func printTime(time int) {
	time %= 60 * 24
	hh := time / 60
	mm := time % 60
	fmt.Printf("%02d:%02d\n", hh, mm)
}

func main() {
	time := readTime()
	var a int
	fmt.Scanf("%d", &a)
	time += a
	printTime(time)
}


package main

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

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

	builder := &strings.Builder{}
	for i := 1; i <= k; i++ {
		builder.WriteString(fmt.Sprintf("%v", i))
	}
	result := builder.String()
	fmt.Printf("%v\n", string(result[k-1]))
}