package main

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

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

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

func main() {
	var n,m int

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

	var colorCode = regexp.MustCompile(`[C|M|Y]`)
	isColor := false
	for i:=0; i<n; i++ {
		text, _ := reader.ReadString('\n')
		if colorCode.MatchString(text) {
			isColor = true
		}
	}

	if isColor {
		fmt.Println("#Color")
	}else {
		fmt.Println("#Black&White")
	}

}


package main

import (
	"fmt"
	"math"
)

var allLuckNumber[] int64

func dfs(dep int, number int64, num4, num7 int){
	if num4 == num7{
		allLuckNumber = append(allLuckNumber, number)
	}
	if dep > 10{
		return;
	}
	dfs(dep + 1, number * 10 + 4, num4 + 1, num7)
	dfs(dep + 1, number * 10 + 7, num4, num7 + 1)
}

func main(){
	var n, ans int64
	ans = math.MaxInt64
	dfs(0, 4, 1, 0)
	dfs(0, 7, 0 ,1)
	fmt.Scan(&n)
	for _,each := range allLuckNumber{
		if each >= n && each < ans{
			ans = each
		}
	}
	fmt.Println(ans)

}


package main

import "fmt"

func GCD(a,b int) int { if b == 0 { return a } else { return GCD(b,a%b) } }
func LCM(a,b int) int { return (a/GCD(a,b))*b }

func main() {
    var x,y,a,b int
    fmt.Scan(&x,&y,&a,&b)
    lcm := LCM(x,y)
    fmt.Println((b/lcm)-((a-1)/lcm))
}


package main

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

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

type V struct {
	P, Pchar, Link int
	Next, Walk [26]int
}

func (node V) String() string {
	return fmt.Sprintf("p = %v, pchar = %v, link = %v", node.P, node.Pchar, node.Link)
}

func CreateNode(p, pchar int) *V {
	v := &V{P:p, Pchar:pchar, Link:-1}
	for i := 0; i < len(v.Next); i++ {
		v.Next[i], v.Walk[i] = -1, -1
	}
	return v
}

func AddString(a string) {
	var v int = 0
	for i := 0; i < len(a); i++ {
		var c int = int(a[i] - 'A')
		if tree[v].Next[c] == -1 {
			tree[size] = CreateNode(v, c)
			tree[v].Next[c] = size
			size++
		}
		v = tree[v].Next[c]
	}
}

func Walk(v, c int) int {
	if tree[v].Walk[c] != -1 {
		return tree[v].Walk[c]
	}
	if tree[v].Next[c] != -1 {
		tree[v].Walk[c] = tree[v].Next[c]
	}else {
		if v == 0 {
			tree[v].Walk[c] = 0
		}else {
			tree[v].Walk[c] = Walk(Getlink(v), c)
		}
	}
	return tree[v].Walk[c]
}

func Getlink(v int) int {
	if tree[v].Link != -1 {
		return tree[v].Link
	}
	if v == 0 || tree[v].P == 0 {
		tree[v].Link = 0
	}else {
		tree[v].Link = Walk(Getlink(tree[v].P), tree[v].Pchar)
	}
	return tree[v].Link
}

func Dp(i, j, k int) int {
	if k == v {
		return -oo
	}
	if i == n {
		return 0
	}
	if j == m {
		return 0
	}

	if dp[i][j][k] != -1 {
		return dp[i][j][k]
	}

	var ret int = -oo
	if a[i] == b[j] {
		var next int = Walk(k, int(a[i] - 'A'))
		// if next != v {
		ret = Max(ret, Dp(i + 1, j + 1, next) + 1)
		// }
	}

	ret = Max(ret, Dp(i + 1, j, k))
	ret = Max(ret, Dp(i, j + 1, k))

	dp[i][j][k] = ret
	return ret
}

func Print(i, j, k int) {
	if i == n {
		return
	}
	if j == m {
		return
	}
	if a[i] == b[j] {
		var ret, which int = Dp(i + 1, j, k), 0
		if ret < Dp(i, j + 1, k) {
			ret, which = Dp(i, j + 1, k), 1
		}
		var next int = Walk(k, int(a[i] - 'A'))
		if next != v {
			if ret <= Dp(i + 1, j + 1, next) {
				ret, which = Dp(i + 1, j + 1, next), 2
			}
		}

		if which == 0 {
			Print(i + 1, j, k)
		}else if which == 1 {
			Print(i, j + 1, k)
		}else {
			fmt.Fprint(out, string(a[i]))
			Print(i + 1, j + 1, next)
		}

	}else {
		var ret int = Dp(i + 1, j , k)
		if ret < Dp(i, j + 1, k) {
			Print(i, j + 1, k)
		}else {
			Print(i + 1, j, k)
		}
	}
}

const oo = 1<<30

var n, m, v int
var a, b, c string
var size int
var tree [110]*V

var dp [][][]int

func main() {

	defer out.Flush()
	in.Split(bufio.ScanWords)

	a, b, c = Next(), Next(), Next()
	n, m, v = len(a), len(b), len(c)
	tree[size] = CreateNode(-1, -1)
	size++
	AddString(c)

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

	var ret int = Dp(0, 0, 0)
	// fmt.Fprintln(out, ret)
	if ret <= 0 {
		fmt.Fprintln(out, 0)
	}else {
		Print(0, 0, 0)
		fmt.Fprintln(out);
	}
}

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

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

func NextInt() int{
	ret, _ := strconv.Atoi(Next())
	return ret
}


package main

import (
	"fmt"
)

func main() {
	var n int64
	fmt.Scan(&n)
	fmt.Println(6*(n*(n+1))/2 + 1)
}


package main

import (
	"fmt"
)

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

	count := 0
	i := 0
	for {
		j := i
		sum := 0
		for j != 0 {
			sum += j % 10
			j /= 10
		}

		if sum == 10 {
			count += 1
			if count == K {
				fmt.Printf("%d", i)
				break
			}
		}
		i += 1
	}

}


package main

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

const INF  = 1000000001

type Pair struct {
	first, second int
}

func sort(arr []int) []int {
	if len(arr) < 2 {
		return arr
	}
	left := 0
	right := len(arr) - 1
	pivot := rand.Int() % len(arr)

	arr[pivot], arr[right] = arr[right], arr[pivot]

	for i := 0; i < len(arr); i++ {
		if arr[i] < arr[right] {
			arr[i], arr[left] = arr[left], arr[i]
			left++
		}
	}

	arr[left], arr[right] = arr[right], arr[left]

	sort(arr[:left])
	sort(arr[left+1:])
	return arr
}

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

func solution(reader io.Reader, writer io.Writer) {
	var n, a, b int64
	fmt.Fscanf(reader, "%d\n%d\n%d\n", &n, &a, &b)
	for i := int64(0); i <= n; i++ {
		if i * a <= n && (n - a * i) % b == 0 {
			fmt.Println("YES")
			fmt.Println(i, (n - a * i) / b)
			return
		}
	}
	fmt.Println("NO")
}

func main() {

	//stdin, err := os.Open("file.in")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("file.out")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)
	defer writer.Flush()

	solution(reader, writer)
}


package main

import (
  "fmt"
  "math"
)

const EPS = 1e-4

type P struct {
  x, y float64
}

func Scan() (p P) {
  fmt.Scanf("%f %f\n", &p.x, &p.y)
  return
}

func VectorProduct(a, b, c P) float64 {
  return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x)
}

func ScalarProduct(a, b, c P) float64 {
  return (b.x - a.x) * (c.x - a.x) + (b.y - a.y) * (c.y - a.y)
}

func Sqr(a float64) float64 {
  return a * a
}

func Dist(a, b P) float64 {
  return math.Sqrt(Sqr(b.x - a.x) + Sqr(b.y - a.y))
}

func Sin(a, b, c P) float64 {
  return VectorProduct(a, b, c) / Dist(a, b) / Dist(a, c)
}

func OuterRadius(a, b, c P) float64 {
  return Dist(b, c) / math.Abs(Sin(a, b, c)) / 2
}

func Angle(a, b, c P) (ret float64) {
  ret = math.Abs(math.Asin(Sin(a, b, c)))
  if ScalarProduct(a, b, c) < -EPS { ret = math.Pi - ret }
  return
}

func GCD(a, b float64) float64 {
  for b > EPS {
    if a < b { a, b = b, a }
    a, b = b, a - b
  }
  return a
}

func main() {
  a, b, c := Scan(), Scan(), Scan()
  r := OuterRadius(a, b, c)
  aa, bb, cc := Angle(a, b, c), Angle(b, a, c), Angle(c, a, b)
  g := GCD(GCD(aa, bb), cc)
  n := math.Pi / g
  ret := n * Sqr(r) * math.Sin(2 * g) / 2
  fmt.Printf("%.6f\n", ret)
}


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 main() {
    defer out.Flush()
    in.Split(bufio.ScanWords)
    n := nextInt()
    x := 1
    for x = 1; ; x++ {
        sum := 0;
        for l := 1; l <= x; l++ {
            sum += l * (l + 1) / 2
        }
        if sum > n {
            break;
        }
    }
    fmt.Fprintln(out, x - 1)
}


package main

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

func main() {

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

	fmt.Fscanf(reader, "%d\n", &t)
	for ; t > 0; t-- {
		fmt.Fscanf(reader, "%d %d %d\n", &n, &k, &d)

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

		set := make(map[int]int)
		ans := 0
		for i := 1; i <= d; i++ {
			k, v := set[a[i]]
			if v == false {
				ans++
			}
			set[a[i]] = k + 1
		}

		temp := ans
		for i := d + 1; i <= n; i++ {
			k, _ := set[a[i-d]]
			if k > 1 {
				set[a[i-d]] = k - 1
			} else {
				delete(set, a[i-d])
				temp--
			}

			k, v := set[a[i]]
			if v == false {
				temp++
			}
			set[a[i]] = k + 1

			if temp < ans {
				ans = temp
			}
		}

		fmt.Println(ans)
	}
}


package main

import (
	"fmt"
)

const (
	mod = 1000000007
)

func pow(n int, k int) int {
	if k == 0 {
		return 1
	}
	res := pow(n, k>>1)
	res = int((int64(res) * int64(res)) % mod)
	if k&1 != 0 {
		res = int((int64(res) * int64(n)) % mod)
	}
	return res
}

func solve(n int) int {
	a := pow(3, 3*n)
	a -= pow(7, n)
	a %= mod
	if a < 0 {
		return a + mod
	}
	return a
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	fmt.Println(solve(n))
}


package main

import "fmt"

func main() {
    var c,p,n,r int
    r=90
    fmt.Scan(&c)
    for i:=0; i<c; i++ {
        fmt.Scan(&n)
        if n-p>15 {
            r=p+15
            break
        } else {
            p=n
        }
    }
    if 90-p>15 {
        r=p+15
    }
    fmt.Println(r)
}


package main

import (
  "fmt"
)

func validate(arr []int64, nSlots int, n int64, m int64) bool {
  length := len(arr)
  for i:= 0; i < length; i++ {
    for j:= i+1; j < length; j++ {
      if arr[i] == arr[j] {
        return false
      }
    }
  }
  var num int64
  for i:= 0; i < nSlots; i++ {
    num = num*7+arr[i]
  }
  if num >= n {
    return false
  }
  num = 0
  for i:=nSlots; i < length; i++ {
    num = num*7+arr[i]
  }
  if num >= m {
    return false
  }
  //fmt.Println(arr)
  return true
}

func try(arr []int64, depth int, cnt *int) {
  length := len(arr)
  if depth == length {
    if validate(arr, nSlots, n, m) {
      (*cnt)++
    }
    return
  }
  for i:=0; i < 7; i++ {
    arr[depth] = int64(i)
    try(arr, depth+1, cnt)
  }
}
var n, m int64
var nSlots, mSlots int
func main() {
  fmt.Scan(&n, &m)
  for i:=n-1; i > 0; {
    nSlots++
    i /= 7
  }
  if nSlots == 0 {
    nSlots = 1
  }
  for i:=m-1; i > 0; {
    mSlots++
    i /= 7
  }
  if mSlots == 0 {
    mSlots = 1
  }

  if mSlots + nSlots > 7 || mSlots + nSlots == 0 {
    fmt.Println(0)
    return
  }

  //fmt.Println(nSlots, mSlots)
  var arr []int64 = make([]int64, nSlots+mSlots)

  var cnt int
  try(arr, 0, &cnt)
  fmt.Println(cnt)
  //testValidate()
}

func testValidate() {
  arr := make([]int64, 3)
  arr[0] = 0
  arr[1] = 2
  arr[2] = 1
  fmt.Println(validate(arr, 2, 8, 2))
}


package main
import (
	 "fmt"
)

func removeZeros(n int64) int64{
	 var x int64
	 for n > 0 {
	 	 if n % 10 != 0 {
	 	 	  x = x * 10 + n % 10
	 	 }
	 	 n /= 10
	 }

	 var result int64
	 for x > 0 {
	 	 result = result * 10 + x % 10
	 	 x /= 10
	 }
	 return result

}
func main() {
	 var a, b int64
	 fmt.Scan(&a)
	 fmt.Scan(&b)

	 c := a + b

	 a = removeZeros(a)
	 b = removeZeros(b)
	 c = removeZeros(c)

	 if a + b == c {
	 	  fmt.Println("YES")
	 } else {
	 	  fmt.Println("NO")
	 }
}


package main

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

func main() {
	input := bufio.NewReader(os.Stdin)
	var (
		t string
	)
	_, _ = fmt.Fscan(input, &t)

	dk := len(t) - 1
	more := false
	k := dk / 2
	if dk % 2 != 0{
		more = true
	}
	if !more{
		for i, n := range t {
			if i == 0{
				continue
			}
			if n == '1' {
				more = true
				break
			}

		}
	}
	if more{
		fmt.Println(k + 1)
	}else {
		fmt.Println(k)
	}
}


package main

import "fmt"

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

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

func main() {
	var x, y, m int64
	fmt.Scan(&x)
	fmt.Scan(&y)
	fmt.Scan(&m)
	min := min(x, y)
	max := max(x, y)
	if min >= m || max >= m {
		fmt.Println(0)
		return
	}
	if min + max <= min {
		fmt.Println(-1)
		return
	}
	iters := int64(0)
	for max < m {
		diff := max - min
		k := diff / max + 1
		min, max = max, min + k * max
		iters += k
	}
	fmt.Println(iters)
}


package main

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

func run(or io.Reader, ow io.Writer) {
	in := bufio.NewReader(or)
	out := bufio.NewWriter(ow)
	defer out.Flush()
	const P int64 = 1e9 + 7
	solve := func() {
		var n int64
		var k int
		fmt.Fscan(in, &n, &k)
		var ans int64 = 1

		for i := 0; i < k; i++ {
			ans = ans * n % P
		}
		fmt.Fprintln(out, ans)

	}

	var T int
	fmt.Fscan(in, &T)
	for o := 0; o < T; o++ {
		solve()
	}

}

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


package main

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

const (
	SCANNER_BUF_SIZE = 2 << 20

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

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

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

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

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

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

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

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

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

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

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

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

type tide struct {
	d int64 // delta
	i bool  // increasing - false by default
}

// Next adjusts the tide level to the next most optimal value
// Returns false if unable to do so
func (t *tide) Next(currDepth int64, k, l int64) bool {
	// rest spot -> reset params
	if currDepth + k <= l {
		t.d = k
		t.i = false
		return true
	}

	// tide decreasing -> check min
	if !t.i {
		t.d--
		if currDepth + t.d > l {
			t.d = l - currDepth
		}
		if t.d < 0 {
			return false
		}
		if t.d == 0 {
			t.i = true
		}
		return true
	}

	// tide increasing
	t.d++
	if currDepth + t.d > l {
		return false
	}
	if t.d == k {
		t.i = false
	}
	return true
}

func main() {
	defer writer.Flush()
	t := sint64()
	for ; t > 0; t-- {
		n := sint64()
		k := sint64()
		l := sint64()
		d := make([]int64, n)
		for i := range d {
			d[i] = sint64()
		}
		printf("%s\n", sol(d, n, k, l))
	}
}

func sol(d []int64, n, k, l int64) string {
	t := &tide{
		d: k,
		i: false,
	}
	for _, di := range d {
		if !t.Next(di, k, l) {
			return "No"
		}
	}
	return "Yes"
}


package main

import (
	"fmt"
)

func main() {
	var a, b, n, rest, result int
	fmt.Scanln(&a)
	fmt.Scanln(&b)
	n = a - b
	if n < 0 {
		n = -n
	}
	rest = n % 2
	n /= 2
	result = n*(n+1) + rest*(n+1)
	fmt.Println(result)
}


package main

import (
	"fmt"
)

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

	c := arr[k-1]
	i := 0
	ans := 0
	for i<n&&arr[i] >= c&&arr[i]>0 {

		ans++
		i++
	}
	fmt.Println(ans)

}


package main

import (
	"fmt"
)

const (
	mod = 998244353
	i2  = (mod + 1) / 2
)

func main() {
	n := 0
	fmt.Scanf("%d", &n)
	f, f1 := uint32(1), uint32(0)
	for i := 1; i < n; i++ {
		f, f1 = (f+f1)%mod, f
	}

	fmt.Printf("%d\n", (uint64(f)*exp(i2, n))%mod)
}

func exp(a uint64, p int) (r uint64) {
	r = 1
	for ; p > 0; p /= 2 {
		if p%2 == 1 {
			r = (a * r) % mod
		}
		a = (a * a) % mod
	}
	return r
}


package main

import (
	"fmt"
	"math"
)

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

func solve() bool {
	var n, R, r float64
	fmt.Scan(&n, &R, &r)
	if r > R {
		return false
	}
	if 2*r > R {
		return n == 1
	}
	return math.Pi/math.Asin(r/(R-r))+1e-9 >= n
}


package main

import "fmt"

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

	a := 1
	b := n

	for x := 1; x*x <= n; x++ {
		if n%x == 0 {
			a = x
			b = n / x
		}
	}

	fmt.Println(a, b)
}


package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var a1,b1,c1,a2,b2,c2 int
	fmt.Fscanf(reader, "%d %d %d\n", &a1, &b1, &c1)
	fmt.Fscanf(reader, "%d %d %d", &a2, &b2, &c2)

	if a1 * b2 - a2 * b1 != 0 {
		fmt.Printf("1")
	} else if a1 * c2 - a2 * c1 == 0 && b1 * c2 - b2 * c1 == 0{
		if a1 == 0 && a2 == 0 && b1 == 0 && b2 == 0 && (c1 != 0 || c2 != 0) {
			fmt.Printf("0")
		} else {
			fmt.Printf("-1")
		}
	} else {
		fmt.Printf("0")
	}
	return
}


package main

import "fmt"

func bs(n, k int) int {
    //Find the answer
    var lo, hi, mid, ans int = 0, n, 0, 0
    for lo <= hi {
        mid = (lo+hi)/2
        left := k-2*mid
        if (n-mid)*3 <= left {
            ans = mid
            hi = mid-1
        } else {
            lo = mid+1
        }
    }
    return ans
}

func main() {
    var n, k int

    fmt.Scan(&n, &k)

    fmt.Println(bs(n, k))
}


package main

import (
	"fmt"
)

func main() {
	var n, ans int
	var a = make([]int, 3)
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	if n != 2 {
		ans = a[0] ^ a[1] ^ a[2]
	} else {
		dp := make([][]int, 301)
		for i := 0; i <= 300; i++ {
			dp[i] = make([]int, 301)
			for j := 0; j <= 300; j++ {
				if j < i {
					dp[i][j] = dp[j][i]
				} else if i != 0 || j != 0 {
					dp[i][j] = 1
					for x := 1; x <= i; x++ {
						dp[i][j] &= dp[i-x][j]
						dp[i][j] &= dp[i][j-x]
						dp[i][j] &= dp[i-x][j-x]
					}
					for x := i + 1; x <= j; x++ {
						dp[i][j] &= dp[i][j-x]
					}
					dp[i][j] ^= 1
				}
			}
		}
		ans = dp[a[0]][a[1]]
	}
	if ans == 0 {
		fmt.Println("BitAryo")
	} else {
		fmt.Println("BitLGM")
	}
}


package main

import "fmt"

func main() {
    var m, n uint64
    fmt.Scan(&n, &m)
    if n > 32 {
        fmt.Print(m)
        return
    }
    var exp uint64 = 1
    for i:=uint64(0); i<n; i++ {
        exp *= 2
    }
    fmt.Print(m % exp)
}


package main

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

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

	var n, m int
	fmt.Fscan(reader, &n, &m)

	arr := make(map[int]int)
	for i := 0; i < m; i++ {
		var x int
		fmt.Fscan(reader, &x)
		arr[x]++
	}

	var mx int
	for i := 1; i < 101; i++ {
		var count int
		for _, vl := range arr {
			count += vl / i
		}

		if count >= n {
			mx = i
		}
	}

	fmt.Println(mx)
}


package main

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

func genPrime(max int) []int {
	primes := make([]int, 0)
	sieve := make([]bool, max+1)
	for i := 2; i < max+1; i++ {
		if sieve[i] == true {
			continue
		}
		primes = append(primes, i)
		for j := 2; i*j < max+1; j++ {
			sieve[i*j] = true
		}
	}
	return primes
}

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

	k, n := 0, 0
	if scanner.Scan() {
		line := scanner.Text()

		fmt.Sscanf(line, "%d %d", &n, &k)

		primes := genPrime(n)

		for i := 0; i < len(primes); i++ {
			testNum := primes[i]
			for j := 0; j < len(primes)-1; j++ {
				if testNum-1-primes[j] == primes[j+1] {
					k -= 1
					break
				}
			}
			if k <= 0 {
				fmt.Println("YES")
				return
			}
		}
		fmt.Println("NO")
	}

}


package main
import "fmt"
import "bufio"
import "os"
import "sort"

var input *bufio.Reader

const N = 200005

type arrs []int

func (arr arrs) Len() int{
	return len(arr)
}

func (arr arrs) Less(i, j int) bool {
	return arr[i] < arr[j]
}

func (arr arrs) Swap(i, j int) {
	arr[i], arr[j] = arr[j], arr[i]
}

func main(){
	input = bufio.NewReader(os.Stdin)

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

	arr := make([]arrs, N)
	for i:=0; i<n; i++ {
		var x int
		fmt.Fscanf(input, "%d", &x)
		for cnt:=0; x>=0; x/=2 {
			arr[x] = append(arr[x], cnt)
			cnt++
			if x==0 {
				break
			}
		}
	}

	ans := n*30
	for i:=0; i<N; i++ {
		if len(arr[i])<k {
			continue
		}
		sort.Sort(arr[i])
		cnt := 0
		for j:=0; j<k; j++ {
			cnt += arr[i][j]
		}
		if cnt<ans {
			ans = cnt
		}
	}

	fmt.Println(ans)
}


package main

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

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

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

type intPair struct {
	a int64
	b int64
}

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() {
	defer writer.Flush()

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

	var ans = (a+1) % int64(10)

	if a == b {
		printf("1\n")
		return
	}

	for i:=a+2;i<=b && ans != 0; i++ {
		ans = (ans * (i % int64(10)) % int64(10) )
	}

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


package main

import (
    "fmt"
    "sort"
)

func main() {
    var k int
    a := make([]int,12)
    fmt.Scan(&k)
    for i := 0; i < 12; i++ {
        fmt.Scan(&a[i])
    }
    sort.Sort(sort.IntSlice(a))
    cnt, ans := 0, 0
    for i := 11; (i >= 0) && (cnt < k); i-- {
        cnt += a[i]
        ans++
    }
    if cnt < k { fmt.Println(-1) } else { fmt.Println(ans) }
}


package main

import (
  "fmt"
  "math"
)

func main() {
  var n, k, diploma, certificates, noWinners int64
  fmt.Scanf("%d %d", &n, &k)

  diploma = int64(math.Floor(float64(n) / float64(2 * (k + 1))))
  certificates = k * diploma
  noWinners = n - (diploma + certificates)

  fmt.Printf("%d %d %d\n", diploma, certificates, noWinners)
}


package main

import (
	"fmt"
)

func isValid(nums []int, start, end int) bool {
	return (start-end)%2 == 0 && nums[start]%2 == 1 && nums[end]%2 == 1
}

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

	nums := make([]int, t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d", &nums[i])
	}

	if isValid(nums, 0, len(nums)-1) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

import (
    "fmt"
    "strings"
    //"math"
)

func main() {
    var str string
    fmt.Scanln(&str)
    str += "A"
    res, cur := 1, 1
    for i := 0; i < len(str); i++ {
        if strings.IndexAny(string(str[i]), "AEIOUY") == -1 {
            cur++
        } else {
            if cur > res {
                res = cur
            }
            cur = 1
        }
    }
    fmt.Println(res)
}


package main

import (
    "fmt"
)

func main(){
    var target string
	_, err := fmt.Scanln(&target)
	if err != nil {
		fmt.Println(err)
		return
	}

    var count, first, second int
	_, err = fmt.Scanln(&count)
	if err != nil {
		fmt.Println(err)
		return
	}

    for i:=0; i < count; i++{
        var word string
		_, err = fmt.Scanln(&word)
		if err != nil {
			fmt.Println(err)
			return
		}

		if word == target {
			fmt.Println("YES")
			return
		}
        hasFirst := word[0] == target[1]
        hasSecond := word[1] == target[0]

        if hasFirst{
            first++
        }
        if hasSecond{
            second++
        }
    }
    if first > 0 && second > 0 {
        fmt.Println("YES")
    }else{
    fmt.Println("NO")
}
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	scanner.Scan()
	a, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	for i := int64(1); ; i++ {
		s := strconv.FormatInt(a+i, 10)
		for _, ch := range s {
			if ch == '8' {
				writer.WriteString(fmt.Sprintf("%d\n", i))
				return
			}
		}
	}
}


package main

import (
	"fmt"
)

const mod = 1000000007

var dp [2001][2001]int

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	for i := 1; i <= n; i++ {
		dp[1][i] = 1
	}
	for i := 1; i < k; i++ {
		for j := 1; j <= n; j++ {
			for k := j; k <= n; k += j {
				dp[i + 1][k] = (dp[i + 1][k] + dp[i][j]) % mod
			}
		}
	}
	ans := 0
	for i := 1; i <= n; i++ {
		ans = (ans + dp[k][i]) % mod
	}
	fmt.Println(ans)
}


package main

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

func main() {
    var a [100]int
    stin := bufio.NewScanner(os.Stdin)
    stin.Scan()
    n,_ := strconv.Atoi(stin.Text())
    stin.Scan()
    ss := strings.Fields(stin.Text())
    for i := 0; i < n; i++ {
        a[i],_ = strconv.Atoi(ss[i])
    }
    startPos := 0
    for i := 0; i < n; i++ {
        if a[i] == 1 {
            startPos = i
            break
        }
    }
    if startPos == 0 && a[0] == 0 {
        fmt.Printf("%d", 0)
        return
    }
    finishPos := n-1
    for i := n-1; i >= 0; i-- {
        if a[i] == 1 {
            finishPos = i
            break
        }
    }
//    fmt.Printf("start = %d    finish = %d\n", startPos, finishPos)
    if startPos == finishPos || startPos+1 == finishPos {
        fmt.Printf("%d", 1)
        return
    }
    var totalCount uint64 = 1
    var previous1 int = startPos
    for i := startPos + 1; i <= finishPos; i++ {
//        fmt.Printf("totalCount at start = %d  ", totalCount)
//        fmt.Printf("a[%d] = %d\n", i, a[i])
        if a[i] == 1 {
            totalCount *= uint64(i - previous1)
            previous1 = i
        }
//        fmt.Printf("totalCount at finish = %d\n", totalCount)
    }
    fmt.Printf("%d", totalCount)
}


package main

import "fmt"

func check(x int64, a int64, b int64, y int64) bool {
    if a == 0 {
        return x == y
    } else {
        var c = a/b
        return x == y ||
            check(x-c,c,b,y) ||
            check(x,c,b,y) ||
            check(x+c,c,b,y)
    }
}

func main() {

    var w,m int64
    fmt.Scanf("%v %v\n", &w, &m)

    if w <= 3 {
        fmt.Printf("YES\n")
    } else {
        var i,x,c int64 = 1,1,0
        for x < m && c <= 100 {
            i *= w
            x += i
            c++
        }
        if check(i,i,w,m) {
            fmt.Printf("YES\n")
        } else {
            fmt.Printf("NO\n")
        }
    }
}


package main

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

const div int64 = 1000000007

func cucl(n int) int64 {
	var a, b int64
	a = 2
	b = 4
	if n == 1 {
		return a
	}

	if n == 2 {
		return b
	}

	for i := 3; i <= n; i++ {
		a, b = b%div, (a+b)%div
	}

	return b
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n, m int
	fmt.Fscanf(reader, "%d %d\n", &n, &m)
	fmt.Printf("%d\n", (cucl(n)+cucl(m)+div-2)%div)
}


// 388A-mic
package main

import (
    "fmt"
    "sort"
)

func main() {
    var n, cou int
    fmt.Scan(&n)
    a := make([]int, n)
    for i := range a {
        fmt.Scan(&a[i])
    }
    f := 1
    sort.Sort(sort.IntSlice(a))
    for i := 0; i < n; i++ {
        f = 1
        if a[i] != -1 {
            for j := i + 1; j < n; j++ {
                if a[j] >= f && a[j] != -1 {
                    f++
                    a[j] = -1
                }
            }
            cou++
        }
    }
    fmt.Println(cou)
}


package main

import "fmt"

func main() {
	var r, x, y, nx, ny int64
	fmt.Scanf("%d %d %d %d %d", &r, &x, &y, &nx, &ny)
	s := (x-nx)*(x-nx) + (y-ny)*(y-ny)
	r *= 2
	var i int64
	for i = 0; i*i*r*r < s; i++ {

	}
	fmt.Println(i)
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var line string
	fmt.Scan(&line)

	words := strings.Split(line, "WUB")
	hasPrev := false
	for _, word := range words {
		if len(word) == 0 {
			continue
		}
		if hasPrev {
			fmt.Print(" ")
		} else {
			hasPrev = true
		}
		fmt.Print(word)
	}
}


package main

import (
"fmt"
"os"
)
func main(){
  var s string
  fmt.Scan(&s)
  var chars = []byte(s)
  var output string
  var n int = len(chars)
  for i:=0; i < n ; {
    if chars[i] == '.' {
        output+= "0"
        i+=1
    } else if i+1 < n && chars[i] == '-' {
          if chars[i+1] == '.' {
          i+=2
          output+= "1"
        } else if chars[i+1] == '-' {
          output += "2"
           i+=2
        }
    }else {
        i+=1
    }
}
fmt.Fprintf(os.Stdout,"%s",output)
}


package main

import "fmt"

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

func main() {
    var n,k int
    fmt.Scan(&n,&k)
    a := make([]int,n)
    for i := 0; i < n; i++ { fmt.Scan(&a[i]) }
    ans := 0
    for i := 0; i < k; i++ {
        one, two := 0, 0
        for j := 0; j < n/k; j++ {
            if a[i+(j*k)] == 1 { one++ } else { two++ }
        }
        ans += min(one,two)
    }
    fmt.Println(ans)
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var n, m int

	fmt.Scan(&n, &m)
	var c int = 1
	for i := 1; i <= int(math.Min(float64(n), float64(m))); i++ {
		c = c * i
	}
	fmt.Println(c)
}


package main
import (
	"fmt"
	"sort"
)

func main() {
	var n,m,d int
	fmt.Scan(&n,&m)
	num := make([]int,m)

	for  i:=0;i<m;i++{
		fmt.Scan(&num[i])
	}
	sort.Ints(num)
	output:=10001
	for k:=0; k<=(m-n);k++ {
	z:= k+n-1
	d = num[z]-num[k]
	if d < output {
		output=d
	}
	}
	fmt.Println(output)
}


package main

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

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

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

	var n, x int64
	fmt.Fscan(r, &n, &x)

	mp := make(map[int64]int64)
	q := []int64{x}
	for len(q) > 0 {
		val := q[0]
		q = q[1:]

		s := strconv.FormatInt(val, 10)
		if int64(len(s)) >= n {
			fmt.Fprintln(w, mp[val])
			return
		}

		for _, v := range s {
			v := int64(v - '0')
			if v <= 1 {
				continue
			}
			_, ok := mp[val*v]
			if ok {
				continue
			}
			mp[val*v] = mp[val] +1
			q = append(q, val*v)
		}
	}

	fmt.Fprintln(w, -1)
}


package main

import (
	"fmt"
)

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

	if t == x {
		fmt.Println("YES")
		return
	}
	for k := t + s; k <= x; k += s {
		if k == x || k + 1 == x {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}


package main

import "fmt"

func getCnt(n int64) int64 {
  var sum int64
  for k:= int64(2); k*k*k <= n; k++ {
    sum += n/(k*k*k)
  }
  return sum
}

func main() {
  var m int64
  fmt.Scan(&m)

  var lo, hi int64
  lo = 1
  hi = 9223372036854775807
  for lo+1 < hi {
    mid := (lo+hi)/2
    sum := int64(0)
    for k:= int64(2); k*k*k <= mid; k++ {
      sum += mid/(k*k*k)
    }
    if sum >= m {
      hi = mid
    } else {
      lo = mid
    }
  }
  hiCnt := getCnt(hi)
  if hiCnt == m {
    fmt.Println(hi)
  } else {
    fmt.Println(-1)
  }
}


package main

import (
	"fmt"
)

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

func main() {
	var x1, y1, x2, y2, x, y int
	fmt.Scanf("%v%v%v%v\n%v%v", &x1, &y1, &x2, &y2, &x, &y)
	dx := abs(x2 - x1)
	dy := abs(y2 - y1)
	result := "YES"
	if dx % x != 0 || dy % y != 0 || abs(dx / x - dy / y) % 2 == 1{
		result = "NO"
	}
	fmt.Println(result)
}


package main

import "fmt"

func main() {
	var n, m, x, y int
	fmt.Scan(&n, &m)
	if n > m {
		x = n
	}else{
		x = m
	}

	if n < m {
		y = n
	}else{
		y = m
	}

	fmt.Print( x-1, y)
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
func ReadStr() string{
	scanner.Scan()
	return scanner.Text()
}

func ReadInt(x int) (res int)  {
	scanner.Scan()

	n,err := strconv.Atoi(scanner.Text())
	res = n
	if err != nil{
		panic(err)
	}
	return
}

type building struct
{
	a , b ,c int
}

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

func main()  {
	var n,h,m int
	fmt.Scan(&n)
	fmt.Scan(&h)
	fmt.Scan(&m)
	bl := make([]int,n + 1,n + 1)
	for i := 1 ; i <= n ;i++{
		bl[i] = 100
	}
	var x1,x2,x3 int
	for i := 0 ; i < m ;i ++{
		fmt.Scan(&x1)
		fmt.Scan(&x2)
		fmt.Scan(&x3)
		for i := x1; i <= x2  ; i++{
			bl[i] = min(bl[i],x3);
		}

	}
	var ans int = 0
	for i := 1 ;i  <=  n ;i ++{
		if(bl[i] == 100){
			ans += h * h
		}else{
			ans += bl[i] * bl[i];
		}
	}
	fmt.Println(ans)

}


package main

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

func main() {
	const max_distance int = 20000

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

	var is_at_np bool = true
	var is_at_sp bool = false
	var distance_from_np int = 0
	var ok bool = true

	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < n; i++ {
		if s, err := reader.ReadString('\n'); err != nil {
			if err == io.EOF {
				break
			} else {
				return
			}
		} else if ok {
			var direction byte
			amount := 0
			for j := 0; j < len(s) && s[j] != '\r' && s[j] != '\n'; j++ {
				if s[j] == ' ' {
					direction = s[j+1]
					break
				} else {
					amount *= 10
					amount += int(s[j] - '0')
				}
			}
			if is_at_np && direction != 'S' {
				ok = false
				break
			} else if is_at_sp && direction != 'N' {
				ok = false
				break
			}
			if direction == 'S' {
				distance_from_np += amount
				is_at_np = false
				if distance_from_np == max_distance {
					is_at_sp = true
				} else if distance_from_np > max_distance {
					ok = false
					break
				}
			} else if direction == 'N' {
				distance_from_np -= amount
				is_at_sp = false
				if distance_from_np == 0 {
					is_at_np = true
				} else if distance_from_np < 0 {
					ok = false
					break
				}
			}
		}
	}

	if ok && distance_from_np == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import "fmt"

func main() {
    var x,t,a,b,da,db int
    fmt.Scan(&x,&t,&a,&b,&da,&db)
    m := make(map[int]bool)
    m[0] = true
    for i := 0; i < t; i++ {
        m[a-(da*i)] = true
    }
    ans := false
    for i := 0; i <= t; i++ {
        if i == t {
            if m[x] {
                ans = true
                break
            }
        } else if m[x-(b-(db*i))] {
            ans = true
            break
        }
    }
    if ans { fmt.Println("YES") } else { fmt.Println("NO") }
}


package main

import "fmt"

func main() {
	n,p:=0,0
	fmt.Scanln(&n,&p)
	for i := 1; i<=64; i++ {
		fuck:=n-p*i
			s:=fmt.Sprintf("%b",fuck)
			ans:=0
			for i := 0; i < len(s); i++ {
				if s[i]=='1'{
					ans++
			}
			}
			//fmt.Println(fuck,s,ans,i)
			if ans<=i&&i<=n-p*i{
				fmt.Println(i)
				return
			}

	}
	fmt.Println(-1)

}


package main

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

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

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

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

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

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

func binary_search(a *[]int64, pos int64) (bool, int64, int64) {
	var left int64 = 0
	var right int64 = int64(len(*a))
	var n_low int64 = 0
	var n_high int64 = 0
	for left < right {
		var middle int64 = (left + right) / 2
		if (*a)[middle] <= pos {
			left = middle + 1

			if pos != middle {
				n_low++
			}
		} else {
			right = middle
			n_high++
		}
	}

	if left > 0 && (*a)[left-1] == pos {
		return true, n_low, n_high
	} else {
		return false, n_low, n_high
	}
}

func extended_gcd(a int64, b int64) {
	var o_r int64 = a
	var r int64 = b
	var o_s int64 = 1
	var s int64 = 0
	var o_t int64 = 0
	var t int64 = 1

	for r != 0 {
		var q int64 = o_r / r
		o_r, r = r, o_r-q*r
		o_s, s = s, o_s-q*s
		o_t, t = t, o_t-q*t
	}

	printf("Bezout coefs: %d %d\n", o_s, o_t)
	printf("GCD: %d\n", o_r)
}

func modular_inverse(a int64, m int64) int64 {

	var m_init int64 = m
	var y int64 = 0
	var x int64 = 1

	if m == 1 {
		return 0
	}

	for a > 1 {
		var q int64 = a / m
		var t int64 = m

		m = a % m
		a = t
		t = y

		y = x - q*y
		x = t
	}

	if x < 0 {
		x += m_init
	}

	return x
}

func combination(n int64, k int64, factorial *[]int64, mod_inv *[]int64, mod_by int64) int64 {

	if k > n {
		return 0
	} else {
		var r int64 = ((*mod_inv)[n-k] * (*mod_inv)[k]) % mod_by
		r = (r * (*factorial)[n]) % mod_by
		return r
	}

}

func main() {
	defer writer.Flush()

	var n, x, pos int64
	scanf("%d %d %d\n", &n, &x, &pos)

	var n_smaller_numbers int64 = x - 1
	var n_bigger_numbers int64 = n - x

	var mod_by int64 = 1000000000 + 7

	factorial := make([]int64, n+1)
	mod_inv := make([]int64, n+1)

	factorial[0] = 1
	mod_inv[0] = 1

	for i := int64(1); i <= n; i++ {
		// Formaly it should be ( (factorial[i-1] % mod_by) * (i % mod_by) ) % mod_by
		// but since n does not exceed 1000 in the problem constraints then the below suffices.
		factorial[i] = (factorial[i-1] * i) % mod_by
		mod_inv[i] = modular_inverse(factorial[i], mod_by) % mod_by
	}

	// for i := range factorial {
	// 	printf("%d ", factorial[i])
	// }
	// printf("\n")

	// for i := range mod_inv {
	// 	printf("%d ", mod_inv[i])
	// }
	// printf("\n")

	numbers := make([]int64, n)
	for i := int64(0); i < int64(len(numbers)); i++ {
		numbers[i] = i
	}

	var n_less, n_greater int64
	_, n_less, n_greater = binary_search(&numbers, pos)

	// printf("n_less: %d n_greater: %d\n", n_less, n_greater)

	var c1 int64 = (combination(n_smaller_numbers, n_less, &factorial, &mod_inv, mod_by) * factorial[n_less]) % mod_by
	var c2 int64 = (combination(n_bigger_numbers, n_greater, &factorial, &mod_inv, mod_by) * factorial[n_greater]) % mod_by

	// printf("c1: %d c2: %d\n", c1, c2)

	var res int64 = (c1 * c2) % mod_by
	res = (res * factorial[n-n_less-n_greater-1]) % mod_by

	printf("%d\n", res)

	// extended_gcd(240, 46)
	// printf("modular inverse: %d\n", modular_inverse(42, mod_by))

}


package main

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

var (
  in *bufio.Reader
  out *bufio.Writer
)

func main() {
  in = bufio.NewReader(os.Stdin)
  out = bufio.NewWriter(os.Stdout)
  var b int64
  fmt.Fscanln(in, &b)
  var count int64 = 0
  for  i:=int64(1);i<=int64(math.Sqrt(float64(b)));i++ {
    if (b%i == 0) {
      if (i*i == b) {
        count++
      } else {
        count+=2
      }
    }
  }
  fmt.Println(count)
}


package main

import (
	"fmt"
)

func main() {
	var total int
	var current int
	var left, right, max, min int
	var totalMoves int
	fmt.Scanln(&total, &current)
	left = current - 1
	right = total - current
	min, max = minMax(left, right)
	totalMoves = min * 2 + max + total *2 + 1
	fmt.Println(totalMoves)
}

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


package main

import (
	"fmt"
	"os"
)

func main() {
	x := 0
	fmt.Scan(&x)
	for a := 1; a <= x; a++ {
		for b := 1; b <= x; b++ {
			if (a%b > 0) || (a*b <= x) || (a/b == x) {
				continue
			}
			fmt.Println(a, b)
			os.Exit(0)
		}
	}
	fmt.Println(-1)
}


package main

import "fmt"

func main() {
	var n int64
	fmt.Scan(&n)
	var sum int64 = n * (n + 1) / 2
	fmt.Print(sum % 2)
}


package main

import (
  "fmt"
)

func main() {
  var zero2four = [5]string{"-OOOO", "O-OOO", "OO-OO", "OOO-O", "OOOO-"}
  var num int
  fmt.Scan(&num)
  if num == 0 {
    fmt.Printf("O-|" + zero2four[0])
  } else {
    for num != 0 {
      var div int = num % 10
      if div >= 5 {
        fmt.Print("-O|")
      } else {
        fmt.Print("O-|")
      }
      fmt.Printf("%s\n", zero2four[div % 5])
      num /= 10
    }
  }
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF702D(in io.Reader, out io.Writer) {
	var d, k, a, b, t int64
	Fscan(in, &d, &k, &a, &b, &t)
	ans := b * d
	for _, x := range []int64{k * ((d - 1) / k), k, d} {
		if 0 < x && x <= d {
			if v := a*x + ((x-1)/k)*t + (d-x)*b; v < ans {
				ans = v
			}
		}
	}
	Fprint(out, ans)
}

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


package main

import (
	"fmt"
)

func main() {
	const cf = "CODEFORCES"
	var s string
	fmt.Scan(&s)
	if len(s) < len(cf) {
		fmt.Println("NO")
		return
	}
	b := 0
	for i := range cf {
		if s[i] != cf[i] {
			break
		}
		b++
	}
	e := 0
	for i := range cf {
		if s[len(s)-1-i] != cf[len(cf)-1-i] {
			break
		}
		e++
	}
	if b+e >= len(cf) {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}


package main

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

var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

type Int64Slice []int64

func (slice Int64Slice) Len() int           { return len(slice) }
func (slice Int64Slice) Less(i, j int) bool { return slice[i] < slice[j] }
func (slice Int64Slice) Swap(i, j int)      { slice[i], slice[j] = slice[j], slice[i] }

var usr1 [20]int
var usr2 [20]int

var n, m int
var val [2][30]int

func guess(v int) int {
	ret := 0
	for i := 0; i < n; i++ {
		if v == val[0][i*2] || v==val[0][i*2+1] {
			for j := 0; j < m; j++ {
				if v == val[1][j*2] || v==val[1][j*2+1] {
          // fmt.Printf("v:%v   %v - %v\n",v,i,j)
					if
          (val[0][i*2] == val[1][j*2] && val[0][i*2+1] == val[1][j*2+1])|| (val[0][i*2] == val[1][j*2+1] && val[0][i*2+1] == val[1][j*2]){
					} else {
						if (usr1[i] == 0 || usr1[i] == v) && (usr2[j] == 0 || usr2[j] == v) {
							usr1[i] = v
							usr2[j] = v
							ret = v
						} else {
							return -1
						}
					}

				}
			}
		}
	}
	return ret
}

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

	n, m = ReadInt32(), ReadInt32()

	for i := 0; i < n; i++ {
		val[0][i*2] = ReadInt32()
		val[0][i*2+1] = ReadInt32()
	}
	for i := 0; i < m; i++ {
		val[1][i*2] = ReadInt32()
		val[1][i*2+1] = ReadInt32()
	}

	// 1 zu pei 1 -> res
	ans := -1
	for i := 1; i < 10; i++ {
		ret := guess(i)
		if ret == -1 {
			fmt.Printf("-1\n")
			return
		}
    if ret == 0 {
      continue
    }
		if ans == -1 {
			ans = ret
		} else {
			ans = 0
		}
	}
	fmt.Printf("%v\n", ans)

	// quan pei 1 -> 0

	// else -1

}

func Demo() {
	var n, m int64 = ReadInt64(), ReadInt64()
	PrintInt64s(n, m)
	writer.WriteByte('\n')
	slice := []int64{1, 2, 3, 4, 5}
	PrintInt64s(slice...)

	// sortDemo
	//slice := []int64{5, 3, 4, 2, 1}
	sort.Sort(Int64Slice(slice))

	//s := strconv.FormatBool(true)
	//s := strconv.FormatFloat(3.1415, 'E', -1, 64)
	//s := strconv.FormatInt(-42, 16)
	//s := strconv.FormatUint(42, 16)

}

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

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

func MinFloat64(a float64, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

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

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

func MaxFloat64(a float64, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

func ReadInt32() int {
	scanner.Scan()
	ans, _ := strconv.Atoi(scanner.Text())
	return ans
}

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

func ReadFloat64() float64 {
	scanner.Scan()
	ans, _ := strconv.ParseFloat(scanner.Text(), 64)
	return ans
}

func PrintInt64s(ints ...int64) {
	for _, value := range ints {
		writer.WriteString(strconv.Itoa(int(value)))
		writer.WriteByte(' ')
	}
}


package main

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

func solve() {
	readInt()
	m := readInt()
	k := readInt() - 1

	column := (k) / (m * 2)
	row := (k % (m * 2)) / 2
	row1 := (k % (m * 2)) % 2
	fmt.Printf("%d ", column+1)
	fmt.Printf("%d ", row+1)
	if row1 == 0 {
		fmt.Println("L")
	} else {
		fmt.Println("R")
	}
}

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 (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, k := 0, 0
	fmt.Fscanf(in, "%d %d\n", &n, &k)
	ans := -1
	for i := 1; i <= n; i++ {
		if n%i == 0 {
			a := i
			b := n / i
			if b >= k {
				continue
			}
			x := a*k + b
			if x < ans || ans == -1 {
				ans = x
			}
		}
	}
	fmt.Fprintf(out, "%d\n", ans)
	return
}


// A. Maximum in Table
/*
An n × n table a is defined as follows:

    The first row and the first column contain ones, that is:
			ai, 1 = a1, i = 1 for all i = 1, 2, ..., n.
    Each of the remaining numbers in the table is equal to the sum of the
			number above it and the number to the left of it. In other words,
			the remaining elements are defined by the formula
			ai, j = ai - 1, j + ai, j - 1.

These conditions define all the values in the table.

You are given a number n. You need to determine the maximum value in the
n × n table defined by the rules above.

Input
The only line of input contains a positive integer n (1 ≤ n ≤ 10) —
the number of rows and columns of the table.

Output
Print a single line containing a positive integer m —
the maximum value in the table.

Examples
Input
1

Output
1

Input
5

Output
70

Note
In the second test the rows of the table look as follows:
{1, 1, 1, 1, 1},
{1, 2, 3, 4, 5},
{1, 3, 6, 10, 15},
{1, 4, 10, 20, 35},
{1, 5, 15, 35, 70}.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	n, _ := strconv.Atoi(strings.TrimSpace(input))
	fmt.Print(sol509A(n, n))
}

func sol509A(r, c int) int {
	if r == 1 || c == 1 {
		return 1
	}
	return sol509A(r-1, c) + sol509A(r, c-1)
}


package main

import "fmt"

func main() {
	var n, a, result int
	fmt.Scan(&n)
	for ; n > 0; n-- {
		fmt.Scan(&a)
		if a > 0 {
			result += a
		} else {
			result -= a
		}
	}
	fmt.Print(result)
}


package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var l, d, v, g, r int
	fmt.Fscanf(reader, "%d %d %d %d %d", &l, &d, &v, &g, &r)
	t := float64(d) / float64(v)
	tLight := float64(int(t) % (g + r))  + t - float64(int(t))
	if tLight < float64(g) {
		fmt.Printf("%.7f", float64(l)/float64(v))
	} else {
		fmt.Printf("%.7f", float64(l)/float64(v) + float64(g + r) - tLight)
	}

}


package main
import "fmt"
const MAX int64 = 1e7
const MOD int64 = 1e9+7
var isgood [MAX]bool
func Max(a, b int64) int64 {
	if (a < b) {
		return b
	}
	return a
}
func Init(a, b, n int64) {
	var k int64
	for k = 0; k < MAX; k++ { isgood[k] = true }
	for k = 1; k <= Max(a,b) * n; k++ {
		p := k
		for p > 0 {
			if p % 10 != a && p % 10 != b {
				isgood[k] = false
				break
			}
			p /= 10
		}
	}
}

func EE(a, b int64) int64 {
	var (
		r=a%b
		x0 int64=1
		y0 int64=0
		x1 int64=0
		y1 int64=1
		mod=b
	)
	for r > 0 {
		f:=a/b
		tx:=x0-f*x1
		ty:=y0-f*y1
		x0=x1
		y0=y1
		x1=tx
		y1=ty
		a=b
		b=r
		r=a%b
	}
	return (x1%mod+mod)%mod
}

func main() {
	var a,b,n int64
	fmt.Scanf("%d%d%d",&a,&b,&n)
	Init(a,b,n)
	var (
		choose int64=1
		x int64=0
		y int64
	)
	cnt := make(map[int64]int64)
	for x <= n {
		y=n-x
		s:=a*x+b*y
		if isgood[s] { cnt[s]=(cnt[s]+choose)%MOD }
		choose=((choose*(n-x))%MOD)*EE(x+1,MOD)%MOD
		x++
	}
	var ans int64 = 0
	for k,v := range cnt {
		if isgood[k] { ans = (ans + v) % MOD }
	}
	fmt.Println(ans)
}


package main

import (
	"fmt"
)

func main() {
	var x1, x2, x3 int
	fmt.Scanf("%d%d%d", &x1, &x2, &x3)
	min := Min(Min(x1, x2), x3)
	max := Max(Max(x1, x2), x3)

	fmt.Println(max - min)
}

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

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


package main

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

func main() {
    stin := bufio.NewScanner(os.Stdin)
    stin.Scan()
    ns,_ := strconv.ParseInt(stin.Text(), 10, 32)
    n := int(ns)
    stin.Scan()
    ss := strings.Fields(stin.Text())
    var a []int
    for i := 0; i < n; i++ {
        q,_ := strconv.ParseInt(ss[i], 10, 32)
        a = append(a, int(q))
    }
    sort.Sort(sort.Reverse(sort.IntSlice(a)))

    var totalLength int64 = int64(a[0])
    for i := 1; i < n; i++ {
        if a[i] == a[i-1] {
            for j := i; j < n && a[j] == a[i-1]; j++ {
                if a[j] > 0 {
                    a[j] -= 1
                }
            }
        }
        totalLength += int64(a[i])
    }
    fmt.Printf("%v", totalLength)
}


package main

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

var scanner *bufio.Scanner

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

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

  n, a, b := getI(), getI(), getI()
  arthur := map[int]bool{}
  for i := 0; i < a; i++ {
    arthur[getI()] = true
  }
  for i := 0; i < b; i++ {
    getI()
  }
  assign := make([]int, n)
  for i := 0; i < n; i++ {
    if arthur[i+1] {
      assign[i] = 1
    } else {
      assign[i] = 2
    }
  }
  writer.WriteString(fmt.Sprintf("%d", assign[0]))
  for i := 1; i < n; i++ {
    writer.WriteString(fmt.Sprintf(" %d", assign[i]))
  }
  writer.WriteString("\n")
}


package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1<<13)
	writer := bufio.NewWriterSize(os.Stdout, 1<<13)
	scn := bufio.NewScanner(reader)
	scn.Scan()
	line := scn.Text()
	n := len(line)

	col := line[n-1]
	row, _ := strconv.ParseInt(line[:n-1], 10, 64)
	row--

	total := (row / 4) * 16

	// Adding the count for the column
	switch col {
	case 'f':
		total++
	case 'e':
		total += 2
	case 'd':
		total += 3
	case 'a':
		total += 4
	case 'b':
		total += 5
	case 'c':
		total += 6
	}

	// Check if it is the second columns to be served in this
	// group:
	if (row%4)&1 == 1 {
		total += 6 + 1
	}

	fmt.Fprintln(writer, total)

	writer.Flush()
}

func ReadInt(reader *bufio.Reader) int {
	b, err := reader.ReadByte()
	for !isValid(b, err) {
		b, err = reader.ReadByte()
	}
	res := 0
	for isValid(b, err) {
		res = res*10 + int(b-'0')
		b, err = reader.ReadByte()
	}
	return res
}

func isValid(b byte, err error) bool {
	return err == nil && '0' <= b && b <= '9'
}


// 160B-mic
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var str string
	f := false
	fmt.Scan(&n, &str)
	a := make([]int, n)
	b := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = int(str[i])
	}
	for i := 0; i < n; i++ {
		b[i] = int(str[i+n])
	}
	sort.Sort(sort.IntSlice(a))
	sort.Sort(sort.IntSlice(b))
	//fmt.Println(a)
	//fmt.Println(b)
	if n == 1 && (a[0] < b[0] || a[0] > b[0]) {
		fmt.Println("YES")
		return
	} else if n == 1 && a[0] == b[0] {
		fmt.Println("NO")
		return
	}
	for i := 0; i < n-1; i++ {
		if a[i] > b[i] && a[i+1] > b[i+1] {
			f = true
		} else if a[i] < b[i] && a[i+1] < b[i+1] {
			f = true
		} else {
			f = false
			break
		}
	}
	if f {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import (
	"fmt"
)

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

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	x := a * d
	y := b * c
	if x > y {
		x, y = y, x
	}
	x = y - x
	g := gcd(x, y)
	fmt.Printf("%d/%d", x/g, y/g)
}


package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.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 main() {
	var T, x, result, i, j uint64
	scanf("%d %d\n", &T, &x)

	result = 0

	if x <= T {
		result++
	}
	for i=2; i<=T; i++ {
		if x % i == 0 {
			for j=1; j<=T; j++ {
				if x == i * j {
					result++
				}
			}

		}
	}

	fmt.Println(result)

}


package main

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

type position struct {
	x, y int
}

func solve() {
	m := readString()
	pos := position{0, 0}
	badpos := make(map[position]bool)

	for _, c := range m {
		if badpos[pos] {
			fmt.Println("BUG")
			return
		}
		badpos[pos] = true

		up := position{pos.x, pos.y + 1}
		down := position{pos.x, pos.y - 1}
		right := position{pos.x + 1, pos.y}
		left := position{pos.x - 1, pos.y}

		switch c {
		case 'U':
			badpos[down] = true
			badpos[left] = true
			badpos[right] = true
			pos = up
			break
		case 'D':
			badpos[up] = true
			badpos[left] = true
			badpos[right] = true
			pos = down
			break
		case 'L':
			badpos[up] = true
			badpos[down] = true
			badpos[right] = true
			pos = left
			break
		case 'R':
			badpos[up] = true
			badpos[down] = true
			badpos[left] = true
			pos = right
			break
		}
	}
	if badpos[pos] {
		fmt.Println("BUG")
		return
	}
	fmt.Println("OK")
}

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 (
  "bufio"
  "fmt"
  "os"
)

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

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

func main() {
  defer writer.Flush()
  var a, b, c int
  scanf("%d %d %d\n", &a, &b, &c)
  solve(a, b, c)
}

// a b c a c b a
func solve(a, b, c int) {
  min := a / 3
  if b/2 < min {
    min = b / 2
  }
  if c/2 < min {
    min = c / 2
  }
  a -= min * 3
  b -= min * 2
  c -= min * 2
  max := 0
  food := []int{0, 1, 2, 0, 2, 1, 0}
  for start := range food {
    temp := 0
    cur := start
    store := []int{a, b, c}
    for true {
      cur %= 7
      store[food[cur]]--
      if store[food[cur]] < 0 {
        break
      } else {
        temp++
      }
      cur++
    }
    if temp > max {
      max = temp
    }
  }
  printf("%d\n", max+7*min)
}


package main

import (
	"fmt"
)

func sol(code string) {
	for _, char := range code {
		if char == 'H' || char == 'Q' || char == '9' {
			fmt.Print("YES")
			return
		}
	}
	fmt.Print("NO")
}

func main() {
	var code string
	fmt.Scanf("%s\n", &code)
	sol(code)
}


package main

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

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

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

const FILLED = '#'
const EMPTED = '.'

var bR, bC int

func isAroundFilled(board []string, r, c int) bool {
	for i := r - 1; i <= r+1; i++ {
		for j := c - 1; j <= c+1; j++ {
			if i == r && j == c {
				continue
			}
			if board[i][j] == EMPTED {
				return false
			}
		}
	}
	return true
}

func checkFilled(filled *[][]int, board []string, r, c int) {
	if isAroundFilled(board, r, c) {
		for i := r - 1; i <= r+1; i++ {
			for j := c - 1; j <= c+1; j++ {
				if i == r && j == c {
					continue
				}
				(*filled)[i][j] = 1
			}
		}
	}
}

func canForge(filled [][]int, board []string) bool {
	for i := 0; i < bR; i++ {
		for j := 0; j < bC; j++ {
			if board[i][j] == FILLED && filled[i][j] == 0 {
				return false
			}
		}
	}
	return true
}

func main() {
	defer writer.Flush()

	scanf("%d %d\n", &bR, &bC)
	board := make([]string, bR)
	filled := make([][]int, bR)
	for i := 0; i < bR; i++ {
		filled[i] = make([]int, bC)
		scanf("%s\n", &board[i])
	}

	for i := 1; i+1 < bR; i++ {
		for j := 1; j+1 < bC; j++ {
			checkFilled(&filled, board, i, j)
		}
	}

	if canForge(filled, board) {
		printf("YES\n")
	} else {
		printf("NO\n")
	}

}


package main

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

func Solve(input io.Reader) (result string) {
	var n int
	fmt.Fscan(input, &n)
	if n <= 2 {
		return "YES\n"
	}
	array := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(input, &(array[i]))
	}
	var leftStop, rightStop int
	for leftStop = 0; leftStop < n-1; leftStop++ {
		if array[leftStop] >= array[leftStop+1] {
			break
		}
	}
	if leftStop == n-2 && array[n - 2] <= array[n - 1] {
		leftStop = n - 1
	}
	for rightStop = n - 1; rightStop > 1; rightStop-- {
		if array[rightStop] >= array[rightStop-1] {
			break
		}
	}
	if rightStop == 1 && array[0] >= array[1] {
		rightStop = 0
	}
	yes := "YES\n"
	for ; leftStop < rightStop; leftStop++ {
		if array[leftStop] != array[rightStop] {
			yes = "NO\n"
			break
		}
	}
	return yes
}

func main() {
	fmt.Print(Solve(os.Stdin))
}


package main

import (
    "fmt"
)

func main() {
    var a, b, c int
    fmt.Scan(&a, &b, &c)
    base := a
    if (base > b - 1) {
        base = b - 1
    }
    if (base > c - 2) {
        base = c - 2
    }
    fmt.Println(3 * base + 3)
}


package main

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

func main() {
    var a,b,c,ans int
    fmt.Scan(&a,&b,&c)
    ans = (((c*a)+b-1)/b)-c
    fmt.Println(ans)
}


package main

import (
	"fmt"
)

func sum(a int) int {
	var d, s int
	for a > 0 {
		d = a % 10
		s = s + d
		a = a / 10
	}
	return s
}

func main() {
	var a, s, n int
	fmt.Scan(&a)
	s = sum(a)
	if s%4 == 0 {
		fmt.Println(a)
	} else {
		n = a + 1
		for sum(n)%4 != 0 {
			n = n + 1
		}
		fmt.Println(n)
	}
}


package main

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

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

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

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

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

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

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

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

	return i
}

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

	n, k := readTwoNums(reader)

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

const MAX_N = 500043
const MOD = 998244353

var F []int64

// var PM []int

func pow(a, b int64) int64 {
	var r int64 = 1
	for b > 0 {
		if b&1 == 1 {
			r *= a
			r %= MOD
		}
		a *= a
		a %= MOD
		b >>= 1
	}
	return r
}

func init() {
	F = make([]int64, MAX_N)
	F[0] = 1

	for i := 1; i < MAX_N; i++ {
		F[i] = int64(i) * F[i-1]
		F[i] %= MOD
	}
}

func IF(n int) int64 {
	x := F[n]
	return pow(x, MOD-2)
}

func nCr(n, r int) int64 {
	if n < r {
		return 0
	}
	res := F[n]
	res *= IF(r)
	res %= MOD
	res *= IF(n - r)
	res %= MOD
	return res
}

func solve(n, k int) int {
	var res int64

	for x := 1; x <= n; x++ {
		// x := PM[i]
		d := n / x
		if d < k {
			break
		}
		res += nCr(d-1, k-1)
		res %= MOD
	}

	return int(res)
}


package main

import "os"
import "bufio"
import "strconv"
import "math"

func sum(n int64) int64 {
	var summ int64
	for n > 0 {
		summ += n%10
		n /= 10
	}
	return summ
}

func main(){
	var n int64
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.ParseInt(r.Text(), 0, 64)
	var l int64 = int64(math.Sqrt(float64(n)))-40
	if l < 0 {
		l = 1
	}
	var s int64 = int64(math.Sqrt(float64(n)))+1
	for i:=l; i<s; i++ {
		if i*i+i*sum(i) == n {
			w.WriteString(strconv.FormatInt(i, 10)+"\n")
			w.Flush()
			return
		}
	}
	w.WriteString("-1\n")
	w.Flush()
}


package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println((n - 1) / 2)
}


package main

import "fmt"

func main () {
    var h, w, hs1, hw1, hs2, hw2, i int32
    var count int32

        count = 0
        fmt.Scanf("%d %d\n", &w, &h)
        fmt.Scanf("%d %d\n", &hw1,&hs1)
        fmt.Scanf("%d %d\n", &hw2, &hs2)

    count = w
    for i=h; i > 0; i=i-1 {
        count = count+i
        //fmt.Println(count)
        if (i == hs1) {
            count = count - hw1
        }
        if (i == hs2) {
            count = count - hw2
        }
        if (count < 0) {
            count = 0
        }
    }
        fmt.Println(count)
}


package main

import (
	"fmt"
)

func main() {
	var n, max, min, res int
	min = 1000

	fmt.Scan(&n)

	a := make([]int, n)

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

		if i > 0 {
			if a[i]-a[i-1] > max {
				max = a[i] - a[i-1]
			}
		}

		if i > 1 {
			if a[i]-a[i-2] < min {
				min = a[i] - a[i-2]
			}
		}
	}

	res = min
	if max > min {
		res = max
	}

	fmt.Println(res)
}


package main

import (
	"fmt"
)

func main() {
	for i := 0; i < 8; i++ {

		var line string
		fmt.Scanln(&line)

		first := line[0]
		second := line[1]
		for j := 0; j < 8; j++ {
			if (line[j] == first && j%2 == 1) ||
				(line[j] == second && j%2 == 0) {
				fmt.Println("NO")
				return
			}
		}
	}

	fmt.Println("YES")
}


package main

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

func Init() {
}

func Solve(io *FastIO) {
	X := io.NextInt()
	Y := io.NextInt()

	if Y < 1 {
	  io.Println("No")
	  return
	}

	if (Y == 1) {
	  if (X == 0) {
	    io.Println("Yes")
	  } else {
	    io.Println("No")
	  }
	  return
	}

	if Y <= X + 1 && (X + Y) % 2 == 1 {
	  io.Println("Yes")
	} else {
	  io.Println("No")
	}
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c - '0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size + offset)
	for i := 0; i < size; i++ {
		arr[i + offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for (IsSpaceChar(c)) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

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

func IsLineBreakChar(c byte) bool {
	switch c {
		case 0, '\n', '\r':
			return true
		default:
			return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

import "fmt"

func intPow(x int64, y int64) (res int64) {
	res = 1
	for i := int64(0); i < y; i++ {
		res *= x
	}
	return
}

func main() {
	var n, x, y, numx, numy, t int64
	fmt.Scanf("%d %d\n", &n, &x)
	numx = 0
	for i := int64(1); i <= n; i++ {
		fmt.Scanf("%d", &t)
		numx += t * intPow(x, (n-i))
	}
	fmt.Scanf("\n%d %d\n", &n, &y)
	numy = 0
	for i := int64(1); i <= n; i++ {
		fmt.Scanf("%d", &t)
		numy += t * intPow(y, (n-i))
	}

	if numx == numy {
		fmt.Println("=")
	} else if numx < numy {
		fmt.Println("<")
	} else {
		fmt.Println(">")
	}
}


// Codeforces 859 C Pie Rules train
package main

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

var in *bufio.Reader

func readFive() (int, int, int, int, int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i := 0; i < len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0], a[1], a[2], a[3], a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j := 0; j < n; j++ {
		aa, err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n int
var p []int  // pie slices sizes
var pAlice,pBob int
var mem [][]int  // mem[0] - bob win, mem[1] - alice win
var pSum int
var pSumLeft []int  // sum left after step

// readData read data for out problem.
func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n
	n, _, _, _, _ = readFive()
	p = readLineNumbs(n)
}

func initMemSum() {
	mem = make([][]int, 2)
	for ba := 0; ba<2; ba++ {
		mem[ba] = make([]int, n)
		for j:=0; j<n; j++ {
			mem[ba][j] = -1;
		}
	}
	pSum = 0
	pSumLeft = make([]int,n+1)
	pSumLeft[n] = 0
	for i:=n-1; i>=0; i-- {
		pSum += p[i]
		pSumLeft[i] = pSum;
	}
}

// Return for player with fishka.
func play(ba int, step int) int {
	if step>=n {
		return 0
	} else if mem[ba][step]>=0 {
		return mem[ba][step]
	}
	// pass fishka
	retp := p[step] + (pSumLeft[step+1] - play(1-ba, step+1));
	// stay with fishka
	rets := play(ba, step+1)
	// max result
	ret := retp
	if ret < rets {
		ret = rets
	}
	// fmt.Printf("play(%d, %d) returned %d\n", ba,step, ret)
	mem[ba][step] = ret;
	return ret;
}

// solve func solves our problem.
func solve() {
	initMemSum()
	pBob = play(1,0)
	pAlice = pSum - pBob
}

// printRes print problem solution in expected format.
func printRes() {
	fmt.Printf("%d %d\n", pAlice, pBob)
}

func main() {
	readData()
	solve()
	printRes()
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	arr1 := make([]int, 3)
	arr2 := make([]int, 3)
	for {
		line, _, err := reader.ReadLine()
		if err != nil {
			break
		}
		sum1 := 0
		for i := 0; i < 3; i++ {
			arr1[i] = int(line[i] - '0')
			sum1 += arr1[i]
		}
		sum2 := 0
		for i := 3; i < 6; i++ {
			arr2[i-3] = int(line[i] - '0')
			sum2 += arr2[i-3]
		}
		if sum1 == sum2 {
			fmt.Printf("0\n")
			continue
		}
		if sum1 < sum2 {
			arr1, arr2 = arr2, arr1
			sum1, sum2 = sum2, sum1
		}
		delta := sum1 - sum2
		count := 0
		for {
			sort.Sort(sort.IntSlice(arr1))
			sort.Sort(sort.IntSlice(arr2))
			count++
			if arr1[2] > 9-arr2[0] {
				if arr1[2] >= delta {
					break
				}
				delta -= arr1[2]
				arr1[2] = 0
			} else {
				if 9-arr2[0] >= delta {
					break
				}
				delta -= (9 - arr2[0])
				arr2[0] = 9
			}

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

	}
}


package main

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

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

func main() {
	defer out.Flush()
	var D, L, v1, v2 float64
	fmt.Fscan(in, &D, &L, &v1, &v2)
	fmt.Fprintf(out, "%0.15f\n", (L-D)/(v1+v2))
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var word string

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

	var caps, small int

	for _, s := range word {
		if s >= 97 {
			small+= 1
		} else {
			caps+=1
		}
	}

	if small >= caps {
		fmt.Println(strings.ToLower(word))
	} else {
		fmt.Println(strings.ToUpper(word))
	}
}


package main

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

func solve() {
	c := readInt()
	v0 := readInt()
	v1 := readInt()
	a := readInt()
	l := readInt()
	res := 0
	done := 0
	for c > 0 {
		res++
		cnt := v0 + (res-1)*a
		rep := 0
		if res > 1 {
			if l > done {
				rep = done
			} else {
				rep = l
			}
		}
		if cnt > v1 {
			cnt = v1
		}
		cnt -= rep
		c -= cnt
		done += cnt
	}
	fmt.Println(res)
}

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
}


package main

import (
	"bufio"
	"errors"
	"flag"
	"fmt"
	"log"
	"os"
	"sort"
	"strconv"
	"time"
)

// ******************************** CODE STARTS ********************************

var ()

func solve() {
	n := readInt()
	mas := make([]int, n)
	m := readInt()
	A := make([]int, m)
	B := make([]int, m)

	for i := 0; i < n; i++ {
		mas[i] = readInt()
	}

	for i := 0; i < m; i++ {
		A[i] = readInt()
		B[i] = readInt()
	}

	array := make(TupleSlice, n)
	for i := 0; i < n; i++ {
		array[i] = Tuple{mas[i], i}
	}
	sort.Sort(array)
	on := make([]int, n)
	for i := 0; i < n; i++ {
		on[array[i].b] = i & 1
	}

	for j := 0; j < m; j++ {
		diff := 0
		for i := 0; i < n; i++ {
			if A[j] <= mas[i] && mas[i] <= B[j] {
				if on[i] == 0 {
					diff++
				} else {
					diff--
				}
			}
		}
		if absInt(diff) > 1 {
			printInt(-1)
			printLine()
			return
		}
	}

	for i := 0; i < n; i++ {
		printInt(on[i])
		if i + 1 == n {
			printLine()
		} else {
			printString(" ")
		}
	}

}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
	logger  *log.Logger
)

func main() {
	local := flag.Bool("local", false, "Equals true, if run is local.")
	flag.Parse()

	var (
		input  *os.File
		output *os.File
	)

	if *local {
		startTime := time.Now()
		defer func() {
			println(fmt.Sprintf("Time: %.5fs", time.Since(startTime).Seconds()))
		}()
		input, _ = os.Open("/home/outside/coding/workspace/go/io/input.txt")
		output, _ = os.Create("/home/outside/coding/workspace/go/io/output.txt")
		logger = log.New(output, "log: ", 0)
	} else {
		input = os.Stdin
		output = os.Stdout
		// input, _ = os.Open("")
		// output, _ = os.Create("")
	}
	defer input.Close()
	defer output.Close()

	scanner = bufio.NewScanner(input)
	scanner.Split(bufio.ScanWords)

	writer = bufio.NewWriter(output)
	defer writer.Flush()

	solve()
}

// Read.

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

func readLine() string {
	scanner.Split(bufio.ScanLines)
	defer scanner.Split(bufio.ScanWords)
	return readString()
}

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

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

func readFloat64() float64 {
	ans, _ := strconv.ParseFloat(readString(), 64)
	return ans
}

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printLine() {
	printString("\n")
}

func printInt(value int) {
	printString(strconv.FormatInt(int64(value), 10))
}

func printInt64(value int64) {
	printString(strconv.FormatInt(value, 10))
}

func printFLoat64(value float64) {
	printString(strconv.FormatFloat(value, 'f', 20, 64))
}

// Log.

func logln(value ...interface{}) {
	writer.Flush()
	logger.Println(value...)
}
func logf(format string, value ...interface{}) {
	writer.Flush()
	logger.Printf(format, value...)
}

// Tuple

type Tuple struct {
	a, b int
}

type TupleSlice []Tuple

func (p TupleSlice) Len() int {
	return len(p)
}

func (p TupleSlice) Less(j, i int) bool {
	return p[j].a < p[i].a
}

func (p TupleSlice) Swap(j, i int) {
	p[j], p[i] = p[i], p[j]
}

// Min, max, abs.

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

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

func absInt(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

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

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

func absInt64(a int64) int64 {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a < b {
		return a
	} else {
		return b
	}
}

func absFloat64(a float64) float64 {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

// Set Key interface implementations.

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}


package main

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

func main() {
	sc := NewScanner()
	N, K := sc.NextInt64(), sc.NextInt64()
	m := int64(0)
	if K%2 == 0 {
		m = K/2 - 1
	} else {
		m = K / 2
	}
	Q := max(0, min(m, N-(K-m-1)))
	fmt.Println(Q)

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

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

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 (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var reader io.Reader
var scanner *bufio.Scanner

func Init(io io.Reader, max_token_size int) {
	reader = bufio.NewReader(io)
	scanner = bufio.NewScanner(reader)
	// max token size
	scanner.Split(bufio.ScanWords)
	scanner.Buffer([]byte{}, max_token_size)
}

func stderr(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
}

func die(v ...interface{}) {
	fmt.Fprintln(os.Stderr, v...)
	os.Exit(1)
}

func NextInt() int {
	bytes := NextBytes()
	i, err := Atoi(bytes)
	if err != nil {
		die(err)
	}
	return i
}

func NextBytes() []byte {
	if !scanner.Scan() {
		die(scanner.Err())
	}
	bytes := scanner.Bytes()
	copied := make([]byte, len(bytes))
	copy(copied, bytes)
	return copied
}

func Atoi(b []byte) (int, error) {
	neg := false
	if b[0] == '+' {
		b = b[1:]
	} else if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	n := 0
	for _, v := range b {
		if v < '0' || v > '9' {
			return 0, strconv.ErrSyntax
		}
		n = n*10 + int(v-'0')
	}
	if neg {
		return -n, nil
	}
	return n, nil
}

func ExtendByteArray(a []byte, size int) []byte {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]byte, size-len(a))...)
	}
}

func ExtendIntArray(a []int, size int) []int {
	if size <= len(a) {
		return a
	} else {
		return append(a, make([]int, size-len(a))...)
	}
}

func main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	n := NextInt()
	b := make([]int, n)
	r := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = NextInt()
	}
	var k01, k10 int
	for i := 0; i < n; i++ {
		r[i] = NextInt()
		if b[i] == 0 && r[i] == 1 {
			k01++
		} else if b[i] == 1 && r[i] == 0 {
			k10++
		}
	}
	if k10 == 0 {
		fmt.Fprintln(out, -1)
		return
	}
	res := k01/k10 + 1
	fmt.Fprintln(out, res)
}


package main

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

// https://codeforces.com/contest/1426/problem/D

var in *bufio.Reader
var out *bufio.Writer

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

func scan(a ...interface{}) (n int, err error) {
	return fmt.Fscan(in, a...)
}

var err error

func next() (n string) {
	scan(&n)
	return n
}

func nextInt() (n int) {
	scan(&n)
	return n
}

func nextInt64() (n int64) {
	scan(&n)
	return n
}

func nextDouble() (n float64) {
	scan(&n)
	return n
}

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

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

// ==================== 以上是模版 ====================
func getIn() *bufio.Reader {
	/*

			1 2 -1 -2 1
			-1 | 1 | -1 | 1  | -1 | 1 1 | -1 -1

			4 -2 3 -9 2

		// 1. 获取到全部可能到值
			-3, 2
			1, 10 1,2
			2, 20
			3, 5, 3,5
			4,30  4,5
			6-10,

		//
			a b c d

			求和问题
			维护一个range
	*/
	x := `
2
the minimum and the maximum number of rounds Alice can win
// 最大赢次数，优先赢，贪心
// 最小赢次数，优先输，贪心
石头 剪刀 布
0 	1 	1
1 	1 	0
`

	return bufio.NewReaderSize(strings.NewReader(x), 8192)
}

// 0 > 1 > 2 > 0
func Win(a, b int) int64 {
	if a == 0 && b == 1 {
		return 1
	}
	if a == 1 && b == 2 {
		return 1
	}
	if a == 2 && b == 0 {
		return 1
	}
	return 0
}

func solve() {
	_ = nextInt()
	aa := [3]int64{}
	bb := [3]int64{}
	for i := 0; i < 3; i++ {
		aa[i] = nextInt64()
	}
	for i := 0; i < 3; i++ {
		bb[i] = nextInt64()
	}

	/*
		石头 剪刀 布
		479 178 29
		11 145 530

		468	33 0
		0	0  501

	*/

	// 排列组合
	x := [][3]int{
		{0, 1, 2},
		{0, 2, 1},
		{1, 0, 2},
		{1, 2, 0},
		{2, 0, 1},
		{2, 1, 0},
	}
	y := [][3]int{
		{0, 1, 2},
		{0, 2, 1},
		{1, 0, 2},
		{1, 2, 0},
		{2, 0, 1},
		{2, 1, 0},
	}
	// 0 > 1 > 2 > 0
	maxWin := int64(0)
	minWin := int64(3000000000)
	for _, c := range x {
		for _, d := range y {
			a := aa
			b := bb
			i := 0
			j := 0
			// a[c[i]] 当前的值 有多少
			// b[j] 当前的值 有多少
			// 比较关系 c[i] 和 j
			win := int64(0)
			for i < 3 && j < 3 {
				if a[c[i]] > b[d[j]] {
					a[c[i]] -= b[d[j]]
					win += b[d[j]] * Win(c[i], d[j])
					j += 1
				} else if a[c[i]] < b[d[j]] {
					b[d[j]] -= a[c[i]]
					win += a[c[i]] * Win(c[i], d[j])
					i += 1
				} else {
					win += a[c[i]] * Win(c[i], d[j])
					i += 1
					j += 1
				}
			}
			//fmt.Println(i, j)
			maxWin = Max(maxWin, win)
			minWin = Min(minWin, win)
		}
	}
	printf("%d %d", minWin, maxWin)
}

func main() {
	in = bufio.NewReaderSize(os.Stdin, 8192)
	//in = getIn()

	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()
	//for t := nextInt(); t > 0; t-- {
	solve()
	//}
}


package main

import (
	"fmt"
)

func main() {
	var n uint64
	var m uint64
	var a uint64
	fmt.Scanf("%d", &n)
	fmt.Scanf("%d", &m)
	fmt.Scanf("%d", &a)
	var x uint64 = (n / a)
	var y uint64 = (m / a)
	if(n % a != 0) {
		x += 1
	}
	if(m % a != 0) {
		y += 1
	}
	fmt.Printf("%d\n", (x*y))
}


package main

import (
	"fmt"
)

func main() {
	var (
		length int
		str   string
	)

	fmt.Scanf("%d\n", &length)
	fmt.Scan(&str)
	pokemons := []string {"vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon"}

	sameLength := make([]string, 0)
	for i := 0; i < len(pokemons); i++ {
		if len(pokemons[i]) == length {
			sameLength = append(sameLength, pokemons[i])

		}
	}

	for j := 0; j < len(sameLength); j++ {
		for i :=  0; i < len(str); i++ {
			if (str[i] == sameLength[j][i] || str[i] == '.') && (i == (len(str) - 1)) {
				fmt.Println(sameLength[j])
				return
			} else if (str[i] != sameLength[j][i]) && (str[i] != '.') {
				break
			}
		}
	}
}


package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	if a+b < n {
		fmt.Print(b + 1)
	} else {
		fmt.Print(n - a)
	}
}


package main

import "fmt"
import "math/big"

func main() {
	var ns, ks string
	n, k := new(big.Int), new(big.Int)
	fmt.Scanf("%s %s", &ns, &ks)
	fmt.Sscan(ns, n)
	fmt.Sscan(ks, k)
	r := new(big.Int).Div(n, k)
	r.Mod(r, big.NewInt(2))

	if r.Cmp(big.NewInt(0)) == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
	// fmt.Printf("n: %d, k: %d, r: %d\n", n, k, r)
}


package main

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

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

	readint := func() int {
		sc.Scan()
		x, _ := strconv.Atoi(string(sc.Bytes()))
		return x
	}

	a := readint()
	b := readint()
	s := readint()

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

	m := abs(a) + abs(b)

	ans := "No"
	if m <= s {
		s -= m
		if s%2 == 0 {
			ans = "Yes"
		}
	}

	fmt.Println(ans)
}


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)
	switch n%4{
	case 1:
		fmt.Println("0 A")
	case 2:
		fmt.Println("1 B")
	case 3:
		fmt.Println("2 A")
	case 0:
		fmt.Println("1 A")
	}
}


package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var ans []int
	for i := 1; ; i++ {
		ni := n - i
		if ni < i+1 {
			ans = append(ans, i+ni)
			break
		} else {
			ans = append(ans, i)
			n -= i
		}
	}
	fmt.Println(len(ans))
	for _, v := range ans {
		fmt.Print(v, " ")
	}
}


// hello project main.go
package main

import (
    "fmt"
)

func main() {
    var s,t string
    fmt.Scanf("%s %s",&s, &t)
    lens := len(s)
    lent := len(t)
    suma := 0
    for i := 0 ;i < lens; i ++ {
        if '+' == s[i]{
            suma ++
        }else {
            suma --
        }
    }
    sum := 0; sumb := 0
    for i := 0; i < lent; i ++ {
        if '?' == t[i]{
            sum ++
        }else if '+' == t[i]{
            sumb ++
        }else {
            sumb --
        }
    }
    n := 1 << uint(sum)
    m := 0
    for i := 0 ;i < n; i ++ {
        tmp := sumb
        for j := 0;j < sum; j ++{
            if (int)(1 <<uint (j)) & i != 0 {
                tmp ++
            }else {
                tmp --
            }
        }
        if tmp == suma {
            m ++
        }
    }
     ans := (float32)(m)/(float32)(n)
    fmt.Printf("%.9f\n",ans)
}


package main

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

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

	var s string
	fmt.Fscanf(in, "%s\n", &s)
	fmt.Println(loveA(s))
}

func loveA(s string) int {
	lenS := len(s)
	lenA := strings.Count(s, "a")

	if lenA > lenS/2 {
		return lenS
	}

	return lenS - (lenS - 2*lenA + 1)
}


package main

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

func min0(a, b int64) int64 {
	if a < 0 {
		return b
	}

	if b < 0 {
		return a
	}

	if a < b {
		return a
	}
	return b
}

func pp(args... interface{}) {
	if true {
		return
	}
	fmt.Println(args...)
}

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

	scanner.Scan()
	data := strings.Split(scanner.Text(), " ")

	cabs, _ := strconv.ParseInt(data[0], 10, 64)
	dils, _ := strconv.ParseInt(data[1], 10, 64)

	pBuild, _ := strconv.ParseInt(data[2], 10, 64)
	pDestroy, _ := strconv.ParseInt(data[3], 10, 64)

	start := time.Now()

	low := cabs / dils * dils
	high := low + dils

	if high == cabs {
		fmt.Print(0)
		return
	}

	pLow := pDestroy * (cabs - low)
	pHigh := pBuild * (high - cabs)
	pDestroyAll := pDestroy * cabs

	pp(high, low, cabs, pLow, pHigh, pDestroyAll)

	fmt.Println(min0(min0(pLow, pHigh), pDestroyAll))

	pp(time.Since(start))
}


package main

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

func main() {
	do()
}

func do() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	s.Scan()
	m, _ := strconv.Atoi(s.Text())
	s.Scan()
	k, _ := strconv.ParseInt(s.Text(), 10, 64)
	s.Scan()
	x, _ := strconv.Atoi(s.Text())
	s.Scan()
	y, _ := strconv.Atoi(s.Text())

	min := minAsk(n, m, k)
	max := maxAsk(n, m, k)
	cnt := count(n, m, x, y, k)
	fmt.Printf("%v %v %v\n", max, min, cnt)
}

func minAsk(n, m int, k int64) int64 {
	if n <= 2 {
		return k / int64(n*m)
	}

	t := int64(2*n*m - 2*m)
	th := int64(n * m)
	d := k / t
	r := k % t

	if r < th {
		return d
	}
	return d + 1
}

func maxAsk(n, m int, k int64) int64 {
	if n <= 2 {
		d := k / int64(n*m)
		r := k % int64(n*m)
		if r > 0 {
			return d + 1
		}
		return d
	}

	t := int64(2*n*m - 2*m)
	th := int64(n * m)
	d := k / t
	r := k % t

	if d > 0 && r <= int64(m) {
		return d * 2
	} else if r <= th {
		return d*2 + 1
	}

	return d*2 + 2
}

func count(n, m, x, y int, k int64) int64 {
	if n <= 2 {
		d := k / int64(n*m)
		r := k % int64(n*m)
		if r >= int64((x-1)*m+y) {
			return d + 1
		}
		return d
	}

	t := int64(2*n*m - 2*m)
	th := int64(n * m)
	d := k / t
	r := k % t

	if x == 1 {
		if r >= int64(y) {
			return d + 1
		}
		return d
	} else if x == n {
		if r-int64((n-1)*m) >= int64(y) {
			return d + 1
		}
		return d
	} else {
		if r < int64((x-1)*m+y) {
			return d * 2
		} else if r >= int64((x-1)*m+y) && r < th+int64((n-x-1)*m+y) {
			return d*2 + 1
		}
	}

	return d*2 + 2
}


package main

import "fmt"

func main() {
	var a, b, c , d int
	fmt.Scanf("%d\n%d\n%d\n%d\n", &a, &b, &c, &d);
	if c != 0{
		a--
		d--
	}
	if a >= 0 && d >= 0 && a == d{
		fmt.Println(1)
	}else{
		fmt.Println(0)
	}
}


package main

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

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

func main() {
	defer out.Flush()
	var r, c, n, k int
	fmt.Fscan(in, &r, &c, &n, &k)
	a := make([][]int, r)
	for i := range a {
		a[i] = make([]int, c)
	}
	for i := 0; i < n; i++ {
		var x, y int
		fmt.Fscan(in, &x, &y)
		a[x-1][y-1]++
	}
	ans := 0
	for x0 := 0; x0 < r; x0++ {
		for y0 := 0; y0 < c; y0++ {
			for x1 := x0; x1 < r; x1++ {
				for y1 := y0; y1 < c; y1++ {
					count := 0
					for x := x0; x <= x1; x++ {
						for y := y0; y <= y1; y++ {
							count += a[x][y]
						}
					}
					if count >= k {
						ans++
					}
				}
			}
		}
	}
	fmt.Fprintln(out, ans)
}


package main

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

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

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

	sum := 0

	for i := 0; i < 5; i++ {
		sum += nextInt()
	}

	if (sum % 5 == 0 && sum != 0) {
		println(sum / 5)
	} else {
		println(-1)
	}
}

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

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

func nextFloat() float64 {
	n, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		panic(err)
	}
	return n
}

func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}


package main

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

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

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

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	n := readi()
	if n == 1 {
		println("Yes")
		return
	}
	s := readb()
	c := make([]int, 26)
	for _, b := range s {
		c[b-'a']++
	}
	//eprintln(c)
	ok := false
	for _, v := range c {
		if 1 < v {
			ok = true
		}
	}
	if ok {
		println("Yes")
	} else {
		println("No")
	}

}


package main

import (
	"fmt"
)

func MaxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	var n int
	fmt.Scanf("%d", &n)
	var arr [101]int
	var brr [101]int
	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i])
		brr[arr[i]]++
	}
	res := 0
	for _, v := range brr {
		res = MaxInt(res, v)
	}
	fmt.Println(res)

}