package main

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

func solve(k, a, b int64) int64 {
	c := a / k + b / k
	fmt.Printf("%d %d %d\n", k, a, b)
	if k * c <= a + b && a + b <= c * (2 * k - 1) {
		return c
	}
	return -1
}

func main() {
	r := bufio.NewReaderSize(os.Stdin, 1<<16)
	s, _, _ := r.ReadLine()
	ss := bytes.SplitN(s, []byte{' '}, 3)
	k, _ := strconv.ParseInt(string(ss[0]), 10, 32)
	a, _ := strconv.ParseInt(string(ss[1]), 10, 32)
	b, _ := strconv.ParseInt(string(ss[2]), 10, 32)
	fmt.Printf("%d\n", solve(k, a, b))
}


package main

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

func solve(k, a, b int64) int64 {
	a0 := a / k
	b0 := b / k
	if a - a0 * k > b0 * (k - 1) {
		return -1
	}
	if b - b0 * k > a0 * (k - 1) {
		return -1
	}
	return a0 + b0
}

func main() {
	cin := NewParser(bufio.NewReaderSize(os.Stdin, 1<<16))
	k := cin.nextInt64()
	a := cin.nextInt64()
	b := cin.nextInt64()
	fmt.Printf("%d\n", solve(k, a, b))
}

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

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

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

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

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

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

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

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


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")

	text, _ = reader.ReadString('\n')
	text = strings.TrimRight(text, "\r\n")

	yes := false
	if strings.Contains(text, "0") {
		if strings.ContainsAny(text, "123") {
			yes = true
		}
	} else {
		if strings.ContainsAny(text, "123") && strings.ContainsAny(text, "79") {
			if strings.ContainsAny(text, "147") && strings.ContainsAny(text, "369") {
				yes = true
			}
		}
	}
	if yes {
		println("YES")
	} else {
		println("NO")
	}

}


package main

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

func digit2pos(a int) (int, int) {
	if a == 0 {
		return 3, 1
	}
	a--
	return a / 3, a % 3
}

func legal(y, x int) bool {
	if y == 3 {
		return x == 1
	}
	return y >= 0 && y <= 3 && x >= 0 && x <= 3
}

// apply a→b like move to x
func move(x, a, b int) int {
	ay, ax := digit2pos(a)
	by, bx := digit2pos(b)

	py, px := digit2pos(x)

	py += by - ay
	px += bx - ax

	if !legal(py, px) {
		return -1
	}
	if py == 3 {
		return 0
	}
	return 1 + py*3 + px
}

func main() {
	n := getInt()
	w := getWord()

	var cnt int
	for f := 0; f <= 9; f++ {
		x := f
		for j := 1; j < n; j++ {
			x = move(x, int(w[j-1]-'0'), int(w[j]-'0'))
			if x == -1 {
				break
			}
		}
		if x != -1 {
			cnt++
		}
	}

	if cnt == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

type Input struct {
	*bufio.Scanner
}

var globalInput = wrapStdin()

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

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

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

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

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


package main

import (
	"fmt"
	"math"
)

func main() {
	names := []string{"Sheldon", "Leonard", "Penny", "Rajesh", "Howard"}
	var n float64
	fmt.Scan(&n)
	i := 0.0
	for {
		full := 5 * math.Pow(2.0, float64(i))
		if full > n {
			break
		}
		n -= full
		i++
	}
	fmt.Println(names[int(math.Ceil(n/math.Pow(2.0, float64(i))))-1])
}


package main

import "fmt"

func main() {
	var n int
	var arr []int = []int{1, 2, 3, 4, 5}
	fmt.Scanf("%d\n", &n)
	for i := 1; i < n; i++ {
		arr = append(arr[1:], arr[0], arr[0])
	}
	switch arr[0] {
	case 1:
		fmt.Println("Sheldon")
	case 2:
		fmt.Println("Leonard")
	case 3:
		fmt.Println("Penny")
	case 4:
		fmt.Println("Rajesh")
	case 5:
		fmt.Println("Howard")
	}
}


package main

import "fmt"

func main()  {
   var plus,num,current int
   current=0
   plus=1
fmt.Scan(&num)
for current<num{
current += plus
if current >= num {
fmt.Println("Sheldon")
break
}
current += plus
if current >= num {
fmt.Println("Leonard")
break
}
current += plus
if current >= num {
fmt.Println("Penny")
break
}
current += plus
if current >= num {
fmt.Println("Rajesh")
break
}
current += plus
if current >= num {
fmt.Println("Howard")
break
}
plus++
}
}


package main

import "fmt"

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


package main

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

var scanner *bufio.Scanner

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

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

  n := getI()
  d2 := n*n

  result := 0
  if n > 0 {
    result += 4
  }
  if n > 1 {
    x := int(float64(n)/math.Sqrt(2))
    if (x+1)*(x+1) + x*x > d2 {
      result += 4
    }
  }

  x, y := n, 0
  for true {
    y++
    for x*x + y*y > d2 {
      x--
    }
    if x <= y {
      break
    }
    result += 8
  }

  writer.WriteString(fmt.Sprintf("%d\n", result))
}


package main

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

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

	fingers := 0

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < n && scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}
		fingers += a
	}

	fingers %= (n + 1)
	if fingers == 0 {
		fmt.Println(2)
	} else {
		fmt.Println(1)
	}
}


package main

import "fmt"

func main() {
    var n,a int
    fmt.Scan(&n)
    total := 0
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        total += a
    }
    total--
    n++
    if total%n == 0 {
        fmt.Println(1)
    } else {
        for i := 1; i <= 5; i++ {
            if (total+i)%n != 0 {
                fmt.Println(i)
                break
            }
        }
    }
}


package main

import
	"fmt"

func main() {
	 var n,ans,size,sum int
   fmt.Scanf("%d",&n)
   size=n+1
  for j:=0;j<n;j++{
   fmt.Scanf("%d",&ans)
   sum+=ans
 }
 ans=0
 for i:=1;i<6;i++{
    if sum+i%size!=1{
        ans++;
      }
  }
  fmt.Printf("%d",ans)
}


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

package main

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

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

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

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

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

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

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

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

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

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

var (
	n int64
)

func main() {
	n = readInt64()

	ans := 0
	for {
		ans++
		if IsPrime(n) {
			break
		}

		p := sub(n - 2)
		n -= p
	}
	fmt.Println(ans)
}

// n以下の最大の素数を返す
func sub(n int64) int64 {
	for i := n; i >= 2; i-- {
		if IsPrime(i) {
			return i
		}
	}
	return 1
}

// IsPrime judges whether an argument integer is a prime number or not.
func IsPrime(n int64) bool {
	var i int64

	if n == 1 {
		return false
	}

	for i = 2; i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}

	return true
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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


package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var path string
	fmt.Fscanf(reader, "%s\n", &path)
	b := []byte(path)
	for i := 0;i < len(b);i ++ {
		if i == 0 || b[i] != '/' || b[i - 1] != '/' {
			fmt.Printf("%c", b[i])
		}
	}

}


package main

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

var scanner *bufio.Scanner

func getI64() int64 {
  scanner.Scan()
  x, _ := strconv.ParseInt(scanner.Text(), 10, 64)
  return x
}
func 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()

  s := getS()
  chars := []byte{ s[0] }
  for i := 1; i < len(s); i++ {
    if s[i] != '/' || s[i-1] != '/' {
      chars = append(chars, s[i])
    }
  }
  if len(chars) > 1 && s[len(chars)-1] == '/' {
    chars = chars[:len(chars)-1]
  }
  writer.WriteString(fmt.Sprintf("%s\n", string(chars)))
}


package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	pos := [201][201]int{}
	x, y := 100, 100
	pos[x][y] = 1

	var s string
	fmt.Fscanf(reader, "%s\n", &s)
	b := []byte(s)

	for i := 0; i < len(b); i++ {
		switch b[i] {
		case 'L':
			x--
		case 'R':
			x++
		case 'U':
			y--
		case 'D':
			y++
		}
		if pos[x][y] == 1 {
			fmt.Printf("BUG")
			return
		}
	}
	fmt.Printf("OK")
}


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


// https://codeforces.com/contest/8/problem/B
package main

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

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

func main() {

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

	const L = 100*3
	f := make([][]int, L)
	for i := 0; i < L; i++ {
		f[i] = make([]int, L)
	}

	l, c := 150, 150
	f[l][c] = 1
	for i := 0; i < len(str); i++ {
		switch str[i]  {
		case 'L': c--
		case 'R': c++
		case 'D': l++
		case 'U': l--
		}

		if f[l][c] > 0 {
			fmt.Print("BUG")
			return
		}

		f[l][c] = i + 2
		if i == 0 {
			continue
		}

		if (str[i] != 'D' && f[l - 1][c] > 0 && f[l][c] - f[l - 1][c] <= 3) ||
		(str[i] != 'U' && f[l + 1][c] > 0 && f[l][c] - f[l + 1][c] <= 3) ||
		(str[i] != 'R' && f[l][c - 1] > 0 && f[l][c] - f[l][c - 1] <= 3) ||
		(str[i] != 'L' && f[l][c + 1] > 0 && f[l][c] - f[l][c + 1] <= 3) {
			fmt.Print("BUG")
			return
		}
	}

	fmt.Print("OK")
}


// https://codeforces.com/contest/8/problem/B
package main

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

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

func main() {

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

	const L = 100*3
	f := make([][]int, L)
	for i := 0; i < L; i++ {
		f[i] = make([]int, L)
	}

	l, c := 150, 150
	f[l][c] = true
	for i := 0; i < len(str); i++ {
		switch str[i]  {
		case 'L': c--
		case 'R': c++
		case 'D': l++
		case 'U': l--
		}

		if f[l][c] > 0 {
			fmt.Print("BUG")
			return
		}

		if (f[l - 1][c] > 0 && f[l - 1][c] < i - 1) ||
		(f[l + 1][c] > 0 && f[l + 1][c] < i - 1) ||
		(f[l][c - 1] > 0 && f[l][c - 1] < i - 1) ||
		(f[l][c - 1] > 0 && f[l][c - 1] < i - 1) {
			fmt.Print("BUG")
			return
		}

		f[l][c] = i + 1
	}

	fmt.Print("OK")
}


package main

import (
	. "fmt"
	"strings"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	var x string
	Scan(&x)
	n := len(x)
	if n == 1 {
		Print(x)
		return
	}
	data := []byte(x)
	sum := 0
	for _, c := range x {
		sum += int(c - '0')
	}
	if x[1] == '9' {
		data[1] = '8'
		x9 := strings.Repeat("9", n-2)
		if newSum := int(data[0]-'0') + 8 + 9*(n-2); newSum <= sum {
			Print(x)
			return
		}
		Print(string(data[0]) + "8" + x9)
		return
	}
	data[0]--
	x9 := strings.Repeat("9", n-1)
	if newSum := int(data[0]-'0') + 9*(n-1); newSum <= sum {
		Print(x)
		return
	}
	if data[0] == '0' {
		Print(x9)
	} else {
		Print(string(data[0]) + x9)
	}
}


package main

import (
        "fmt"
)

var n int
var sum [60]int
var dp [60]int
var pie [60]int

func main() {
        fmt.Scan(&n)
        for i := n; i >= 1; i-- {
                fmt.Scan(&pie[i])
        }
        for i := 1; i <= n; i++ {
                sum[i] = sum[i-1] + pie[i]
                if dp[i-1] > sum[i-1]-dp[i-1]+pie[i] {
                        dp[i] = dp[i-1]
                } else {
                        dp[i] = sum[i-1] - dp[i-1] + pie[i]
                }
        }
        fmt.Println(dp[n], sum[n]-dp[n])
}


package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

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

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

type Int int64

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

func solve(n, l Int) {
	a, aa, b, bb := make(arr, n), make(arr, n), make(arr, n), make(arr, n)
	for i := Int(0); i < n; i++ {
		I(&a[i])
	}
	for i := Int(0); i < n; i++ {
		I(&b[i])
	}
	aa[0] = l - a[n-1] + a[0]
	bb[0] = l - b[n-1] + b[0]
	for i := Int(1); i < n; i++ {
		aa[i] = a[i] - a[i-1]
		bb[i] = b[i] - b[i-1]
	}
	sort.Sort(aa)
	sort.Sort(bb)
	for i := Int(0); i < n; i++ {
		if aa[i] != bb[i] {
			O("NO\n")
			return
		}
	}
	O("YES\n")
}

type arr []Int

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


package main
import (
	"fmt"
)

func cmp_slice_int(a, b []int) bool {
	la, lb := len(a), len(b)
	if la != lb {
		return false
	}
	for i, v := range a {
		if v != b[i] {
			return false
		}
	}
	return true
}

func main() {
	var n, l int
	fmt.Scanln(&n, &l)

	a := make([]int, n, n)
	b := make([]int, n, n)

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

	for i := 1; i < l; i++ {
		if cmp_slice_int(a, b) {
			fmt.Println("YES")
			return
		}
		for j := 0; j < n; j++ {
			a[j]++
		}
		if a[n-1] >= l {
			a = append(a[n-1:], a[:n-1]...)
			a[0] = a[0] % l
		}
	}

	fmt.Println("NO")
}


// B. Internet Address
/*
Vasya is an active Internet user. One day he came across an Internet resource he liked, so he wrote its address in the notebook. We know that the address of the written resource has format:
			<protocol>://<domain>.ru[/<context>]

where:

    <protocol> can equal either "http" (without the quotes) or "ftp" (without the quotes),
    <domain> is a non-empty string, consisting of lowercase English letters,
	 	the /<context> part may not be present. If it is present, then <context> is a non-empty string, consisting of lowercase English letters.

If string <context> isn't present in the address, then the additional character "/" isn't written. Thus, the address has either two characters "/" (the ones that go before the domain), or three (an extra one in front of the context).

When the boy came home, he found out that the address he wrote in his notebook had no punctuation marks. Vasya must have been in a lot of hurry and didn't write characters ":", "/", ".".

Help Vasya to restore the possible address of the recorded Internet resource.

Input
The first line contains a non-empty string that Vasya wrote out in his notebook. This line consists of lowercase English letters only.

It is guaranteed that the given string contains at most 50 letters. It is guaranteed that the given string can be obtained from some correct Internet resource address, described above.

Output
Print a single line — the address of the Internet resource that Vasya liked. If there are several addresses that meet the problem limitations, you are allowed to print any of them.

Examples
Input
httpsunrux

Output
http://sun.ru/x

Input
ftphttprururu

Output
ftp://http.ru/ruru

Note
In the second sample there are two more possible answers: "ftp://httpruru.ru" and "ftp://httpru.ru/ru".
*/
package main

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

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

	pIndex := 3
	url := "ftp://"
	if arr[0] == "h" {
		pIndex = 4
		url = "http://"
	}

	cIndex := len(arr)
	for i := pIndex + 1; i < len(arr)-1; i++ {
		if arr[i] == "r" && arr[i+1] == "u" {
			cIndex = i
			break
		}
	}
	if cIndex < len(arr) {
		fmt.Printf("%v%v.ru/%v", url, strings.Join(arr[pIndex:cIndex], ""), strings.Join(arr[cIndex+2:], ""))
	} else {

		fmt.Printf("%v%v.ru", url, strings.Join(arr[pIndex:cIndex], ""))
	}
}


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, m := getI(), getI()
  for {
    for i := 1; i <= n; i++ {
      if i > m {
        writer.WriteString(fmt.Sprintf("%d\n", m))
        return
      }
      m -= i
    }
  }
}


package main

import (
	"fmt"
)

func main() {
	var (
		n int8
		k int8
		i int8
	)
	fmt.Scanf("%d %d\n", &n, &k)
	as := make([]int8, n)
	for i < n{
		fmt.Scan(&as[i])
		i++
	}
	vk := as[k]
	if vk == 0 {
		fmt.Printf("0\n")
		return
	}
	s := k
	for _, v := range as[k:] {
		if v < vk {
			break
		}
		s ++
	}
	fmt.Printf("%d\n", s)
}


package main

import (
	"fmt"
	"os"
)

func main() {

	var numberOfParticipants, rating int = 0, 0
	_, _ = fmt.Scan(&numberOfParticipants)
	_, _ = fmt.Scan(&rating)

	var slice = make([]int, numberOfParticipants)
	for i := 0; i < numberOfParticipants; i++ {
		_, _ = fmt.Scan(&slice[i])
	}

	if slice[0] == 0 {
		fmt.Println(0)
		os.Exit(0)
	}

	for i := rating; i < len(slice); i++ {
		if slice[i] == slice[i+1] {
			rating++
			continue
		} else {
			break
		}
	}
	rating++

	fmt.Println(rating)

}


package main

import "fmt"

func main() {
	var (
		n, k, ans int
		a         [102]int
	)
	fmt.Scan(&n, &k)
	for i := 1; i <= n; i++ {
		fmt.Scan(&a[i])
	}
	ans = 0
	if a[k] > 0 {
		ans = k
	}

	for ; a[k] == a[k+1]; k++ {
	}
	if ans > 0 {
		ans = k
	}
	fmt.Print(ans)
}


// https://codeforces.com/problemset/problem/158/A
package main

import (
	"fmt"
	"os"
)

func main() {
	var numPar, place, cutoff int
	fmt.Scanln(&numPar, &place)
	var scores = make([]int, numPar)
	// read knon sized list from stdin
	for i := range scores {
		fmt.Scan(&scores[i])
	}

	cutoff = scores[place-1]

	// even score
	if cutoff == 0 {
		fmt.Println("0")
		os.Exit(1)
	}

	// at least cutoff
	for i := place - 1; i < numPar; i++ {
		if scores[i] >= cutoff {
			continue
		}
		fmt.Println(i)
		os.Exit(1)
	}

	os.Exit(0)

}


package main

import "fmt"

func main(){
	var n, k int
	fmt.Scan(&n, &k)
	if k > n {
		return
	}

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

	lolos := 0
	for j:=0; j<n; j++ {
		if skor[j] >= skor[k-1] && skor[j] > 0 && skor[k] > 0 {
			lolos += 1
		}
	}

	fmt.Println(lolos)
}


package main

import (
    "fmt"
)

func main() {
  var n, k, border int

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

  ints := make([]interface{}, 50)
  vals := make([]int, len(ints))

  for i, _ := range ints {
      ints[i] = interface{}(&vals[i])
  }
  fmt.Scan(ints...)

  border := vals[k]
  num := 0

  if border == 0 {
    fmt.Println(0)
  } else {
    for i, _ := range vals {
      if vals[i] < border {
        num++
      }
    }
    fmt.Println(num)
  }

  //fmt.Println(vals)
  //fmt.Println(n, k)
}


//第一行为参赛选手人数和第k位选手的分数
//只要分数高于或者等于第k位选手的都可以晋级
//测试数据已经从大到小排好序了
package main

import "fmt"

func main() {
	var total, num, result int
	fmt.Scanln(&total, &num)
	var array = make([]int, total+1)
	for i := 1; i <= total; i++ {
		fmt.Scan(&array[i])
	}
	result = 0
	if array[num] == 0 {
		for i := 1; i <= num; i++ {
			if array[i] > 0 {
				result++
			}
		}
	} else {
		result = num
		for i := num; i <= total; i++ {
			if total == num {
				break
			}
			if array[i+1] >= array[num] {
				result++
			}
		}
	}
	fmt.Println(result)
}


package main

import (
	"fmt"
)

func main() {
	var count, score int
	fmt.Scanf("%d %d\n", &count, &score)
	pars := make([]int, count)

	for i := 0; i < count; i++ {
		var num int
		fmt.Scanf("%d", &num)
		pars[i] = num
	}

	fmt.Println(NextRound(pars, score))
}

// NextRound ...
func NextRound(participants []int, index int) int {
	var result int
	var score = participants[index]
	for _, par := range participants {
		if par >= score && par > 0 {
			result++
		}
	}
	return result
}


package main

import(
    "fmt"
    "log"
)

func main(){
    var k,n int
    fmt.Scan(&n,&k)
    if n>=k{
        s := make([]int,n)
        res := 0
        for i:=0;i<n;i++{
            fmt.Scan(&s[i])
        }
        temp := s[k]
        for i:=0;i<len(s);i++{
            if s[i]>=temp && temp>0 && s[i]>0{
                res++
            }
        }
        fmt.Println(res)
    }else{
        log.Fatal("Invalid input")
    }
}


package main

import "fmt"

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

	var arr = make([]int, n)
	var count int

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

	for _, value := range arr{
		if value >= arr[k] && value != 0 {
			count++
		}
	}

	fmt.Println(count)
}


package main
import "fmt"

func main(){
	var n,k int
	fmt.Scan(&n,&k)
	var a = make([]int,n)
	x:=0
	for i:=0; i<n; i++{
		fmt.Scan(&a[i])
	}
	for i:=0; i<n; i++{
		if (a[i]>=a[k]) && (a[i]>0){
			x+=1
		}
	}
	fmt.Print(x)
}


/*package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var source string
	fmt.Scan(&source)
	splitted := strings.Split(source, "+")
	sum := 0
	for i := range splitted {
		if v, err := strconv.Atoi(splitted[i]); err == nil {
			sum += v
		}
	}
}
*/

/*
/*package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var source string
	fmt.Scan(&source)
	splitted := strings.Split(source, "+")
	sum := 0
	for i := range splitted {
		if v, err := strconv.Atoi(splitted[i]); err == nil {
			sum += v
		}
	}
}
*/
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	var points = make([]int, n)
	for i := range points {
		fmt.Scan(&points[i])
	}
	value := points[k-1]
	sort.Ints(points)
	var i int
	if value == 0 {
		for i = 0; value == points[i] && i < len(points); i++ {
		}
	} else {
		for i = 0; points[i] != value && i < len(points); i++ {

		}
	}
	fmt.Println(n - i)
}


package main

import (
	"fmt"
	"os"
)

func main() {
	var year int = 0
	fmt.Scan(&year)
	var num int

	unique := map[int]int{}
	for i := year + 1; i <= 9000; i++ {
		num = i
		for num != 0 {
			if _, ok := unique[num%10]; ok {
				//duplicate
				unique = map[int]int{}
				break
			} else {
				unique[num%10] = 1
			}
			num = num / 10
		}

		if len(unique) != 0 {
			fmt.Fprintf(os.Stdout, "%d", i)
			break
		}
		unique = map[int]int{}

	}

}


package main

import (
	"fmt"
)

func main() {
	var x, y int
	fmt.Scanf("%d %d\n", &x, &y)
	if x == y {
		fmt.Println("=")
		return
	}
	if x > y {
		if y >= 3 {
			fmt.Println("<")
			return
		}
		if y == 2 {
			if x == 4 {
				fmt.Println("=")
				return
			}
			if x == 3 {
				fmt.Println(">")
				return
			}
			if x > 4 {
				fmt.Println("<")
				return
			}
		}
		if y == 1 {
			fmt.Println(">")
		}
	}
	if x < y {
		if x >= 3 {
			fmt.Println(">")
			return
		}
		if x == 2 {
			if y == 4 {
				fmt.Println("=")
				return
			}
			if y == 3 {
				fmt.Println("<")
				return
			}
			if y > 4 {
				fmt.Println(">")
				return
			}
		}
		if y == 1 {
			fmt.Println("<")
		}
	}
}


package main

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

func solve() {
	x := readInt()
	y := readInt()
	if y == x {
		fmt.Println("=")
	} else if y < x {
		fmt.Println("<")
	} else {
		fmt.Println(">")
	}
}

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

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

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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


package main

import "fmt"

func main() {
  var (
    x int
    y int
    z int
    t1 int
    t2 int
    t3 int
  )
  fmt.Scanln(&x,&y,&z,&t1,&t2,&t3)
  if z == x {
    if t1*abs(y-x) < t2*abs(y-x)+t3*2 {
      fmt.Println("NO")
    } else {
      fmt.Println("YES")
    }
  } else {
    if t1*abs(y-x) < t2*(z-x)+t2*(y-x)+t3*4 {
      fmt.Println("NO")
    } else {
      fmt.Println("YES")
    }
  }
}

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


package main

import "fmt"
import "math"

func main() {
  var (
    x int
    y int
    z int
    t1 int
    t2 int
    t3 int
  )
  fmt.Scanln(&x,&y,&z,&t1,&t2,&t3)
  if z == x {
    if t1*math.Abs(y-x) <= t2*math.Abs(y-x)+t3*2 {
      fmt.Println("NO")
    } else {
      fmt.Println("YES")
    }
  } else {
    if t1*math.Abs(y-x) <= t2*math.Abs(z-x)+t2*math.Abs(y-x)+t3*3 {
      fmt.Println("NO")
    } else {
      fmt.Println("YES")
    }
  }
}


package main
import (
    "fmt"
)

func main(){
    var x,y,z,t1,t2,t3 int
    fmt.Scan(&x,&y,&z,&t1,&t2,&t3)

    if math.Abs(x-y)*t1 - math.Abs(x-z)*t2 - math.Abs(x-y)*t2 < 2*t3 {
        fmt.Println("NO")
    }else{
        fmt.Println("YES")
    }
}


package main
import (
    "fmt"
)

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

func main(){
    var x,y,z,t1,t2,t3 int
    fmt.Scan(&x,&y,&z,&t1,&t2,&t3)

    if abs(x-y)*t1 - abs(x-z)*t2 - abs(x-y)*t2 < 2*t3 {
        fmt.Println("NO")
    }else{
        fmt.Println("YES")
    }
}


package main

import (
	"fmt"
	"math"
)

func main(){
    var rel int
    flag := false
    fmt.Scan(&rel)
    var ar [5]int
    for i:=0; i<5; i++ {
        fmt.Scan(&a)
        fmt.Scan(&b)
        ar[a]++
        ar[b]++
    }
    for i:=0; i<5; i++ {
        if(ar[i] == 2){
            flag = true
        }
    }
    if(flag)
        fmt.Println("WIN");
    else
        fmt.Println("FAIL");

}


package main

import (
	"fmt"
)

func main() {
	var rel int
	var a int
	var b int
	flag := false
	fmt.Scan(&rel)
	var ar [5]int
	for i := 0; i < 5; i++ {
		fmt.Scan(&a)
		fmt.Scan(&b)
		ar[a-1]++
		ar[b-1]++
	}
	for i := 0; i < 5; i++ {
		if ar[i] == 2 {
			flag = true
		}
	}
	if flag {
		fmt.Println("WIN")
	} else {
		fmt.Println("FAIL")
	}
}


package main

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

func main() {
	sc := NewScanner()
	S := make([][]int, 4)
	for i := 0; i < 4; i++ {
		S[i] = sc.NextIntArray()
	}
	for i := 0; i < 4; i++ {
		if S[i][0]+S[i][1]+S[i][2] > 0 && S[i][3] > 0 {
			fmt.Println("YES")
			return
		}
	}
	if S[0][0]+S[1][1]+S[2][2] > 0 && S[3][3] > 0 {
		fmt.Println("YES")
		return
	}
	if S[0][1]+S[1][2]+S[2][0] > 0 && S[2][3] > 0 {
		fmt.Println("YES")
		return
	}

	if S[0][2]+S[1][0]+S[2][1] > 0 && S[1][3] > 0 {
		fmt.Println("YES")
		return
	}

	fmt.Println("NO")

}

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

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

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

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

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

	return mp
}

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


package main

import (
  "fmt"
)

func main() {
  var s string
  jumpval :=0
  current := 1
  vowels := "AEIOUY"
  fmt.Scanf("%s", &s)
  for i:=0; i < len(s); i++ {
    for j:=0; j < len(vowels); j++ {
      if vowels[j] == s[i]{
        if jumpval < current {
          jumpval = current
        }
        current = 0
        break
      }
    }
    current++
  }
  fmt.Println(jumpval)
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var s string
	fmt.Scan(&s)
	letters := make(map[string]int)
	distance := []int{-1}
	letters["A"] = 1
	letters["E"] = 1
	letters["I"] = 1
	letters["O"] = 1
	letters["U"] = 1
	letters["Y"] = 1
	for index, char := range(s) {
		if _, exist := letters[string(char)]; exist {
			distance = append(distance, index)
		}
	}

	distance = append(distance, len(s) - 1)
	if len(distance) > 2 {
		ans := 0
		for index, val := range(distance) {
			if index == 0 {
				continue
			}
			diff := math.Abs(float64(val - distance[index-1]))
			if diff > float64(ans) {
				ans = int(diff)
			}
		}
		fmt.Println(ans)
	} else {
		fmt.Println(1 + len(s))
	}
}


package main

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

var sc *bufio.Scanner = bufio.NewScanner(os.Stdin)
var w *bufio.Writer = bufio.NewWriter(os.Stdout)

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

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

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

func pri(n int)    { w.WriteString(strconv.Itoa(n)) }
func prll(n int64) { w.WriteString(strconv.FormatInt(n, 10)) }
func sp()          { w.WriteByte(' ') }
func endl()        { w.WriteByte('\n') }

func main() {
  sc.Split(bufio.ScanWords)
  a, b := nll(), nll()
  s := next()
  x, y := []int64{0}, []int64{0}
  xx, yy := int64(0), int64(0)
  for i := 0; i < len(s); i++ {
    switch s[i] {
    case 'U':
      yy++
    case 'D':
      yy--
    case 'L':
      xx--
    case 'R':
      xx++
    }
    x = append(x, xx)
    y = append(y, yy)
  }
  dx, dy := x[len(x)-1], y[len(y)-1]
  if dx != 0 && dy != 0 {
    for i := 0; i < len(s); i++ {
      if (a-x[i])%dx == 0 && (b-y[i])%dy == 0 && ((a-x[i])/dx == (b-y[i])/dy) {
        w.WriteString("Yes\n")
        w.Flush()
        return
      }
    }
  } else if dy != 0 {
    for i := 0; i < len(s); i++ {
      if (b-y[i])%dy == 0 && a == x[i] {
        w.WriteString("Yes\n")
        w.Flush()
        return
      }
    }
  } else if dx != 0 {
    for i := 0; i < len(s); i++ {
      if (a-x[i])%dx == 0 && b == y[i] {
        w.WriteString("Yes\n")
        w.Flush()
        return
      }
    }
  } else {
    for i := 0; i < len(s); i++ {
      if a == x[i] && b == y[i] {
        w.WriteString("Yes\n")
        w.Flush()
        return
      }
    }
  }
  w.WriteString("No\n")
  w.Flush()
}


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 n, k int
	scanf("%d%d\n", &n, &k)
	scores := make([]int, n + 1)
	for i := 1; i <= n; i += 1 {
		scanf("%d", &scores[i])
	}
	if scores[k] > 0 {
		score := scores[k]
		for scores[k] >= score {
			k += 1
		}
		k -= 1
	} else {
		for scores[k] <= 0 {
			k -= 1
		}
	}
	printf("%d\n", k)
}


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 arr[i] >= c&&arr[i]>0 {

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

}


package main

import (
	"fmt"
)

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

	var value int
	total := 0
	for i:=0; i<k; i++{
		fmt.Scanf("%d", &value)
		if value>0{
			total++
		}

	}

	var current int
	fmt.Scanf("%d", &current)

	for current>=value && current>0{
		fmt.Scanf("%d", &current)
		total++
	}
	fmt.Println(total)
}


package main

import "fmt"

func main() {
  var n, k int
  fmt.Scan(&n, &k)
  points := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&points[i])
  }
  answer := k - 1
  for i := k - 1; i < n; i++ {
    if points[i] == points[k] {
      answer++
    } else {
      break
    }
  }
  if points[k] > 0 {
    fmt.Println(answer)
  } else {
    fmt.Println(0)
  }
}


package main

import "fmt"

func main() {
	var n, k int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}
	if _, err := fmt.Scan(&k); err != nil {
		panic(err)
	}
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		if _, err := fmt.Scan(&arr[i]); err != nil {
			panic(err)
		}
	}
	totalsum := solve(arr, k)
	fmt.Println(totalsum)
}

func solve(arr []int, k int) int {
	var count int
	for i := 0; i < len(arr); i++ {
		if arr[i] > 0 && arr[i] >= arr[k] {
			count = count + 1
		}
	}
	return count
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	nk := scanner.Text()
	nk_split := strings.Fields(nk)
	n, _ := strconv.Atoi(nk_split[0])
	k, _ := strconv.Atoi(nk_split[1])
	scanner.Scan()
	scores := strings.Fields(scanner.Text())
	kscore, _:= strconv.Atoi(scores[k])
	count := 0
	for i := 0; i < n; i++ {
		iscore, _ := strconv.Atoi(scores[i])
		if  iscore >= kscore && iscore > 0{
			count++
		}
	}
	fmt.Printf("%d\n", count)
}


package main

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

func main() {

	count, bechmark := scanInt(), scanInt()
	givenArray := scanIntSlice(count)
	answer := 0

	for i := 0; i < count; i++{
		if givenArray[i] >= givenArray[bechmark] && givenArray[i] > 0{
			answer++
		}
	}

	printFmt(answer)

	close(channelType)
	oWg.Wait()
}

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

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

func init() {
	printFmt = fmt.Println

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

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

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

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

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

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

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


package main

import (
    "fmt"
)

const (
    maxn = 55
)

var a [maxn]int

func main() {
    var n, k int
    fmt.Scan(&n, &k)
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
    }
    var ans int
    for i := 0; i < n; i++ {
        if a[i] > 0 && a[i] >= a[k-1] {
            ans++
        }
    }
    var sc = fmt.Println(ans)
}


package main

import (
    "fmt"
)

const (
    maxn = 55
)

var arr = [maxn]int{}

func main() {
    var n, k int
    fmt.Scan(&n, &k)
    for i := 0; i < n; i++ {
        fmt.Scan(&a[i])
    }
    var ans int
    for i := 0; i < n; i++ {
        if a[i] > 0 && a[i] >= a[k-1] {
            ans++
        }
    }
    fmt.Println(ans)
}


package main

import "fmt"

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

	items := make([]int, n)
	ps := make([]interface{}, n)
	for i := range items {
		ps[i] = &items[i]
	}
	fmt.Scan(ps...)

	if items[k] == 0 {
		fmt.Println(0)
		return
	}

	for i := 0; i < n; i++ {
		if items[i] >= items[k] {
			res++
		}
	}

	fmt.Println(res)
}


package main

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

func main() {
	in := bufio.NewScanner(os.Stdin)
	in.Split(bufio.ScanWords)
	in.Scan()
	n, _ := strconv.Atoi(in.Text())
	in.Scan()
	k, _ := strconv.Atoi(in.Text())
	scores := []int{}
	passCount := 0
	for i := 0; i < n; i++ {
		in.Scan()
		scr, _ := strconv.Atoi(in.Text())
		scores = append(scores, scr)
	}
	pass := scores[n-k]

	sort.Ints(scores)
	for _, val := range scores {
		if val > 0 && val >= pass {
			passCount++
		}
	}
	fmt.Println(passCount)


package main

import (
    "fmt"
    "math"
)

func main() {

    var n, k, aryaCandies int
    var found bool = false
    fmt.Scanf("%d %d", &n, &k)

    for i := 1; i <= n; i++ {
        var foundCandy int
        fmt.Scanf("%d", &foundCandy)
        aryaCandies += foundCandy

        branCandies := int(math.Min(float64(aryaCandies), 8.0))
        k -= branCandies
        if k <= 0 {
            fmt.Println(i)
            found = true
            break
        }
        aryaCandies -= branCandies
    }

    if !found {
        fmt.Println(k)
    }
}


package main

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

func main() {
	sc := NewScanner()
	N, K := sc.NextInt(), sc.NextInt()

	a := sc.NextIntArray()

	p := 0
	for i := 0; i < N; i++ {
		q := min(8, a[i]+p)

		K -= q
		if K <= 0 {
			fmt.Println(i + 1)
			return
		}
		p = a[i] - q
	}
	fmt.Println(-1)
}

func min(a int, b int) int {
	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 "fmt"
func main(){
    var n,i,k,sum,c int32
    var f bool
    f=true
    fmt.Scanln(&n,&k)
    for i=1;i<=n;i++{
        var a int32
        fmt.Scanf("%d",&a)
        if a>8{
            sum=sum+a-8
            c=c+8
        }else{
			if a+sum>8{
       		    sum=sum-8+a
         	   	c=c+8
      		}else{
            	c=c+a
        	}
		}
        if (c>=k){
            f=false
            break
    	}
    }
    if c>=k{
        fmt.Println(i)
    }else{
        fmt.Println(-1)
    }
}


package main
import "fmt"
func main(){
    var n,i,k,sum,c int32
    fmt.Scanln(&n,&k)
    for i=1;i<=n;i++{
        var a int32
        fmt.Scanf("%d",&a)
        if a>8{
            sum=sum+a-8
            c=c+8
        }else{
			if a+sum>8{
       		    sum=sum-8+a
         	   	c=c+8
      		}else{
            	c=c+a
        	}
		}
        if (c>=k){
            break
    	}
    }
    if c>=k{
        fmt.Println(i)
    }else{
        fmt.Println(-1)
    }
}


package main

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

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

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

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

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

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

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	var l, q int64
	l = MAX(x, y)
	q = MIN(x, y)
	var m int64
	for l*q > 0 {
		a := l % q
		b := l - a
		cc := int64(b / q)
		remain := l - cc*q
		l = MAX(remain, q)
		q = MIN(remain, q)
		if l*q == 0 {
			m = l + q
			break
		}

	}
	return m

}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}

}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func LITTLE(x int) int64 {
	var answer int64
	answer = answer + int64((x*x*x*x-x*x)/4) + int64(x*x*(x-1)*(x-1)/8) - int64(x*(x-1)*(x+x+1)*(x+x-1)/12)
	return answer
}

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

	var n int
	fmt.Fscan(input, &n)
	if n == 1 {
		fmt.Println(1)
	}
	if n > 1 {
		var answer int64
		answer = 1
		for i := 2; i < n+1; i++ {
			answer = (answer*2 + int64(NumberOfDivisors(i)) - int64(NumberOfDivisors(i-1))) % 998244353

		}
		fmt.Println(answer)

	}
}


package main

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

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

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

// ----------------------------- TEMPLATE END ----------------------------------

const MOD = 998244353
const LCM16 = 720720 // lcm(1, 2, 3, ..., 16)
const MAXK = 17

func add(a, b int) int {
	return (a + b) % MOD
}

func mul(a, b int) int {
	return int(int64(a) * int64(b) % MOD)
}

func fpow(b, e int) int {
	r := 1
	for ; e > 0; e >>= 1 {
		if (e & 1) > 0 {
			r = mul(r, b)
		}
		b = mul(b, b)
	}
	return r
}

func inv(a int) int {
	return fpow(a, MOD-2)
}

var dp [MAXK + 1][LCM16]int

var prob0 int
var prob1 int

func calcDP(maxK int) {
	if maxK < 2 {
		return
	}
	for k := maxK; k >= 2; k-- {
		for r := 0; r < LCM16; r++ {
			dp[k][r] = add(
				mul(prob0, dp[k+1][r]),
				mul(prob1, add(dp[k+1][r-r%k], r%k)),
			)
		}
	}
}

func main() {
	defer flush()

	var n, a0, k, ai int
	var genX, genY, genMod int64
	scan(&n, &a0, &genX, &genY, &k, &genMod)

	ninv := inv(n)
	prob0 = mul(n-1, ninv)
	prob1 = ninv

	ans := 0
	for j := 1; j <= k; j++ {
		calcDP(j - 1)

		ai = a0
		for i := 0; i < n; i++ {
			ans = add(ans, mul(prob1, add(ai, MOD-dp[2][ai%LCM16])))
			ai = int((int64(ai)*genX + genY) % genMod)
		}
	}

	printf("%d\n", mul(ans, fpow(n, k)))
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1618F(in io.Reader, out io.Writer) {
	var x, y uint64
	Fscan(in, &x, &y)
	if x == y {
		Fprintln(out, "YES")
		return
	}
	s := strconv.FormatUint(x, 2)
	t := strconv.FormatUint(y, 2)
	f := func() bool {
		r := regexp.MustCompile("^1*" + s + "1*$")
		return r.MatchString(t)
	}
	s += "1"
	if f() {
		Fprintln(out, "YES")
		return
	}
	s = s[:len(s)-1]
	for s[len(s)-1] == '0' {
		s = s[:len(s)-1]
	}
	if f() {
		Fprintln(out, "YES")
	} else {
		Fprintln(out, "NO")
	}
}

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


package main

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

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

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

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

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

	T := 1
	// scan(&T)
	for t := 0; t < T; t++ {
		solve()
	}
}

type ll = int64

func reverse(a ll) ll {
	var b ll
	for a > 0 {
		b <<= 1
		b |= a & 1
		a >>= 1
	}
	return b
}

func isSorted(s string) bool {
	for i := 1; i < len(s); i++ {
		if s[i-1] > s[i] {
			return false
		}
	}
	return true
}

func tryFor(x, y ll) bool {
	sx, sy := strconv.FormatInt(x, 2), strconv.FormatInt(y, 2)
	if len(sy) < 60 {
		sy = strings.Repeat("0", 60-len(sy)) + sy
	}
	for i := 0; i+len(sx)-1 < len(sy); i++ {
		prefixSorted := isSorted(sy[:i])
		middle := sy[i : i+len(sx)]
		suffix := sy[i+len(sx):]
		onesOnSuffix := strings.Repeat("1", len(sy)-i-len(sx))
		if prefixSorted && middle == sx && suffix == onesOnSuffix {
			return true
		}
	}
	return false
}

func solve() {
	var x, y ll
	scan(&x, &y)
	ok := false
	for _, i := range [...]ll{x << 1, (x << 1) | 1, reverse(x << 1), reverse((x << 1) | 1)} {
		ok = ok || tryFor(i, y)
	}
	if !ok {
		printf("NO\n")
	} else {
		printf("YES\n")
	}
}


package main

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

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

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

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

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

	T := 1
	// scan(&T)
	for t := 0; t < T; t++ {
		solve()
	}
}

type ll = int64

func reverse(a ll) ll {
	var b ll
	for a > 0 {
		b <<= 1
		b |= a & 1
		a >>= 1
	}
	return b
}

func isSorted(s string) bool {
	for i := 1; i < len(s); i++ {
		if s[i-1] > s[i] {
			return false
		}
	}
	return true
}

func tryFor(x, y ll) bool {
	sx, sy := strconv.FormatInt(x, 2), strconv.FormatInt(y, 2)
	if len(sy) < 60 {
		sy = strings.Repeat("0", 60-len(sy)) + sy
	}
	for i := 0; i+len(sx)-1 < len(sy); i++ {
		prefixSorted := isSorted(sy[:i])
		middle := sy[i : i+len(sx)]
		suffix := sy[i+len(sx):]
		onesOnSuffix := strings.Repeat("1", len(sy)-i-len(sx))
		if prefixSorted && middle == sx && suffix == onesOnSuffix {
			return true
		}
	}
	return false
}

func solve() {
	var x, y ll
	scan(&x, &y)
	ok := false
	for _, i := range [...]ll{x << 1, (x << 1) | 1, reverse(x << 1), reverse((x << 1) | 1)} {
		ok = ok || tryFor(i, y)
	}
	if !ok {
		printf("NO\n")
	} else {
		printf("YES\n")
	}
}


package main

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

var ans int

func DFS(n int, x int64, now int) {
	if now >= ans {
		return
	}
	//println(n, x)
	a := make([]int, 10)
	m := int64(1)
	for i := 1; i < n; i++{
		m *= 10
	}
	if x >= m {
		ans = min(ans, now)
		return
	}
	tx := x
	for tx > 0 {
		a[tx%10] = 1
		tx /= 10
	}

	if a[9] == 1 {
		cnt := 0
		for x < m {
			x *= 9
			cnt++
		}
		ans = min(ans, now+cnt)
		return
	}

	for i, t := range a {
		if i <= 1 {
			continue
		}
		if t == 1 {
			DFS(n, int64(i)*x, now+1)
		}
	}
}

func Solve() {
	n := ri()
	var x int64
	scan(&x)
	ans = 114514
	DFS(n, x, 0)
	if ans == 114514 {
		ans = -1
	}
	println(ans)
}

func main() {
	T := 1 // 如果是单组样例，请讲 T := 0 改为 T := 1
	in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	if T == 0 {
		scan(&T)
	}
	for t := 0; t < T; t++ {
		Solve()
	}
	out.Flush()
}

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

// ri 将直接读入并返回一个 int
func ri() (x int) {
	scan(&x)
	return x
}

//rs 将直接读入并返回一个 string
func rs() (s string) {
	scan(&s)
	return s
}

//scan 用法与 fmt.scan() 相似，可以传入多个变量的地址进行读入操作
func scan(a ...interface{}) { Fscan(in, a...) }

//print 用法与 fmt.print() 相似，可以传入多个变量进行输出。注意，这个函数不会换行，多个变量之间有空格
func print(a ...interface{}) { Fprint(out, a...) }

//println 用法与 fmt.println() 相似，可以传入多个变量进行输出。这个函数会换行，多个变量之间有空格
func println(a ...interface{}) { Fprintln(out, a...) }

//min 可以传入多个 int 变量，求出这些变量的最小值
func min(a ...int) int {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < ans {
			ans = a[i]
		}
	}
	return ans
}

//max 可以传入多个 int 变量，求出这些变量的最大值
func max(a ...int) int {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] > ans {
			ans = a[i]
		}
	}
	return ans
}

//sum 可以传入多个 int 变量，求出这些变量的总和，并返回总和。
//你可以使用 ... 运算符打散数组，使得 sum 函数可以求出数组的和。
func sum(a ...int) int {
	ans := 0
	for _, x := range a {
		ans += x
	}
	return ans
}


package main

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

var ans int

type pair struct{ x, y int64 }

func BFS(n int, x int64) {
	mp := make(map[int64]bool, int(1e3))
	que := make(chan pair, int(1e3))
	m := int64(math.Pow10(n - 1))
	que <- pair{x, 0}
	for {
		if len(que) == 0 {
			break
		}
		p := <-que
		//println(p.x, p.y)
		if _, xx := mp[p.x]; xx {
			continue
		}
		mp[p.x] = true
		if p.x >= m {
			ans = int(p.y)
			return
		}
		a := make([]int, 10)
		tx := p.x
		for tx > 0 {
			a[tx%10] = 1
			tx /= 10
		}
		for i := 2; i < 10; i++ {
			if a[i] == 1 {
				que <- pair{p.x * int64(i), p.y + 1}
			}
		}
	}
}

func Solve() {
	n := ri()
	var x int64
	scan(&x)
	ans = 114514
	BFS(n, x)
	if ans == 114514 {
		ans = -1
	}
	println(ans)
}

func main() {
	T := 1 // 如果是单组样例，请讲 T := 0 改为 T := 1
	in, out = bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	if T == 0 {
		scan(&T)
	}
	for t := 0; t < T; t++ {
		Solve()
	}
	out.Flush()
}

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

// ri 将直接读入并返回一个 int
func ri() (x int) {
	scan(&x)
	return x
}

//rs 将直接读入并返回一个 string
func rs() (s string) {
	scan(&s)
	return s
}

//scan 用法与 fmt.scan() 相似，可以传入多个变量的地址进行读入操作
func scan(a ...interface{}) { Fscan(in, a...) }

//print 用法与 fmt.print() 相似，可以传入多个变量进行输出。注意，这个函数不会换行，多个变量之间有空格
func print(a ...interface{}) { Fprint(out, a...) }

//println 用法与 fmt.println() 相似，可以传入多个变量进行输出。这个函数会换行，多个变量之间有空格
func println(a ...interface{}) { Fprintln(out, a...) }

//min 可以传入多个 int 变量，求出这些变量的最小值
func min(a ...int) int {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] < ans {
			ans = a[i]
		}
	}
	return ans
}

//max 可以传入多个 int 变量，求出这些变量的最大值
func max(a ...int) int {
	ans := a[0]
	for i := 1; i < len(a); i++ {
		if a[i] > ans {
			ans = a[i]
		}
	}
	return ans
}

//sum 可以传入多个 int 变量，求出这些变量的总和，并返回总和。
//你可以使用 ... 运算符打散数组，使得 sum 函数可以求出数组的和。
func sum(a ...int) int {
	ans := 0
	for _, x := range a {
		ans += x
	}
	return ans
}


package main

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

type IO struct {
	in  io.Reader
	out io.Writer
}

func NewIO(in io.Reader, out io.Writer) *IO {
	return &IO{in: bufio.NewReader(in), out: out}
}

func (io *IO) ReadInt() int {
	var res int
	_, _ = fmt.Fscanf(io.in, "%d\n", &res)
	return res
}

func (io *IO) ReadPairInt() (int, int) {
	var a, b int
	_, _ = fmt.Fscanf(io.in, "%d %d\n", &a, &b)
	return a, b
}

func (io *IO) ReadString() string {
	var res string
	_, _ = fmt.Fscanf(io.in, "%s\n", &res)
	return res
}

func (io *IO) ReadIntSlice(n int) []int64 {
	var t int64
	res := make([]int64, 0, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Fscanf(io.in, "%d", &t)
		res = append(res, t)
	}
	_, _ = fmt.Fscanf(io.in, "\n")
	return res
}

func (io *IO) Println(v ...interface{}) {
	_, _ = fmt.Fprintln(io.out, v...)
}

func (io *IO) Print(v ...interface{}) {
	_, _ = fmt.Fprint(io.out, v...)
}

func (io *IO) Printf(format string, v ...interface{}) {
	_, _ = fmt.Fprintf(io.out, format, v...)
}

func (io *IO) PrintIntSlice(s sort.IntSlice) {
	for _, v := range s {
		io.Printf("%d ", v)
	}
}

func (io *IO) PrintlnIntSlice(s sort.IntSlice) {
	io.PrintIntSlice(s)
	io.Printf("\n")
}

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

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

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

type pair struct {
	x, steps int64
}

func main() {
	io := NewIO(os.Stdin, os.Stdout)
	nm := io.ReadIntSlice(2)

	stack := make([]pair, 0)
	stack = append(stack, pair{x: nm[1], steps: 0})
	used := make(map[int64]struct{})

	mn := int64(1e9)
	done := false

	s := 0
	for len(stack) > 0 {
		s++
		//if s%1000000 == 0 {
		//	fmt.Println(stack)
		//}
		//fmt.Println(len(stack), mn)
		last := stack[len(stack)-1]
		//fmt.Println(last.x)
		stack = stack[:len(stack)-1]

		var currentLen int64 = 0
		nums := make([]bool, 10)

		currentX := last.x
		for currentX != 0 {
			num := currentX % 10
			currentX /= 10
			currentLen++
			if !nums[num] {
				nums[num] = true
			}
		}

		//fmt.Println(nums)

		if currentLen == nm[0] {
			done = true
			mn = min(mn, last.steps)
		} else {
			for i := int64(9); i >= 2; i-- {
				if nums[i] {
					next := last.x * i
					//fmt.Println("next", next)
					if next < last.x {
						continue
					}
					if _, ok := used[next]; ok {
						continue
					}
					if last.steps >= nm[0] {
						continue
					}
					stack = append(stack, pair{x: next, steps: last.steps + 1})
				}
			}
		}
	}

	if !done {
		fmt.Println(-1)
	} else {
		fmt.Println(mn)
	}
}


package main

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

type IO struct {
	in  io.Reader
	out io.Writer
}

func NewIO(in io.Reader, out io.Writer) *IO {
	return &IO{in: bufio.NewReader(in), out: out}
}

func (io *IO) ReadInt() int {
	var res int
	_, _ = fmt.Fscanf(io.in, "%d\n", &res)
	return res
}

func (io *IO) ReadPairInt() (int, int) {
	var a, b int
	_, _ = fmt.Fscanf(io.in, "%d %d\n", &a, &b)
	return a, b
}

func (io *IO) ReadString() string {
	var res string
	_, _ = fmt.Fscanf(io.in, "%s\n", &res)
	return res
}

func (io *IO) ReadIntSlice(n int) []int64 {
	var t int64
	res := make([]int64, 0, n)
	for i := 0; i < n; i++ {
		_, _ = fmt.Fscanf(io.in, "%d", &t)
		res = append(res, t)
	}
	_, _ = fmt.Fscanf(io.in, "\n")
	return res
}

func (io *IO) Println(v ...interface{}) {
	_, _ = fmt.Fprintln(io.out, v...)
}

func (io *IO) Print(v ...interface{}) {
	_, _ = fmt.Fprint(io.out, v...)
}

func (io *IO) Printf(format string, v ...interface{}) {
	_, _ = fmt.Fprintf(io.out, format, v...)
}

func (io *IO) PrintIntSlice(s sort.IntSlice) {
	for _, v := range s {
		io.Printf("%d ", v)
	}
}

func (io *IO) PrintlnIntSlice(s sort.IntSlice) {
	io.PrintIntSlice(s)
	io.Printf("\n")
}

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

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

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

type pair struct {
	x, steps int64
}

func main() {
	io := NewIO(os.Stdin, os.Stdout)
	nm := io.ReadIntSlice(2)

	stack := make([]pair, 0)
	stack = append(stack, pair{x: nm[1], steps: 0})
	used := make(map[int64]struct{})

	mn := int64(1e9)
	done := false

	s := 0
	for len(stack) > 0 {
		s++
		//if s%1000000 == 0 {
		//	fmt.Println(stack)
		//}
		//fmt.Println(len(stack), mn)
		last := stack[len(stack)-1]
		//fmt.Println(last.x)
		stack = stack[:len(stack)-1]

		var currentLen int64 = 0
		nums := make([]bool, 10)

		currentX := last.x
		for currentX != 0 {
			num := currentX % 10
			currentX /= 10
			currentLen++
			if !nums[num] {
				nums[num] = true
			}
		}

		//fmt.Println(nums)

		if currentLen == nm[0] {
			done = true
			mn = min(mn, last.steps)
		} else {
			for i := int64(9); i >= 2; i-- {
				if nums[i] {
					next := last.x * i
					//fmt.Println("next", next)
					if next < last.x {
						continue
					}
					if _, ok := used[next]; ok {
						continue
					}
					if last.steps >= nm[0]+5 {
						continue
					}
					stack = append(stack, pair{x: next, steps: last.steps + 1})
				}
			}
		}
	}

	if !done {
		fmt.Println(-1)
	} else {
		fmt.Println(mn)
	}
}


package main

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

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

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

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

	var p1, t1, p2, t2, h, s int
	fmt.Fscan(r, &p1, &t1, &p2, &t2, &h, &s)

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

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


package main
import (
	"bufio"
	. "fmt"
	"io"
	"os"
	//. "strconv" Itoa
)
func max(i int64, j int64) int64 {
	if (i > j) {
		return i;
	} else {
		return j;
	}
}
func min(i int64, j int64) int64 {
	if (i < j) {
		return i;
	} else {
		return j;
	}
}
const (
	INF64 = int64(1e18)
)
func solve(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)

	defer out.Flush()

	p := [2]int64{}
	t := [2]int64{}
	Fscan(in, &p[0], &t[0], &p[1], &t[1])

	var h, s int64
	Fscan(in, &h, &s)

	dp := make([]int64, h+1)
	for i := range dp {
		dp[i] = INF64
	}
	dp[0] = 0
	ans := INF64

	for i := int64(0); i <= h; i++ {
		for j := int64(1); j <= h - i; j++ {
			for k := 0; k < 2; k++ {
				ni := min(h, i + j*(p[k]-s) + j*t[k]/t[k^1]*(p[k^1]-s))
				if ni == h {
					ans = min(ans, dp[i] + j*t[k])
				}
				if j*t[k] >= t[k^1] {
					ni = min(h, i + (j-1)*(p[k]-s) + (j-1)*t[k]/t[k^1]*(p[k^1]-s) + (p[0]+p[1]-s))
					dp[ni] = min(dp[ni], dp[i] + j*t[k])
				}
			}
		}
	}
	ans = min(ans, dp[h])
	Fprintln(out, ans)
}
func main() { solve(os.Stdin, os.Stdout) }


// You can edit this code!
// Click here and start typing.
package main

import "fmt"

func main() {
	var t, x int
	var a [3]int
	var solve bool
	fmt.Scanf("%d\n", &t)
	for t-1 > 0 {
		solve = true
		fmt.Scanf("%d\n", &x)
		fmt.Scanf("%d %d %d\n", &a[0], &a[1], &a[2])
		if a[0] != 1 && a[1] != 1 && a[2] != 1 {
			if a[0] == 0 || a[0] == 1 || a[a[0]-1] != 6-1-a[0] {
				solve = false
			}
		} else if a[0] != 2 && a[1] != 2 && a[2] != 2 {
			if a[1] == 0 || a[1] == 2 || a[a[1]-1] != 6-2-a[1] {
				solve = false
			}
		} else {
			if a[2] == 0 || a[2] == 3 || a[a[2]-1] != 6-3-a[2] {
				solve = false
			}
		}
		if solve {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}

	}
}


// You can edit this code!
// Click here and start typing.
package main

import "fmt"

func main() {
	var t, x int
	var a [3]int
	var solve bool
	fmt.Scanf("%d\n", &t)
	for t-1 > 0 {
		solve = true
		fmt.Scanf("%d\n", &x)
		fmt.Scanf("%d %d %d\n", &a[0], &a[1], &a[2])
		if a[0] != 1 && a[1] != 1 && a[2] != 1 {
			if a[0] == 0 || a[0] == 1 || a[a[0]-1] != 6-1-a[0] {
				solve = false
			}
		} else if a[0] != 2 && a[1] != 2 && a[2] != 2 {
			if a[1] == 0 || a[1] == 2 || a[a[1]-1] != 6-2-a[1] {
				solve = false
			}
		} else {
			if a[2] == 0 || a[2] == 3 || a[a[2]-1] != 6-3-a[2] {
				solve = false
			}
		}
		if solve {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		t-=1
	}
}


package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t, x   int
	a      []int
)

func solve(x int, a []int) string {
	if a[x-1] == 0 {
		return "NO"
	}
	var nextKey = a[x-1]
	if a[nextKey-1] == 0 || a[nextKey-1] == x-1 {
		return "NO"
	}
	return "YES"
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		fmt.Fscan(reader, &x)
		a = make([]int, 3)
		for i := 0; i < 3; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(x, a))
	}
}


package main

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

var x int

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in, &t)
// 	fmt.Fprintln(out, t)
	for t > 0 {
		var x int
		fmt.Fscan(in, &x)
// 		fmt.Fprintln(out, x)
		nums := make([]int, 3)
		for i := 0; i < 3; i++ {
			fmt.Fscan(in, &nums[i])
		}
		mark := make([]bool, 4)
		for x != 0 {
			mark[x] = true
			x := nums[x-1]
			if x == 0 {
				break
			}
		}
		if mark[1] && mark[2] && mark[3] {
			fmt.Fprintln(out, "YES")
		} else {
			fmt.Fprintln(out, "NO")
		}

		t--
	}
}


package main

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

func (in *B) run() {
	T := in.nextInt()
	for t := 0; t < T; t++ {
		x := float64(in.nextInt())
		a := math.Sqrt(x)
		b := math.Cbrt(x)
		c := math.Cbrt(a)
		fmt.Println(int32(a + b - c))
	}
}

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

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

func (in *B) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

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

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

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

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

func main() {
	file, err := os.Open("input.txt")
	var F *bufio.Reader
	if err == nil {
		F = bufio.NewReader(file)
		os.Stdin = file
	} else {
		F = bufio.NewReader(os.Stdin)
	}
	defer func(file *os.File) {
		_ = file.Close()
	}(file)
	NewB(F).run()
}


package main
import(
    "fmt"
    "math"
    "bufio"
    "os"
)
func main() {
	var t int
	var in = bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var x int
		fmt.Fscan(in,&x)
		var list []int
		for j:=1;j<=int(math.Sqrt(float64(x)));j++{
			if j*j*j <= x {
				list= append(list,j*j*j)
			}
			if j*j <= x {
				tally:=0
				for k:=0;k<len(list);k++{
					if list[k] == j*j {
						tally++
					}
				}
				if tally == 0 {
					list= append(list,j*j)
				}
			}
		}
		fmt.Println(len(list))
	}
}


package main

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

func main() {
	reader := bReader(os.Stdin)
	writer := bWriter(os.Stdout)

	t := readInt(reader)

	for t > 0 {
		n := readInt(reader)
		ans := int(math.Pow(float64(n), 1.0/2)) + int(math.Pow(float64(n+1), 1.0/3)) - int(math.Pow(float64(n), 1.0/6))
		fmt.Fprintln(writer, ans)

		t--
	}

	writer.Flush()
}

func bReader(stdin *os.File) *bufio.Reader {
	return bufio.NewReaderSize(stdin, 16*1024*1024)
}

func bWriter(stdout *os.File) *bufio.Writer {
	return bufio.NewWriterSize(stdout, 16*1024*1024)
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

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

func readInt(reader *bufio.Reader) int {
	return int(readInt64(reader))
}

func readInt64(reader *bufio.Reader) int64 {
	value, err := strconv.ParseInt(readLine(reader), 10, 64)
	checkError(err)

	return value
}

func readString(reader *bufio.Reader) string {
	return readLine(reader)
}

func readArrayString(reader *bufio.Reader) []string {
	return strings.Split(strings.TrimSpace(readLine(reader)), " ")
}

func readArrayInt(reader *bufio.Reader) []int {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := int(arItemTemp)
		ar = append(ar, arItem)
	}

	return ar
}

func readArrayInt64(reader *bufio.Reader) []int64 {
	arTemp := strings.Split(strings.TrimSpace(readLine(reader)), " ")
	n := len(arTemp)

	var ar []int64

	for i := 0; i < n; i++ {
		arItemTemp, err := strconv.ParseInt(arTemp[i], 10, 64)
		checkError(err)
		arItem := arItemTemp
		ar = append(ar, arItem)
	}

	return ar
}

func readTwoInt(reader *bufio.Reader) (int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1]
}

func readTwoInt64(reader *bufio.Reader) (int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1]
}

func readThreeInt(reader *bufio.Reader) (int, int, int) {
	ar := readArrayInt(reader)
	return ar[0], ar[1], ar[2]
}

func readThreeInt64(reader *bufio.Reader) (int64, int64, int64) {
	ar := readArrayInt64(reader)
	return ar[0], ar[1], ar[2]
}

func gcd(x int64, y int64) int64 {
	for y > 0 {
		x, y = y, x % y
	}

	return x
}

func lcm(x int64, y int64) int64 {
	return x*y/gcd(x,y)
}


package main

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

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

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

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

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

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

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

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

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


package main

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

func countDominoes(n, m int) int {
	if n < 2 {
		return m - 1
	}

	if m < 2 {
		return n - 1
	}

	return n * (m - 1)
}

// RunforDominoes ...
// https://codeforces.com/problemset/problem/1725/A
func RunforDominoes() {
	buf := bufio.NewReader(os.Stdin)
	line, _, err := buf.ReadLine()
	if err != nil {
		fmt.Println(err)
		return
	}

	p := bytes.IndexByte(line, ' ')

	n, _ := strconv.Atoi(string(line)[:p])
	m, _ := strconv.Atoi(string(line)[p+1:])

	fmt.Println(countDominoes(n, m))
}


package main

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

func countDominoes(n, m int) int {
	if n < 2 {
		return m
	}

	if m < 2 {
		return n
	}

	return n * (m - 1)
}

// RunforDominoes ...
// https://codeforces.com/problemset/problem/1725/A
func main() {
	buf := bufio.NewReader(os.Stdin)
	line, _, err := buf.ReadLine()
	if err != nil {
		fmt.Println(err)
		return
	}

	p := bytes.IndexByte(line, ' ')

	n, _ := strconv.Atoi(string(line)[:p])
	m, _ := strconv.Atoi(string(line)[p+1:])

	fmt.Println(countDominoes(n, m))
}


package main

import (
	"fmt"
)

func main() {

	var row int
	var col int

	fmt.Scanln(&row)
	fmt.Scanln(&col)

	m := make([][]int, row)
	for i:=0; i<row; i++ {
		m[i] = make([]int, col)
	}

	for i:=0; i<row; i++ {
		for j:=0; j<col; j++ {
			m[i][j] = i*col+j+1
		}
	}

	count := 0

	for i:=0; i<row; i++ {
		for j:=1; j<col; j++ {
			if m[i][j] - m[i][j-1] == 1 {
				count++
			}
		}
	}

	if row >= 1 {

		for i:=0; i<row-1; i++ {
			for j:=0; j<col; j++ {
				if m[i+1][j] - m[i][j] == 1 {
					count++
				}
			}
		}
	}

	fmt.Println(count)

}


package main

import (
	"fmt"
)

func main() {

	var row int
	var col int

	fmt.Scanln(&row, &col)

	m := make([][]int, row)
	for i:=0; i<row; i++ {
		m[i] = make([]int, col)
	}

	for i:=0; i<row; i++ {
		for j:=0; j<col; j++ {
			m[i][j] = i*col+j+1
		}
	}

	count := 0

	for i:=0; i<row; i++ {
		for j:=1; j<col; j++ {
			if m[i][j] - m[i][j-1] == 1 {
				count++
			}
		}
	}

	if row >= 1 {

		for i:=0; i<row-1; i++ {
			for j:=0; j<col; j++ {
				if m[i+1][j] - m[i][j] == 1 {
					count++
				}
			}
		}
	}

	fmt.Println(count)

}


package main

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

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

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

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

func do(n, k int) int64 {
	if k == 0 {
		return 1
	}
	tk := getTk(n, k)
	gr, eq := getGrEq(n)
	r := gr + eq
	for i := 2; i <= k; i++ {
		r = (((eq * r) % mod) + ((gr * tk[i-1]) % mod)) % mod
	}
	return r
}

const mod = 1e9 + 7

func getTn(n int) []int64 {
	tn := make([]int64, n+1)
	tn[0] = 1
	for i := 1; i <= n; i++ {
		tn[i] = (tn[i-1] * 2) % mod
	}
	return tn
}

func getTk(n, k int) []int64 {
	tk := make([]int64, k+1)
	tk[0] = 1
	tn := getTn(n)
	for i := 1; i <= k; i++ {
		tk[i] = (tk[i-1] * tn[n]) % mod
	}
	for i := 1; i <= k; i++ {
		tk[i] = (tk[i] + tk[i-1]) % mod
	}
	return tk
}

func getGrEq(n int) (int64, int64) {
	if n == 1 {
		return 0, 1
	}
	if n == 2 {
		return 1, 1
	}
	tn := getTn(n)
	var gr, eq int64 = 0, tn[n-1]
	if n%2 == 0 {
		gr = 1
	} else {
		eq = (eq + 1) % mod
	}
	return gr, eq
}


import(
	"fmt"
)

func main() {
	var t int
	_, err := fmt.Scan(&t)
	if err != nil {
		panic(err)
	}

	for i := 0; t > i; i++ {
		var a []int
		for j := 0; 2 > j ; j++ {
			var v1 int
			var v2 int
			_, err := fmt.Scanf("%d %d", &v1, &v2)
			if err != nil {
				panic(err)
			}
			a = append(a, v1, v2)
		}

		if a[0] + a[1] + a[2] + a[3] == 4 {
			fmt.Println("2")
		} else if a[0] + a[1] + a[2] + a[3] == 0 {
			fmt.Println("0")
		} else {
			fmt.Println("1")
		}
	}

}


package main

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

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

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

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

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

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

/**
Run solve the problem CF1701A
Date: 17/07/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1701/A
Problem: CF1701A
**/
func (in *CF1701A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		a := in.NextString()+" "+in.NextString()
		b := in.NextString()+" "+in.NextString()

		ans := 0
		if a == "0 0" && b == "0 0" {
			ans = 0
		}else if a == "0 1" && b == "0 1" {
			ans = 1
		}else if a == "1 0" && b == "0 1" {
			ans = 1
		} else if a == "0 1" && b == "1 0" {
			ans = 1
		}else if a == "1 0" && b == "1 0" {
			ans = 1
		}else if a == "1 1" && b == "1 1" {
			ans = 2
		}
		fmt.Println(ans)
	}
}

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

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


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

                            Online Go Lang Compiler.
                Code, Compile, Run and Debug Go Lang program online.
Write your code in this editor and press "Run" button to execute it.

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

package main
import "fmt"

func main() {
    var testCase int;
    fmt.Scanf("%d ", &testCase);
    for testCase > 0 {
        v := 0
        for i:=0; i<4; i++ {
            var x int
            fmt.Scanf("%d ", &x)
            v += x
        }
        if (v == 0) {
            fmt.Println(0);
        } else if (v == 1 || v == 3) {
            fmt.Println(1);
        } else {
            fmt.Println(2);
        }
        testCase--;
    }

}


package main

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

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

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

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

func _int() int {
	s := _string()
	i := 0
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int(r - '0')
	}
	return i
}

func _int64() int64 {
	s := _string()
	i := int64(0)
	if s[0] == '-' {
		for _, r := range s[1:] {
			i *= 10
			i -= int64(r - '0')
		}
		return i
	}
	for _, r := range s {
		i *= 10
		i += int64(r - '0')
	}
	return i
}

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

func main() {
	defer writer.Flush()
	for t := _int(); t > 0; t-- {
		n := _int()
		m := _int()
		k := _int()
		ans := sol(n, m, k)
		if ans {
			printf("YES\n")
		} else {
			printf("NO\n")
		}
	}
}

func sol(n, m, k int) bool {
	if m&1 == 0 && n&1 == 0 {
		return k&1 == 0
	}
	if m&1 == 1 && n&1 == 0 {
		if k*2 > (m-1)*n { // cannot fit horizontally
			return false
		}
		return k&1 == 0
	}
	if n&1 == 1 && m&1 == 0 {
		return (k*2)%m == 0 && ((k*2)/m)&1 == 1
	}
	// shouldn't reach here
	return false
}


package main

import (
	"bufio"
	. "fmt"
	"os"
	// "strings"
	// "container/heap"
	// "bytes"
	// "math"
	// "strconv"
)

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

var n,m int
var k int
var turn int
const MOD int64 = 1e9 + 7
var s,t string
func solve(){
	Fscan(r,&n,&m,&k)
	if n%2==0 && m%2==0{
		if k%2==0{
			Fprint("YES\n")
		}else{
			Fprint("NO\n")
		}
	}else if n%2==1 && m%2==0{
		if (k-m/2)%2==0{
			Fprint("YES\n")
		}else{
			Fprint("NO\n")
		}
	}else if n%2==0 && m%2==1{
		if (k-n/2)%2==0{
			Fprint("YES\n")
		}else{
			Fprint("NO\n")
		}
	}else{
		Fprint("NO\n")
	}

	return
}

func main(){
	defer w.Flush()
	// Fscan(r,&n,&m)
	// Fscan(r,&n)
	Fscan(r,&turn)
	// Fscan(r,&s)
	// Fscan(r,&k)

	for i:=0;i<turn;i++{
	    solve()
	}

	// solve()
}

/* ===========================PART 1: Math Func ============================  */
func max(x, y int64) int64 {if x > y {return x};return y}
func abs(x int64) int64 {if x > 0 {return x};return -x}
func min(x, y int64) int64 {if x < y {return x};return y}
func memset(a []int, v int) {
    if len(a) == 0 {return}
    a[0] = v
    for bp := 1; bp < len(a); bp *= 2 {
        copy(a[bp:], a[:bp])
    }
}

/* ===========================PART 2: Heap func ============================  */
// type hp struct{ sort.IntSlice }
// func (h hp) Less(i, j int) bool  { return h.IntSlice[i] > h.IntSlice[j] }
// func (h *hp) Push(v interface{}) { h.IntSlice = append(h.IntSlice, v.(int)) }
// func (h *hp) Pop() interface{}   { a := h.IntSlice; v := a[len(a)-1]; h.IntSlice = a[:len(a)-1]; return v }

// /* ===========================PART 3: String func ============================  */
// func reverse(a []byte){
// 	for i,n :=0,len(a);i<n/2;i++{
// 		a[i],a[n-1-i]=a[n-1-i],a[i]
// 	}
// }

// /* ===========================PART 4: Array func ============================  */
// func reverse(a []int){
// 	for i,n :=0,len(a);i<n/2;i++{
// 		a[i],a[n-1-i]=a[n-1-i],a[i]
// 	}
// }

// /* ===========================PART 5: Hash func ============================  */
// func containKey(m map[int]int, key int) bool {
// 	if _, ok := m[key]; ok {
// 		return true
// 	}
// 	return false
// }


package main

import (
	"bufio"
	. "fmt"
	"os"
	// "strings"
	// "container/heap"
	// "bytes"
	// "math"
	// "strconv"
)

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

var n,m int
var k int
var turn int
const MOD int64 = 1e9 + 7
var s,t string
func solve(){
	Fscan(r,&n,&m,&k)
	if n%2==0 && m%2==0{
		if k%2==0{
			Fprint(w,"YES\n")
		}else{
			Fprint(w,"NO\n")
		}
	}else if n%2==1 && m%2==0{
		if (k-m/2)%2==0{
			Fprint(w,"YES\n")
		}else{
			Fprint(w,"NO\n")
		}
	}else if n%2==0 && m%2==1{
		if (k-n/2)%2==0{
			Fprint(w,"YES\n")
		}else{
			Fprint(w,"NO\n")
		}
	}else{
		Fprint(w,"NO\n")
	}

	return
}

func main(){
	defer w.Flush()
	// Fscan(r,&n,&m)
	// Fscan(r,&n)
	Fscan(r,&turn)
	// Fscan(r,&s)
	// Fscan(r,&k)

	for i:=0;i<turn;i++{
	    solve()
	}

	// solve()
}

/* ===========================PART 1: Math Func ============================  */
func max(x, y int64) int64 {if x > y {return x};return y}
func abs(x int64) int64 {if x > 0 {return x};return -x}
func min(x, y int64) int64 {if x < y {return x};return y}
func memset(a []int, v int) {
    if len(a) == 0 {return}
    a[0] = v
    for bp := 1; bp < len(a); bp *= 2 {
        copy(a[bp:], a[:bp])
    }
}

/* ===========================PART 2: Heap func ============================  */
// type hp struct{ sort.IntSlice }
// func (h hp) Less(i, j int) bool  { return h.IntSlice[i] > h.IntSlice[j] }
// func (h *hp) Push(v interface{}) { h.IntSlice = append(h.IntSlice, v.(int)) }
// func (h *hp) Pop() interface{}   { a := h.IntSlice; v := a[len(a)-1]; h.IntSlice = a[:len(a)-1]; return v }

// /* ===========================PART 3: String func ============================  */
// func reverse(a []byte){
// 	for i,n :=0,len(a);i<n/2;i++{
// 		a[i],a[n-1-i]=a[n-1-i],a[i]
// 	}
// }

// /* ===========================PART 4: Array func ============================  */
// func reverse(a []int){
// 	for i,n :=0,len(a);i<n/2;i++{
// 		a[i],a[n-1-i]=a[n-1-i],a[i]
// 	}
// }

// /* ===========================PART 5: Hash func ============================  */
// func containKey(m map[int]int, key int) bool {
// 	if _, ok := m[key]; ok {
// 		return true
// 	}
// 	return false
// }


package main

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

// var m []int
// err = json.Unmarshal([]byte(r.FormValue("example")), &m)

// for i := 0; i < len(m); i++ {
// 	fmt.Println(m[i])
// }

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

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

func MKO(x, y int64) int64 {
	if x < y {
		return 0
	} else {
		return x - y + 1
	}
}

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

func LCM(x, y int) int {
	if x >= y {
		initial := x
		for i := 1; i < y+2; i++ {
			if initial%y == 0 {
				break
			} else {
				initial = initial + x
			}

		}
		return initial
	} else {
		initial := y
		for i := 1; i < x+2; i++ {
			if initial%x == 0 {
				break
			} else {
				initial = initial + y
			}

		}
		return initial
	}
}

func GCD(x, y int64) int64 {
	var l, q int64
	l = MAX(x, y)
	q = MIN(x, y)
	var m int64
	for l*q > 0 {
		a := l % q
		b := l - a
		cc := int64(b / q)
		remain := l - cc*q
		l = MAX(remain, q)
		q = MIN(remain, q)
		if l*q == 0 {
			m = l + q
			break
		}

	}
	return m
}

func IsItPrime(x int) bool {
	if x < 10 {
		if x == 2 || x == 3 || x == 5 || x == 7 {
			return true
		} else {
			return false
		}
	} else {
		j := 0
		k := math.Sqrt(float64(x))
		for m := 3; m <= int(k); {
			if x%m == 0 {
				j = 1
				break
			}
			m = m + 2
		}
		if j == 1 {
			return false
		} else {
			return true
		}
	}
}

func PrimeFactorization(n int) (pfs map[int]int) {
	pfs = make(map[int]int)

	// Get the number of 2s that divide n
	for n%2 == 0 {
		if _, ok := pfs[2]; ok {
			pfs[2] += 1
		} else {
			pfs[2] = 1
		}
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			if _, ok := pfs[i]; ok {
				pfs[i] += 1
			} else {
				pfs[i] = 1
			}
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs[n] = 1
	}

	return
}

func NumberOfDivisors(n int) int {
	pfs := PrimeFactorization(n)

	num := 1
	for _, exponents := range pfs {
		num *= (exponents + 1)
	}

	return num
}

func KthPrime(x int) (y int) {
	if x == 1 {
		y = 2
	}
	if x == 2 {
		y = 3
	}
	if x > 2 {
		var sum int = 2
		begin := 5
		for sum < x+1 {
			if IsItPrime(begin) == true {
				sum++
			}
			if sum == x {
				y = begin
				break
			} else {
				if begin%6 == 1 {
					begin = begin + 4
				} else {
					begin = begin + 2
				}
			}
		}
	}
	return
}

func MODULE(x, y int) int {
	if x > y {
		return x - y
	} else {
		return y - x
	}
}

var t int

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &t)

	for o := 0; o < t; o++ {
		var n, m, k int
		fmt.Fscan(input, &n, &m, &k)

		if m%2 == 0 {
			ll := int(n*m/2) - k
			if ll%2 == 1 {
				fmt.Println("NO")
			} else {
				if n%2 == 1 {
					if k >= int(m/2) {
						fmt.Println("YES")
					} else {
						fmt.Println("NO")
					}
				} else {
					fmt.Println("YES")
				}
			}
		} else {
			oo := int(n*(m-1)/2) - k
			if oo%2 == 1 {
				fmt.Println("NO")
			} else {
				if k <= n*(m-1) {
					fmt.Println("YES")
				} else {
					fmt.Println("NO")
				}
			}
		}

	}

}


package main

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

var (
	in = bufio.NewReader(os.Stdin)
	dp []int64
)

func main() {
	var test int = 1
	//fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}

}

func init() {
	dp = make([]int64, 50)
}

func solve() {
	var n, internalm int64
	fmt.Fscan(in, &n)
	fmt.Fscan(in, &internalm)
	solve2(n, 0)
	fmt.Println(dp[n] % internalm)

}

func solve2(n int64, tempCount int64) int64 {
	if n < 1 {
		return 0
	}
	if n == 1 {
		return 1
	}
	if dp[n] != 0 {
		return dp[n]
	}
	var currentAns int64
	for i := 1; i < int(n); i++ {
		currentAns += solve2(n-int64(i), tempCount+1)
	}
	for i := 2; i <= int(n); i++ {
		currentAns += solve2(int64(math.Floor(float64(n/int64(i)))), tempCount+1)
	}
	dp[n] = currentAns
	return currentAns
}

//x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-TEMPLATE_STARTING-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-

type pair struct {
	a int64
	b int64
}

func sortPair(pairs []pair) {
	sort.Slice(pairs, func(i, j int) bool {
		return pairs[i].a < pairs[j].a
	})
}
func min(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func printArray(arr []int) {
	for i := 1; i < len(arr); i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

type runeSort []rune

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


package main

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

var (
	in = bufio.NewReader(os.Stdin)
	dp []int64
)

func main() {
	var test int = 1
	//fmt.Fscan(in, &test)
	for i := 0; i < test; i++ {
		solve()
	}

}

func init() {
	dp = make([]int64, 1000000)
}

func solve() {
	var n, internalm int64
	fmt.Fscan(in, &n)
	fmt.Fscan(in, &internalm)
	solve2(n, 0)
	fmt.Println(dp[n] % internalm)

}

func solve2(n int64, tempCount int64) int64 {
	if n < 1 {
		return 0
	}
	if n == 1 {
		return 1
	}
	if dp[n] != 0 {
		return dp[n]
	}
	var currentAns int64
	for i := 1; i < int(n); i++ {
		currentAns += solve2(n-int64(i), tempCount+1)
	}
	for i := 2; i <= int(n); i++ {
		currentAns += solve2(int64(math.Floor(float64(n/int64(i)))), tempCount+1)
	}
	dp[n] = currentAns
	return currentAns
}

//x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-TEMPLATE_STARTING-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-

type pair struct {
	a int64
	b int64
}

func sortPair(pairs []pair) {
	sort.Slice(pairs, func(i, j int) bool {
		return pairs[i].a < pairs[j].a
	})
}
func min(a int64, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func printArray(arr []int) {
	for i := 1; i < len(arr); i++ {
		fmt.Print(arr[i], " ")
	}
	fmt.Println()
}

type runeSort []rune

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


package main

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

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

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

func rw(r io.Reader, w io.Writer) {
	var n int
	var m int64
	fmt.Fscan(r, &n, &m)
	w1 := do(n, m)
	fmt.Fprintln(w, w1)
}

func do(n int, m int64) int64 {
	d := make([]int64, n+1)
	d[n] = 1
	for i := n; i >= 1; i-- {
		for j := 1; j < i; j++ {
			d[i-j] = (d[i-j] + d[i]) % m
		}
		for j := n; j >= 2; j-- {
			d[i/j] = (d[i/j] + d[i]) % m
		}
	}
	return d[1]
}