package main

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

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

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 := getI64()
  x := n
  result := int64(1)
  for a := int64(2); a * a <= x; a++ {
    if x % a != 0 {
      continue
    }
    result *= a
    for x % a == 0 {
      x /= a
    }
    //fmt.Printf("%d ", a)
  }
  result *= x
  //fmt.Printf("%d\n", x)
  writer.WriteString(fmt.Sprintf("%d\n", result))
}


package main

import "fmt"

func main() {
    //This problem can be done easily using gcd, but I am lazy
    var m, n, z int
    fmt.Scan(&m, &n, &z)
    cnt := 0
    for i:=1; i<=z; i++ {
        if i % m == 0 && i % n == 0 {
            cnt++
        }
    }
    fmt.Print(cnt)
}


package main

import (
	"fmt"
)

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

	kill := 0
	for i := m; i <= z; i += m {
		if i%n == 0 {
			kill++
		}
	}

	fmt.Println(kill)
}


package main

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

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

    return a
}

func getLine(s *bufio.Scanner) (int,int,int) {
    s.Scan()
    ab := strings.Fields(s.Text())
    a, _ := strconv.Atoi(ab[0])
    b, _ := strconv.Atoi(ab[1])
    c, _ := strconv.Atoi(ab[2])

    return a,b,c
}

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    n, m, z:= getLine(scanner)
    fmt.Println(z * GCD(n,m) / (n*m))
}


package main

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

func main() {
	sc := NewScanner()
	N, x := sc.NextInt(), sc.NextInt()
	n := N
	if x == 1 {
	} else {
		if x == 2 {
			if N%2 == 1 {
				N--
			}
		} else {
			if N%2 == 0 {
				N--
			}
		}
	}
	n = N % 6

	for i := n; i > 0; i-- {
		if i%2 == 1 {
			if x == 1 {
				x = 0
			} else if x == 0 {
				x = 1
			}
		} else {
			if x == 1 {
				x = 2
			} else if x == 2 {
				x = 1
			}
		}
	}
	fmt.Println(x)

}

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() {
	situations := map[int][]int{
		0: []int{0, 1, 2},
		1: []int{1, 0, 2},
		2: []int{1, 2, 0},
		3: []int{2, 1, 0},
		4: []int{2, 0, 1},
		5: []int{0, 2, 1},
	}

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

	fmt.Println(situations[n][x])
}


package main

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

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

	has := make([]bool, 3)
	has[X] = true

	for i := N % 12; i > 0; i-- {
		if i % 2 == 0 {
			has[1], has[2] = has[2], has[1]
		} else {
			has[0], has[1] = has[1], has[0]
		}
	}

	for i := 0; ; i++ {
		if has[i] {
			io.Println(i)
			return
		}
	}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	m := make(map[string]int)
	for i:= 0; i < n; i++{
		fmt.Scan(&s)
		m[s] = m[s] + 1
	}
	result := 0
	for _, value := range m{
		if value > result{
			result = value
		}
	}
	fmt.Println(result)
}


package main

import (
	"fmt"
)

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

	max := 0
	coins := make(map[int]int)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		coins[a]++
		if coins[a] > max {
			max = coins[a]
		}
	}

	fmt.Println(max)
}


package main

import ("fmt";
		"sort")

func main() {
	n := nextInt()
	a := make([]int, 101)
	for i := 0; i < n; i++{
		a[nextInt()]+=1
	}
	sort.Ints(a)
	sout(a[100])
}

func next() string{
	var ss string
	fmt.Scan(&ss)
	return ss
}
func nextInt() int{
	var ss int;
	fmt.Scan(&ss)
	return ss
}
func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k, " ")
	}
	fmt.Println()
}


package main

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

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

	var a,b,c,d int64
	fmt.Fscanf(buf, "%d %d %d %d\n", &a,&b,&c,&d)

	fmt.Printf("%d\n",4+2*(a+b+d))

}


package main

import(
	"fmt"
	"math"
)

func main(){
	var w1,h1,w2,h2 int
	fmt.Scan(&w1,&h1,&w2,&h2)
	res := (w1+2)*(h1+1)+(w2+2)*(h2+1)+int(math.Abs(float64(w1-w2)))-w1*h1-w2*h2
	fmt.Printf("%v\n",res)
}


package main

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

func strToInt(s string) uint64 {
	result, err := strconv.ParseUint(s, 10, 32)

	if err != nil {
		fmt.Printf("%s", err.Error())
		os.Exit(1)
	}

	return result
}

func parseInts(s string) (w1, h1, w2, h2 uint64) {
	for i, f := range strings.Fields(s) {
		switch i {
		case 0:
			w1 = strToInt(f)
		case 1:
			h1 = strToInt(f)
		case 2:
			w2 = strToInt(f)
		case 3:
			h2 = strToInt(f)
		}
	}

	return
}

func main() {
	var w1,h1,w2,h2 uint64
	scanner := bufio.NewScanner(os.Stdin)
	if scanner.Scan() {
		w1, h1, w2, h2 = parseInts(scanner.Text())
	}
	fmt.Println(1 + w2 + 1 + h2 + h2 + h1 + h1 + w1 - w2 + 1 + w1 + 1)
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	a := make([]int, 3, 3)
	var d, res int
	fmt.Scan(&a[0], &a[1], &a[2], &d)
	sort.Ints(a)
	if d > (a[1] - a[0]) {
		res += d - (a[1] - a[0])
	}
	if d > (a[2] - a[1]) {
		res += d - (a[2] - a[1])
	}
	fmt.Println(res)
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var d, cnt int
	// var st string

	a := make([]int, 3)

	fmt.Scanln(&a[0], &a[1], &a[2], &d)

	sort.Ints(a)
	if a[1]-a[0] < d {
		cnt = d - (a[1] - a[0])
	}
	if a[2]-a[1] < d {
		cnt += d - (a[2] - a[1])
	}

	fmt.Println(cnt)
}


package main

import (
	"fmt"
	"sort"
)

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func main() {
	var arr [3]int
	var d, total int
	fmt.Scanf("%d %d %d %d\n", &arr[0], &arr[1], &arr[2], &d)
	sort.Ints(arr[:])
	total += max(0, d-(arr[1]-arr[0])) + max(0, d-(arr[2]-arr[1]))
	fmt.Println(total)
}


// hello project main.go
package main

import (
	"fmt"
)

func max(num1 int, num2 float32) int {
	var result int
	if num1 > int(num2) {
		result = num1
	} else {
		result = int(num2)
	}
	return result
}

func swap(x string, y string) (string, string) {
	return y, x
}

func main() {
	var n, m int64
	fmt.Scanf("%d %d", &n, &m)
	a := n / 5
	b := m / 5
	c, d := n%5, m%5
	ans := a * b * 5
	ans += a * d
	ans += b * c
	//	fmt.Println(ans)
	var i, j int
	for i = 1; i <= int(c); i++ {
		for j = 1; j <= int(d); j++ {
			if (i+j)%5 == 0 {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


package main

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

func foo(x, n int) int {
	a := (n + 5 - x) / 5
	if x == 0 {
		a--
	}
	return a
}

func main() {
	n := getInt()
	m := getInt()
	var ans int64
	for i := 0; i < 5; i++ {
		ans += int64(foo(i, n)) * int64(foo(5-i, m))
	}
	fmt.Println(ans)
}

type Input struct {
	*bufio.Scanner
}

var globalInput = wrapStdin()

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

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

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

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

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


package main

import "fmt"

func main() {
  var n, m uint64
  fmt.Scanf("%d %d", &n, &m)
  res1 := [5]uint64{}
  res2 := [5]uint64{}
  for i := range(res1) {
    res1[i] = n / 5
  }
  for i := range(res2) {
    res2[i] = m / 5
  }

  if temp := n % 5; temp != 0 {
    for i := uint64(1); i <= temp; i++ {
      res1[i]++
    }
  }
  if temp := m % 5; temp != 0 {
    for i := uint64(1); i <= temp; i++ {
      res2[i]++
    }
  }

  result := uint64(0)
  for i := 0; i < 5; i++ {
    result += res1[i] * res2[(5 - i) % 5]
  }
  fmt.Println(result)
}


package main

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

type Scanner struct {
  r            io.Reader
  split        bufio.SplitFunc
  maxTokenSize int
  token, buf   []byte
  start, end   int
}

func NewScanner(r io.Reader) *Scanner {
  return &Scanner{
    r:            r,
    split:        bufio.ScanWords,
    maxTokenSize: 16777216,
    buf:          make([]byte, 4096),
  }
}

func (s *Scanner) advance(n int) bool {
  if n < 0 || n > s.end-s.start {
    return false
  }
  s.start += n
  return true
}

func (s *Scanner) Text() string {
  return string(s.token)
}

func (s *Scanner) Scan() bool {
  for {
    if s.end > s.start {
      advance, token, err := s.split(s.buf[s.start:s.end], false)
      if err != nil || !s.advance(advance) {
        return false
      }
      s.token = token
      if token != nil {
        return true
      }
    }
    if s.start > 0 && (s.end == len(s.buf) || s.start > len(s.buf)/2) {
      copy(s.buf, s.buf[s.start:s.end])
      s.end -= s.start
      s.start = 0
    }
    if s.end == len(s.buf) {
      if len(s.buf) >= s.maxTokenSize {
        return false
      }
      newSize := len(s.buf) * 2
      if newSize > s.maxTokenSize {
        newSize = s.maxTokenSize
      }
      newBuf := make([]byte, newSize)
      copy(newBuf, s.buf[s.start:s.end])
      s.buf = newBuf
      s.end -= s.start
      s.start = 0
      continue
    }
    for loop := 0; ; {
      n, _ := s.r.Read(s.buf[s.end:len(s.buf)])
      s.end += n
      if n > 0 {
        break
      }
      loop++
      if loop > 100 {
        break
      }
    }
  }
}

func (s *Scanner) Split(split bufio.SplitFunc) {
  s.split = split
}

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

func next() string { sc.Scan(); return sc.Text() }
func nc() byte     { sc.Scan(); return sc.Text()[0] }

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

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

func pri32(i ...int) {
  for _, ii := range i {
    w.WriteString(strconv.Itoa(ii))
    sp()
  }
}
func pri64(i ...int64) {
  for _, ii := range i {
    w.WriteString(strconv.FormatInt(ii, 10))
    sp()
  }
}
func sp()   { w.WriteByte(' ') }
func endl() { w.WriteByte('\n') }

func main() {
  x, y := make([]int, 8), make([]int, 8)
  for i := 0; i < 8; i++ {
    x[i], y[i] = ni32(), ni32()
  }
  // for i := 0; i < 8; i++ {
  //   for j := i + 1; j < 8; j++ {
  //     if x[j] < x[i] || (x[j] == x[i] && y[j] < y[i]) {
  //       x[i], y[i], x[j], y[j] = x[j], y[j], x[i], y[i]
  //     }
  //   }
  // }
  xx, yy := make([]int, 8), make([]int, 8)
  copy(xx, x)
  copy(yy, y)
  sort.Ints(xx)
  sort.Ints(yy)
  xs, ys := []int{xx[0]}, []int{yy[0]}
  for i := 1; i < 8; i++ {
    if xx[i] != xx[i-1] {
      xs = append(xs, xx[i])
    }
    if yy[i] != yy[i-1] {
      ys = append(ys, yy[i])
    }
  }
  sort.Ints(xs)
  sort.Ints(ys)
  // fmt.Println(xs, ys)
  if len(xs) != 3 || len(ys) != 3 || xs[1] <= xs[0] || xs[2] <= xs[1] || ys[1] <= ys[0] || ys[2] <= ys[1] {
    w.WriteString("ugly\n")
    w.Flush()
    return
  }
  for i := 0; i < 3; i++ {
    for j := 0; j < 3; j++ {
      ug := true
      for k := 0; k < 8; k++ {
        if x[k] == xs[i] && y[k] == ys[j] {
          ug = false
        }
      }
      if ((i != 1 || j != 1) && ug) || (i == 1 && j == 1 && !ug) {
        w.WriteString("ugly\n")
        w.Flush()
        return
      }
    }
  }
  w.WriteString("respectable\n")
  w.Flush()
}


package main

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

var sc = NewMyScanner()

func solve2() bool {
	mx := make(map[int]bool)
	my := make(map[int]bool)
	type pair struct {
		y int
		x int
	}
	mm := make(map[pair]bool)
	for i := 0; i < 8; i++ {
		x := sc.Int()
		y := sc.Int()
		mx[x] = true
		my[y] = true
		mm[pair{y, x}] = true
	}

	if len(mx) != 3 || len(my) != 3 {
		return false
	}

	mid := func(m map[int]bool) int {
		var t [3]int
		i := 0
		for k := range m {
			t[i] = k
			i++
		}
		sort.Ints(t[:])
		return t[1]
	}

	midx := mid(mx)
	midy := mid(my)
	if mm[(pair{midy, midx})] {
		return false
	}

	return len(mm) == 8
}

func solve() string {
	if solve2() {
		return "respectable"
	} else {
		return "ugly"
	}
}

type MyScanner struct {
	*bufio.Scanner
	justScanned bool
}

func NewMyScanner() *MyScanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return &MyScanner{sc, false}
}

func (sc *MyScanner) Has() bool {
	sc.justScanned = true
	return sc.Scan()
}

func (sc *MyScanner) Int() int {
	if !sc.justScanned {
		sc.Scan()
	}
	sc.justScanned = false

	x, _ := strconv.Atoi(sc.Text())
	return x
}

func (sc *MyScanner) Bool() bool {
	if !sc.justScanned {
		sc.Scan()
	}
	sc.justScanned = false

	return sc.Bytes()[0] == byte('1')
}

// sc.justScanned should be false
func (sc *MyScanner) Map2D(r, c int) [][]byte {
	m := make([][]byte, r)
	for y := range m {
		sc.Scan()
		m[y] = append(m[y], sc.Bytes()...)
	}
	return m
}

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


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()

  x := getI()
  if x < 0 {
    x = -x
  }
  jumps := 0
  size, a := 0, 0
  for a < x {
    size++
    a += size
    jumps++
  }
  if a > x {
    for (a-x)%2 == 1 {
      size++
      a += size
      jumps++
    }
  }
  writer.WriteString(fmt.Sprintf("%d\n", jumps))
}


package main

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

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

	var x int
	fmt.Fscanf(reader, "%d", &x);
	if x < 0 {
		x = -x
	}
	sum := 0
	for i := 0;;i ++ {
		sum += i
		if sum >= x && sum % 2 == x % 2 {
			fmt.Printf("%d", i)
			return
		}
	}
}


package main

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

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

	var x, s, i int
	Fscan(in, &x)
	if x < 0 {
		x = -x
	}
	for {
		s += i
		if s >= x && (s-x)&1 == 0 {
			Fprint(out, i)
			return
		}
		i++
	}
}

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


package main

import "fmt"

func main() {
	var n, m, a, b int
	fmt.Scan(&n, &m, &a, &b)

	if b/m >= a {
		fmt.Print(a * n)
	} else if a*(n%m) > b {
		fmt.Print((n + m - 1) / m * b)
	} else {
		fmt.Print(b*(n/m) + a*(n%m))
	}
}


package main
import "fmt"

func main() {
	var (
		n, m, a, b int
		per float32
	)
	fmt.Scanln(&n, &m, &a, &b)
	per = float32(b/m)
	if per >= float32(a) {
		fmt.Println(n*a)
	}else {
		if n%m == 0 {
			fmt.Println(n/m*b)
		}else{
			remain := n%m
			if remain*a >= b {
				fmt.Println((n/m+1)*b)
			}else {
				fmt.Println(remain*a + (n/m)*b)
			}
		}
	}
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	all := scanner.Text()
	var chList []int
	for _, ch := range strings.Split(all, " ") {
		ch, err := strconv.Atoi(ch)
		if err != nil {
			log.Fatal(err)
		}
		chList = append(chList, ch)
	}
	n, m, a, b := chList[0], chList[1], chList[2], chList[3]
	money := 0
	if (b / m) < a {
		if (n%m)*a < b {
			money = (n%m)*a + n/m*b
		} else {
			money = n/m*b + b
		}
	} else {
		money = n * a
	}
	fmt.Println(money)
}


//	URL: http://codeforces.com/contest/911/problem/B
//	PROBLEM RESTATEMENT
//		Cake one has a pieces, cake two has b pieces.
//		Cake must be distributed to n plates s.t:
//			- Each plate contains >= x pieces, x >= 1.
//			- All cake is distributed.
//			- A given plate only has one type of cake pieces.
//		Given a, b, n, what is the maximum x we can achieve?
//	CONSTRAINTS
//		1 <= a, b <= 100; 2 <= n <= a + b
//	APPROACH
//		(1) Let c = # of plates with pieces of cake one.
//			Let n - c = # of plates with pieces of cake two.
//		(2) Assume the problem only had one cake.
//			The answer for one cake is trivially x = a / c.
//		(3) With two cakes, we are trying to maximize x, where x =
//			min(a/c, b/(n - c)), and where c is unknown.
//		(4) In O(n) time, we can iterate through all values of c [1, n) and
//			find the answer.

package main

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

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

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

func solve(n int, a int, b int) int {
	x := 0
	for c := 1; c < n; c += 1 {
		x = max(min(a/c, b/(n-c)), x)
	}
	return x
}

func main() {
	reader, writer := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var n, a, b int
	fmt.Fscanf(reader, "%d %d %d\n", &n, &a, &b)
	fmt.Fprintf(writer, "%d\n", solve(n, a, b))
}


package main

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

func main() {
	stdio := bufio.NewReader(os.Stdin)
	var n, a, b int
	x := 1
	fmt.Fscanf(stdio, "%d %d %d", &n, &a, &b)
	for x <= a && x <= b && (a/x+b/x >= n) {
		x++
	}
	fmt.Println(x - 1)
}


package main

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

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), math.MaxInt32)
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		return []byte(f1())
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

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

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

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

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

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

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

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

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

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

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

func gcd64(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd64(b, a%b)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

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

func main() {
	defer stdout.Flush()
	n := readInt()
	a := readInt()
	b := readInt()

	var ans int
	for i := 1; i < n; i++ {
		j := n - i
		ans = max(ans, min(a/i, b/j))
		ans = max(ans, min(b/i, a/j))
	}
	println(ans)
}

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


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	a, _ := strconv.Atoi(scanner.Text())
	scanner.Scan()
	b, _ := strconv.Atoi(scanner.Text())
	scanner.Scan()
	r, _ := strconv.Atoi(scanner.Text())

	if a >= r*2 && b >= r*2 {
		fmt.Printf("First\n")
	} else {
		fmt.Printf("Second\n")
	}
}


package main

import "fmt"

func main() {
	a, b, r := 0, 0, 0
	fmt.Scanf("%d %d %d\n", &a, &b, &r)
	if a >= r*2 && b >= r*2 {
		fmt.Printf("First\n")
	} else {
		fmt.Printf("Second\n")
	}
}


package main

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

func scanInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	x, _ := strconv.Atoi(scanner.Text())
	return x
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	a, b, r := scanInt(scanner), scanInt(scanner), scanInt(scanner)
	if a >= 2*r && b >= 2*r {
		writer.WriteString("First\n")
	} else {
		writer.WriteString("Second\n")
	}
}


package main

import (
    "fmt"
)

func main() {
    var l, r, ans, a, b int64
    fmt.Scanf("%d %d", &l, &r)
    ans  = 0
    a = 1
    b = 1
    for i := 0; i < 33; i++ {
        b = 1
        for j := 0; j < 24; j++ {
            if a * b > r {
                break
            }
            if (l <= a * b) && (a * b <= r) {
                ans++
            }
            b *= 3
        }
        a *= 2
    }
    fmt.Println(ans)
}


package main

import "fmt"

func main() {
    var afl int64
    var bfa int64
    var lrt int64
    var rgh int64
    var cnt int64
    afl = 1
    bfa = 1
    cnt = 0
	fmt.Scan(&lrt)
	fmt.Scan(&rgh)
	for it := 0; it <= 19; it++ {
	    bfa = 1
	    for jt := 0; jt <= 30; jt ++ {
	        if afl * bfa >= lrt {
	            if afl * bfa <= rgh {
	                cnt = cnt + 1
	            }
	        }
	        bfa = bfa * 2
	    }
	    afl = afl * 3
	}
	fmt.Printf( "%d", cnt )
}


package main
import "fmt"

func main() {
   var l int64
   var r int64
   var cur int64
   var res int64
   fmt.Scan(&l)
   fmt.Scan(&r)
   cur = 1
   for i:= 0; i < 33; i++ {
   	var ocur int64
   	ocur = cur
   	for j := 0; j < 20; j++ {
   		if cur >= l {
   			if cur <= r {
   				res = res + 1
   			}
   		}
   		cur = cur * 3
   	}
   	cur = ocur * 2
   }
   fmt.Printf("%d", res)
}


// A. Another One Bites The Dust
/*
Let's call a string good if and only if it consists of only two types of letters — 'a' and 'b' and every two consecutive letters are distinct. For example "baba" and "aba" are good strings and "abb" is a bad string.

You have 𝑎 strings "a", 𝑏 strings "b" and 𝑐 strings "ab". You want to choose some subset of these strings and concatenate them in any arbitrarily order.

What is the length of the longest good string you can obtain this way?

Input
The first line contains three positive integers 𝑎, 𝑏, 𝑐 (1≤𝑎,𝑏,𝑐≤109) — the number of strings "a", "b" and "ab" respectively.

Output
Print a single number — the maximum possible length of the good string you can obtain.

Examples
Input
1 1 1

Output
4

Input
2 1 2

Output
7

Input
3 5 2

Output
11

Input
2 2 1

Output
6

Input
1000000000 1000000000 1000000000

Output
4000000000

Note
In the first example the optimal string is "baba".

In the second example the optimal string is "abababa".

In the third example the optimal string is "bababababab".

In the fourth example the optimal string is "ababab".
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	arr := strings.Split(strings.TrimSpace(input), " ")
	a, _ := strconv.ParseInt(arr[0], 10, 64)
	b, _ := strconv.ParseInt(arr[1], 10, 64)
	c, _ := strconv.ParseInt(arr[2], 10, 64)

	total := c * 2
	if a > b {
		total += (2 * b) + 1
	} else if a < b {
		total += (2 * a) + 1
	} else {
		total += 2 * a
	}
	fmt.Print(total)
}


package main

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

var reader = bufio.NewReader(os.Stdin)

func main() {
	in := readString()
	parts := strings.Split(in, " ")
	a := Atoi(parts[0])
	b := Atoi(parts[1])
	ab := Atoi(parts[2])

	aabb := Min(a, b)
	res := ab*2 + aabb*2
	if Abs(a-b) != 0 {
		res++
	}
	fmt.Println(res)
}

func readInteger() int64 {
	s, _, _ := reader.ReadLine()
	n, _ := strconv.ParseInt(string(s), 0, 64)
	return n
}

func readString() string {
	s, _, _ := reader.ReadLine()
	return string(s)
}

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

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

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

func Atoi(s string) int64 {
	i, _ := strconv.ParseInt(s, 10, 64)
	return i
}


package main

import (
	"fmt"
)

func queen(x int64, y int64, z int64) int64 {
	res := z * 2
	if x == y {
		res += x * 2
		return res
	} else if x > y {
		res += y * 2 + 1
		return res
	} else {
		res += x * 2 + 1
		return res
	}
}

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


package main

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

// Node to store in queue
type Node struct {
	value int64
	prev  *Node
}

// NewNode to create node with value is n.
func NewNode(n int64) *Node {
	return &Node{
		value: n,
	}
}

func main() {
	var stdin *bufio.Reader
	// LOCAL
	f, _ := os.Open("input.txt")
	stdin = bufio.NewReader(f)

	// ONLINE JUDGE
	stdin = bufio.NewReader(os.Stdin)

	var a, b int64
	fmt.Fscan(stdin, &a, &b)

	var queue = []*Node{NewNode(a)}
	var seen = make(map[int64]bool)
	for len(queue) > 0 {
		var top = queue[0]
		queue = queue[1:]
		seen[top.value] = true

		if top.value == b {
			// Trace
			fmt.Println("YES")
			var res []int64
			for n := top; n != nil; n = n.prev {
				res = append(res, n.value)
			}
			fmt.Println(len(res))
			for i := len(res) - 1; i >= 0; i-- {
				fmt.Print(res[i], " ")
			}

			return
		}

		if top.value*2 <= b && !seen[top.value*2] {
			var n = NewNode(top.value * 2)
			n.prev = top
			queue = append(queue, n)
		}
		if top.value*10+1 <= b && !seen[top.value*10+1] {
			var n = NewNode(top.value*10 + 1)
			n.prev = top
			queue = append(queue, n)
		}

	}

	fmt.Println("NO")

}


package main

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

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

var a, b int
var trace map[int]int

func dfs(x int) bool {
	if x == b {
		return true
	}
	if x <= b/2 {
		y := x * 2
		_, found := trace[y]
		if !found {
			trace[y] = x
			if dfs(y) {
				return true
			}
		}
	}
	if x <= (b-1)/10 {
		y := x*10 + 1
		_, found := trace[y]
		if !found {
			trace[y] = x
			if dfs(y) {
				return true
			}
		}
	}
	return false
}

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

	fmt.Fscanf(bufin, "%d %d\n", &a, &b)
	trace = make(map[int]int)

	trace[a] = a
	if dfs(a) {
		fmt.Fprintf(bufout, "YES\n")

		var res []int
		for b != a {
			res = append(res, b)
			b = trace[b]
		}
		res = append(res, a)

		n := len(res)
		fmt.Fprintf(bufout, "%d\n", n)
		for i := n - 1; i >= 0; i-- {
			fmt.Fprintf(bufout, "%d ", res[i])
		}
	} else {
		fmt.Fprintf(bufout, "NO\n")
	}

}


package main

import "fmt"

func main() {
    var a, b, steps int
    t := make([]int, 0)
    fmt.Scanf("%d %d", &a, &b)
    t = append(t, b)
    steps = steps + 1
    for {
        if a == b || b < a {
            break
        } else {
            if b % 2 == 0 {
                b = b / 2
                t = append(t, b)
                steps = steps + 1
            } else if (b - 1) % 10 == 0 {
                b = (b - 1) / 10
                t = append(t, b)
                steps = steps + 1
            } else {
                break
            }
        }
    }
    if a == b {
        fmt.Printf("YES\n")
        fmt.Printf("%d\n", steps)
        for idx := len(t) - 1; idx >= 0; idx--{
            if idx == 0 {
                fmt.Printf("%d\n", t[idx])
            } else {
                fmt.Printf("%d ", t[idx])
            }
        }
    } else {
        fmt.Printf("NO\n")
    }
}


package main

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

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

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

	}
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	input := strings.TrimSpace(scanner.Text())

	values := make([]int, len(input))
	for i, a := range input {
		values[i] = int(a - '0')
	}

	fmt.Println(solver(values))
}

func solver(values []int) int {
	n := len(values) / 2
	valsA := values[:n]
	valsB := values[n:]
	sort.Ints(valsA)
	sort.Ints(valsB)

	sumA := sum(valsA)
	sumB := sum(valsB)

	if sumA == sumB {
		return 0
	}

	// lets assume that sumA always bigger sumB
	if sumB > sumA {
		sumA, sumB = sumB, sumA
		valsA, valsB = valsB, valsA
	}

	d := sumA - sumB
	deltaA := valsA[2]
	deltaB := 9 - valsB[0]

	if d <= max(deltaA, deltaB) {
		return 1
	}

	if deltaA > deltaB {
		valsA[2] = 0
	} else {
		valsB[0] = 9
	}

	d = diff(valsA, valsB)
	sort.Ints(valsA)
	sort.Ints(valsB)
	deltaA = valsA[2]
	deltaB = 9 - valsB[0]
	if d <= max(deltaA, deltaB) {
		return 2
	}

	return 3
}

func sum(values []int) int {
	sum := 0
	for i := 0; i < len(values); i++ {
		sum += values[i]
	}
	return sum
}

func diff(valsA, valsB []int) int {
	return sum(valsA) - sum(valsB)
}

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


package main

import (
	"fmt"
)

func main() {
	var a,b string
	fmt.Scanf("%s %s\n",&a,&b)
	if a == b{
		fmt.Println(a)
	}else {
		fmt.Println(1)
	}
}


package main

import "fmt"

func main(){
	var a string
	var b string
	fmt.Scan(&a,&b)
	if a==b{
		fmt.Print(a)
	}else{
		fmt.Print(1)
	}
}


package main

import "fmt"

func main() {
    var one, two string
    fmt.Scan(&one, &two)
    if one == two {
        fmt.Println(one)
    } else {
        fmt.Println(1)
    }
}


package main

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

func main() {
	var n, t int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n, &t)
	count := 0
	time := 240 - t
	for i := 1; i <= n && time >= 0; i++ {
		time = time - 5*i
		if time >= 0 {
			count++
		}
	}
	fmt.Println(count)
}


package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func  main(){
    defer writer.Flush()

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

   timeLeft  :=  240 - b
   ttime:=0
   i:=1
   j:=0

    p:=1

   for a > j{
       ttime = 5*i + ttime

       if(ttime<=timeLeft){

        p++;
      }
      j++
       i++
  }

  printf("%d\n", p-1)

}


package main

import "fmt"

const maxTime int = 240
const solvingTime int = 5

func main() {
	var problems, timeToParty, timeToSolve, answer int
	fmt.Scanln(&problems, &timeToParty)

	for i := 1; i <= problems; i++ {
		timeToSolve += solvingTime * i
		timeToDoEverything := maxTime - timeToSolve - timeToParty

		if timeToDoEverything >= 0 {
			answer++
		} else {
			break
		}
	}

	fmt.Println(answer)
}


package main
import."fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n int64
	Scan(&n)
	if n&1 == 0 {
		Print(n/2)
		return
	}
	for i := int64(2); i*i <= n; i++ {
		if n%i == 0 {
			Print(1 + (n-i)/2)
			return
		}
	}
	Print(1)
}


package main

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

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


package main

import "fmt"

func main() {

	var n int64

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

	primo := true

	resp := int64(0)

	for i := int64(2); i*i <= n; i++ {
		if n%i == 0 {
			resp++
			n -= i
			primo = false
			break
		}
	}

	if primo {
		fmt.Printf("%d\n", 1)
	} else {
		fmt.Printf("%d\n", resp + n/2)
	}

}


package main

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

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

	var n, t, d int
	Fscan(in, &n, &t)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	dp := []int{}
	for i := 0; i < 110 && t > 0; i++ {
		t--
		cur := len(dp)
		for _, v := range a {
			if p := sort.SearchInts(dp, v+1); p < len(dp) {
				dp[p] = v
			} else {
				dp = append(dp, v)
			}
		}
		d = len(dp) - cur
		cur = len(dp)
	}
	if t == 0 {
		Fprint(out, len(dp))
		return
	}
	Fprintln(out, len(dp)+t*d)
}

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


package main

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

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

	var n, t, d int
	Fscan(in, &n, &t)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	dp := []int{}
	for i := 0; i < 310 && t > 0; i++ {
		t--
		cur := len(dp)
		for _, v := range a {
			if p := sort.SearchInts(dp, v+1); p < len(dp) {
				dp[p] = v
			} else {
				dp = append(dp, v)
			}
		}
		d = len(dp) - cur
		cur = len(dp)
	}
	if t == 0 {
		Fprint(out, len(dp))
		return
	}
	Fprintln(out, len(dp)+t*d)
}

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


package main

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

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

	var n, t, d int
	Fscan(in, &n, &t)
	a := make([]int, n)
	for i := range a {
		Fscan(in, &a[i])
	}
	dp := []int{}
	for i := 0; i < n+10 && t > 0; i++ {
		t--
		cur := len(dp)
		for _, v := range a {
			if p := sort.SearchInts(dp, v+1); p < len(dp) {
				dp[p] = v
			} else {
				dp = append(dp, v)
			}
		}
		d = len(dp) - cur
		cur = len(dp)
	}
	if t == 0 {
		Fprint(out, len(dp))
		return
	}
	Fprintln(out, len(dp)+t*d)
}

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


// 62A
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	if (a*2+3 > d && d+1 >= a) || (b*2+3 > c && c+1 >= b) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main
import "fmt"

func main(){
	var A[4] int
		fmt.Scan(&A[0], &A[1], &A[3], &A[2])
	for i:=0; i<2; i++{
		 if A[i]-1<=A[i+2]&&2*A[i]+2>=A[i+2] {
			fmt.Println("YES")
			return
			}
	}

	fmt.Println("NO")
	return
}


package main

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

func main(){
	var al, ar int
	var bl, br int
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	al, _ = strconv.Atoi(r.Text())
	r.Scan()
	ar, _ = strconv.Atoi(r.Text())
	r.Scan()
	bl, _ = strconv.Atoi(r.Text())
	r.Scan()
	br, _ = strconv.Atoi(r.Text())
	if al == br || ar == bl {
		w.WriteString("YES\n")
		w.Flush()
		return
	}
	if br > al {
		if 2*al+2 >= br {
			w.WriteString("YES\n")
			w.Flush()
			return
		}
	}
	if bl > ar {
		if 2*ar+2 >= bl {
			w.WriteString("YES\n")
			w.Flush()
			return
		}
	}
	if al > br {
		if al-br == 1 {
			w.WriteString("YES\n")
			w.Flush()
			return
		}
	}
	if ar > bl {
		if ar-bl == 1 {
			w.WriteString("YES\n")
			w.Flush()
			return
		}
	}
	w.WriteString("NO\n")
	w.Flush()
}


package main

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

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

	sum := 0
	w := make([]int, 7)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := 0; i < 7 && scanner.Scan(); i++ {
		a, err := strconv.Atoi(scanner.Text())
		if err != nil {
			return
		}
		w[i] = a
		sum += a
	}

	n = n % sum
	if n == 0 {
		for i := 6; i >= 0; i-- {
			if w[i] != 0 {
				fmt.Println(i + 1)
				return
			}
		}
	}
	for i := 0; i < 7; i++ {
		n -= w[i]
		if n <= 0 {
			fmt.Println(i + 1)
			break
		}
	}
}


package main

import "fmt"

func main() {
    var n int
    var a [7]int
    fmt.Scan(&n)
    total := 0
    for i := 0; i < 7; i++ {
        fmt.Scan(&a[i])
        total += a[i]
    }
    n %= total
    ans := 0
    if n == 0 {
        ans = 6
        for ; ans >= 0; ans-- {
            if a[ans] > 0 {
                break
            }
        }
    } else {
        for n > a[ans] {
            n -= a[ans]
            ans++
        }
    }
    fmt.Println(ans+1)
}


package main

import "fmt"

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

	res := int64(6)
	p := int64(4)
	for i := 2; i <= n; i++ {
		p = p * p
		p %= 1000000007
		res *= p
		res %= 1000000007
	}

	fmt.Println(res)
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	//out := bufio.NewWriter(os.Stdout)
	var k int
	mod  := int64(1000000007)
	fmt.Fscanf(in, "%d\n", &k)
	ans := int64(1)
	for i := 1;i < k;i++{
		ans = (16*((ans*ans)%mod))%mod
	}
	fmt.Printf("%v\n",(6*ans)%mod)

}


package main

import "fmt"

func power(exp int64) int64 {
	if exp == 0 {
		return 1
	}
	if exp == 1 {
		return 2
	}
	var result int64 = 1
	if exp%2 == 1 {
		result = 2
	}
	p := power(exp / 2)
	result = (result * p * p) % 1000000007
	return result
}

func main() {
	var k int
	fmt.Scan(&k)
	answer := (6 * power((1<<(k+1))-4)) % 1000000007
	fmt.Println(answer)
}


package main

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

func main() {

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

	var b, g, n, resp int
	fmt.Fscanf(reader, "%d\n", &b);
	fmt.Fscanf(reader, "%d\n", &g);
	fmt.Fscanf(reader, "%d\n", &n);

	for i := 0; i <= n; i++ {
		bb, gg := i, n - i
		if bb > b || gg > g {

		} else {
			resp++
		}
	}

	fmt.Println(resp)
}


//HOWDY! IT'S ME! A HARD BLACKISH DICK MOVE!
package main

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

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

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

//str := PrintlnInts(X...)

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

func main() {
	b := ReadInt()
	g := ReadInt()
	n := ReadInt()
	ans := 0
	for i, j := 0, n; i <= n; {
		if i <= b && j <= g {
			ans++
		}
		i++
		j--
	}
	fmt.Println(ans)
}

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

func min(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	min := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] < min {
			min = args[i]
		}
	}
	return min
}

func max(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	max := args[0]
	for i := 1; i < len(args); i++ {
		if args[i] > max {
			max = args[i]
		}
	}
	return max
}

func _gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return _gcd(b, a%b)
}

func gcd(args ...int) int {
	if len(args) == 0 {
		panic("empty!")
	}
	gcd := args[0]
	for i := 1; i < len(args); i++ {
		gcd = _gcd(gcd, args[i])
	}
	return gcd
}

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

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

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

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

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

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

func readInt_64() int64 {
	return readIntNbits(64)
}

func ReadInt2_64() (int64, int64) {
	return readInt_64(), readInt_64()
}

func ReadInt3_64() (int64, int64, int64) {
	return readInt_64(), readInt_64(), readInt_64()
}

func readInt() int {
	return int(readIntNbits(32))
}

func readIntNbits(n int) int64 {
	i, err := strconv.ParseInt(ReadString(), 0, n)
	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
}

// 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())
}

// PrintIntsLine returns integers string delimited by a space.
func PrintlnInts(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)
}


package main

import (
	"fmt"
)

func main() {
	var b, g, n int
	fmt.Scan(&b, &g, &n)
	ans := 0
	for i := 0; i <= n; i++ {
		if i <= b && n-i <= g {
			ans++
		}
	}
	fmt.Println(ans)
}


package main

import (
    "bufio"
    "fmt"
    "os"
)
const(
    mod int64 = 1e9 + 7
    L int64 = 840
    N int64 = 9
)
var dp [N][N * L]int64
var can [N]int64
func min(a, b int64) int64 {
    if(a <= b) {
        return a
    }
    return b
}
func max(a, b int64) int64 {
    if(a >= b) {
        return a
    }
    return b
}
func fun(idx, lft int64) int64 {
    if idx == N {
        if lft == 0 {
            return 0
        }else{
            return -1e16
        }
    }
    if dp[idx][lft] != -1e18 {
        return dp[idx][lft]
    }
    dp[idx][lft] = -1e16
    for i := int64(0); i < (L / idx) && i <= can[idx] && i * idx <= lft; i++ {
        dp[idx][lft] = max(dp[idx][lft], ((can[idx] - i) / (L / idx) + fun(idx + 1, lft - i * idx)))
    }
    return dp[idx][lft]
}
func main() {
    in := bufio.NewReader(os.Stdin)
    var W int64
    for i := int64(0); i < N; i++ {
        for j := int64(0); j < L * N; j++ {
            dp[i][j] = -1e18
        }
    }
    fmt.Fscan(in, &W)
    for i := int64(1); i <= 8; i++ {
        fmt.Fscan(in, &can[i])
    }
    ans := int64(0)
    for i := int64(0); i < L * N && i <= W; i++ {
        if fun(1, i) >= 0 {
            ans = max(ans, i + min((W - i) / L , fun(1, i)) * L)
        }
    }
    fmt.Println(ans)
}


package main

import "fmt"

var n1, n2, k1, k2 int
var line [101][101][11][11]int

func init() {
  for a, line1 := range line {
    for b, line2 := range line1 {
      for c, line3 := range line2 {
        for d, _ := range line3 {
          line[a][b][c][d] = -1
        }
      }
    }
  }
}

func lineup(n3 int, n4 int, k3 int, k4 int) int {
  if n3 < 0 || n4 < 0 || k3 > k1 || k4 > k2 {
    return 0
  }

  if n3 == 0 && n4 == 0 {
    return 1
  }

  if line[n3][n4][k3][k4] != -1 {
    return line[n3][n4][k3][k4]
  }

  line[n3][n4][k3][k4] = ((lineup(n3-1, n4, k3+1, 0) + lineup(n3, n4-1, 0, k4+1)) % 100000000)
  return line[n3][n4][k3][k4]
}

func main() {
  fmt.Scanf("%d %d %d %d", &n1, &n2, &k1, &k2)
  fmt.Printf("%d\n", lineup(n1, n2, 0, 0))
}


// Author: sighduck
// URL: https://codeforces.com/problemset/problem/118/D

package main

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

const Mod = 100000000

func Solve(n1, n2, k1, k2 int) int {
	dp := [101][101][2]int{}
	dp[0][0][0] = 1
	dp[0][0][1] = 1
	for i := 0; i <= n1; i++ {
		for j := 0; j <= n2; j++ {
			for k := 1; k <= k1 && k <= i; k++ {
				dp[i][j][0] = (dp[i][j][0] + dp[i-k][j][1]) % Mod
			}
			for k := 1; k <= k2 && k <= j; k++ {
				dp[i][j][1] = (dp[i][j][1] + dp[i][j-k][0]) % Mod
			}
		}
	}
	return (dp[n1][n2][0] + dp[n1][n2][1]) % Mod
}

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

	var n1, n2, k1, k2 int
	fmt.Fscanf(reader, "%d %d %d %d\n", &n1, &n2, &k1, &k2)

	fmt.Fprintf(writer, "%d\n", Solve(n1, n2, k1, k2))
}


package main

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

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

	var n1, n2, k1, k2 int
	Fscan(in, &n1, &n2, &k1, &k2)

	const mod = 1e8
	cache := make(map[string]int, 3e5)
	var f func(left1, left2, c1, c2 int) int
	f = func(left1, left2, c1, c2 int) (sum int) {
		if left1 == 0 {
			if left2+c2 <= k2 {
				return 1
			}
			return 0
		}
		if left2 == 0 {
			if left1+c1 <= k1 {
				return 1
			}
			return 0
		}
		hash := Sprintf("%d;%d;%d;%d", left1, left2, c1, c2)
		if val, ok := cache[hash]; ok {
			return val
		}
		if c1 < k1 {
			sum += f(left1-1, left2, c1+1, 0)
		}
		if c2 < k2 {
			sum += f(left1, left2-1, 0, c2+1)
		}
		sum %= mod
		cache[hash] = sum
		return
	}
	Fprintln(out, f(n1, n2, 0, 0))
}

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


// Author: sighduck
// URL: https://codeforces.com/problemset/problem/431/C

package main

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

const M = 1000000007

func Count(x, y int) int {
	dp := make([]int, x+1)
	dp[0] = 1
	for i := 1; i <= x; i++ {
		for j := 1; j <= y; j++ {
			if i-j >= 0 {
				dp[i] = (dp[i] + dp[i-j]) % M
			}
		}
	}
	return dp[x]
}

func Solve(n, k, d int) int {
	return (Count(n, k) - Count(n, d-1) + M) % M
}

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

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

	fmt.Fprintf(writer, "%d\n", Solve(n, k, d))
}


package main

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

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

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

func readInt() int64 {
	var o, neg bool
	var i int64
	b, err := r.ReadByte()
	for err == nil {
		if b != ' ' && b != '\n' && b != '\r' {
			if b == '-' {
				neg = true
			} else {
				i = i*10 + int64(b) - 48
				o = true
			}
		} else if o {
			break
		}
		b, err = r.ReadByte()
	}
	if neg {
		return -i
	}
	return i
}

func writeInt(i int64) {
	if i < 0 {
		w.WriteByte('-')
		i = -i
	}
	if i < 10 {
		w.WriteByte(byte(i + 48))
		return
	}
	var tmp, count int64
	tmp = i
	for tmp%10 == 0 {
		tmp /= 10
		count++
	}
	tmp = 0
	for i != 0 {
		tmp = tmp*10 + (i % 10)
		i /= 10
	}
	for tmp != 0 {
		w.WriteByte(byte((tmp % 10) + 48))
		tmp /= 10
	}
	for count > 0 {
		count--
		w.WriteByte('0')
	}
}

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

func main() {
	for I(&n) == nil {
		solve(n)
	}
	w.Flush()
}

const mod = 1e9 + 7

var n, k, d int64
var visited []bool
var dp [][2]int64

func solve(n int64) {
	k, d = readInt(), readInt()
	visited, dp = make([]bool, n+1), make([][2]int64, n+1)
	dp[0][0] = 1
	O(do(n, 1), "\n")
}

func do(n, contains int64) int64 {
	if visited[n] {
		return dp[n][contains]
	}
	visited[n] = true
	for i := int64(1); i <= k && i <= n; i++ {
		if i < d {
			dp[n][0] += do(n-i, 0)
		} else {
			dp[n][1] += do(n-i, 0)
		}
		dp[n][1] += do(n-i, 1)
		dp[n][0] %= mod
		dp[n][1] %= mod
	}
	return dp[n][contains]
}


package main

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

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

	const mod = 1e9 + 7
	var n, k, d int
	Fscan(in, &n, &k, &d)
	dp := make([][2]int, n)
	for i := range dp {
		dp[i][0] = -1
		dp[i][1] = -1
	}
	var f func(int, int) int
	f = func(sum int, contain int) int {
		if sum == n {
			return 1
		}
		if contain == 0 && sum+d > n {
			return 0
		}
		if v := dp[sum][contain]; v != -1 {
			return v
		}
		ans := 0
		if contain == 0 {
			for i := 1; i < d; i++ {
				if sum+i > n {
					break
				}
				ans = (ans + f(sum+i, 0)) % mod
			}
			for i := d; i <= k; i++ {
				if sum+i > n {
					break
				}
				ans = (ans + f(sum+i, 1)) % mod
			}
		} else {
			for i := 1; i <= k; i++ {
				if sum+i > n {
					break
				}
				ans = (ans + f(sum+i, 1)) % mod
			}
		}
		dp[sum][contain] = ans
		return ans
	}
	Fprint(out, f(0, 0))
}

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


package main

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

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

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

func readInt() int {
	var o, neg bool
	var i int
	b, err := r.ReadByte()
	for err == nil {
		if b != ' ' && b != '\n' && b != '\r' {
			if b == '-' {
				neg = true
			} else {
				i = i*10 + int(b) - 48
				o = true
			}
		} else if o {
			break
		}
		b, err = r.ReadByte()
	}
	if neg {
		return -i
	}
	return i
}

func writeInt(i int) {
	if i < 0 {
		w.WriteByte('-')
		i = -i
	}
	if i < 10 {
		w.WriteByte(byte(i + 48))
		return
	}
	var tmp, count int
	tmp = i
	for tmp%10 == 0 {
		tmp /= 10
		count++
	}
	tmp = 0
	for i != 0 {
		tmp = tmp*10 + (i % 10)
		i /= 10
	}
	for tmp != 0 {
		w.WriteByte(byte((tmp % 10) + 48))
		tmp /= 10
	}
	for count > 0 {
		count--
		w.WriteByte('0')
	}
}

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

func main() {
	for I(&n) == nil {
		solve(n)
	}
	w.Flush()
}

const mod = 1e9 + 7

var n, k, d int
var visited []bool
var dp [][2]int

func solve(n int) {
	k, d = readInt(), readInt()
	visited, dp = make([]bool, n+1), make([][2]int, n+1)
	dp[0][0] = 1
	O(do(n, 1), "\n")
}

func do(n, contains int) int {
	if visited[n] {
		return dp[n][contains]
	}
	visited[n] = true
	for i := 1; i <= k && i <= n; i++ {
		if i < d {
			dp[n][0] += do(n-i, 0)
			dp[n][0] %= mod
		} else {
			dp[n][1] += do(n-i, 0)
			dp[n][1] %= mod
		}
		dp[n][1] += do(n-i, 1)
		dp[n][1] %= mod
	}
	return dp[n][contains]
}


package main

import "fmt"

const mod = 1000000007

func main() {
  var n, k, d int
  fmt.Scanf("%d%d%d\n",&n,&k,&d)
  a := make([]int, n+1)
  b := make([]int, n+1)
  b[0] = 1
  for i := 1; i <= n; i++ {
    for j := 1; j <= k && j <= i; j++ {
      a[i] += a[i - j]
      if a[i] >= mod {
        a[i] -= mod
      }
    }
    for j := 1; j < d && j <= k && j <= i; j++ {
      b[i] += b[i - j]
      if b[i] >= mod {
        b[i] -= mod
      }
    }
    for j := d; j <= k && j <= i; j++ {
      a[i] += b[i - j]
      if a[i] >= mod {
        a[i] -= mod
      }
    }
  }
  fmt.Println(a[n] % mod)
}


package main

import (
        "fmt"
)

var n int
var x int
var temp int
var a [101]int

func main() {
        fmt.Scan(&n, &x)
        cnt := 0
        for i := 0; i < n; i++ {
                fmt.Scan(&temp)
                a[temp] = 1
        }
        for i := 0; i <= 100; i++ {
                if i == x {
                        if a[i] == 1 {
                                cnt++
                        }
                        break
                } else {
                        if a[i] == 0 {
                                cnt++
                        }
                }
        }
        fmt.Println(cnt)
}


package main

import (
	"fmt"
	"log"
)

func init() {
	log.SetFlags(0)
}

func main() {
	var flag bool
	var n, x, mark int
	fmt.Scanf("%d %d\n", &n, &x)
	arr := make([]int, x)
	for i := range arr {
		arr[i] = i
	}
	for i, tmp := 0, 0; i < n; i++ {
		fmt.Scanf("%d", &tmp)
		if tmp < x {
			for j, val := range arr {
				if tmp == val {
					mark = j
					break
				}
			}
			arr = arr[:mark+copy(arr[mark:], arr[mark+1:])]
		} else if tmp == x {
			flag = true
		}
	}
	if flag {
		fmt.Println(len(arr) + 1)
	} else {
		fmt.Println(len(arr))
	}
}


package main

import "fmt"

func main() {
	var n, x, a, i, c, r int8
	fmt.Scanf("%d %d\n", &n, &x)
	for i = 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		if a < x {
			r++
		} else if a == x {
			c++
		}
	}
	fmt.Println(c + (x - r))
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	s := ""
	fmt.Scan(&s)
	n := strings.Count(s, "-")
	b := strings.Count(s, "o")
	if b == 0 || n%b == 0 {
		fmt.Printf("YES\n")
	} else {
		fmt.Printf("NO\n")
	}
}


package main

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

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

// IO helper functions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// IO functions

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

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

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

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

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

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

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

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

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

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

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

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

// Simple math functions

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

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

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

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

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

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

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

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

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

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

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

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

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

func main() {
	defer Flush()

	s := reads()
	ss := strings.Split(s, "o")
	a := make([]int, len(ss))
	for i := range a {
		a[i] = len(ss[i])
	}
	eprintln(a)
	if 1 < len(a) {
		k := len(a) - 1
		a[0] += a[k]
		a = a[:k]
	}
	eprintln(a)
	var sum int
	for _, v := range a {
		sum += v
	}
	if sum == 0 || sum%len(a) == 0 {
		println("YES")
	} else {
		println("NO")
	}
}


package main

import "fmt"

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

	elems := []rune(line)

	countFibres, countBeads := 0, 0
	for i := 0; i < len(elems); i++ {
		if elems[i] == '-' {
			countFibres++
		} else {
			countBeads++
		}
	}

	if countBeads == 0 || countFibres % countBeads == 0 {
		fmt.Print("YES")
	} else {
		fmt.Print("NO")
	}
}


package main

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

func main() {
	a, b, c := 0, 0, 0
	fmt.Scan(&a, &b, &c)
	d := []int{a, b, c}
	sort.Ints(d)
	if (d[2] + 1) <= (d[1] + d[0]) {
		fmt.Println(0)
		os.Exit(0)
	}
	fmt.Println((d[2] + 1) - (d[1] + d[0]))
}


package main

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

func triago(a int, b int, c int) int {
	if (a +b > c) && (b+c >a) && (c+a >b) {

		return 0
	}
		switch {
		case b >= (c+a):

			return b-c-a + 1
		case c >= (b+a):

			return c - b- a + 1
		case a >= (c+b):

			return a - c- b + 1
		}

	return 0
}

func main() {
	array := []int{}
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	hand := strings.Split(text," ")
	for _,val := range(hand) {
		text =  strings.TrimRight(val,"\r\n")
		l,_ := strconv.Atoi(text)
		array = append(array,l)
	}
	fmt.Println(triago(array[0],array[1],array[2]))
}


package main

import "fmt"

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

    if a >= (b + c) {
        fmt.Printf("%d\n", a + 1 - (b+c))
        return
    } else if b >= (a + c) {
        fmt.Printf("%d\n", b + 1 - (a + c))
        return
    } else if c >= (a + b) {
        fmt.Printf("%d\n", c + 1 - (a + b))
        return
    }

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


package main

import "fmt"

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

    a := m - 1
    if a < n - m {
        a = m + 1
    }
    if a == 0 {
        a = m
    }
    fmt.Println(a)
}


package main

import "fmt"

func main() {
	var n,m int;
	_,_ = fmt.Scanf("%d %d",&n,&m)
	var u = n-m;
	var l = m-1;
	if u==0 && l==0{
		fmt.Println(m)
	}else if(u > l){
		fmt.Println(m+1)
	}else{
		fmt.Println(m-1)
	}
}


package main

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

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, m Int
	for I(&n, &m) == nil {
		solve(n, m)
	}
}

func solve(n, m Int) {
	var ans Int
	if n == Int(1) {
		ans = 1
	} else if m-1 >= n-m {
		ans = m - 1
	} else {
		ans = m + 1
	}
	O(ans, "\n")
}


package main

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

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

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

func readInt() int {
	var o, neg bool
	var i int
	b, err := r.ReadByte()
	for err == nil {
		if b != ' ' && b != '\n' && b != '\r' {
			if b == '-' {
				neg = true
			} else {
				i = i*10 + int(b) - 48
				o = true
			}
		} else if o {
			break
		}
		b, err = r.ReadByte()
	}
	if neg {
		return -i
	}
	return i
}

func writeInt(i int) {
	if i < 0 {
		w.WriteByte('-')
		i = -i
	}
	if i < 10 {
		w.WriteByte(byte(i + 48))
		return
	}
	var tmp, count int
	tmp = i
	for tmp%10 == 0 {
		tmp /= 10
		count++
	}
	tmp = 0
	for i != 0 {
		tmp = tmp*10 + (i % 10)
		i /= 10
	}
	for tmp != 0 {
		w.WriteByte(byte((tmp % 10) + 48))
		tmp /= 10
	}
	for count > 0 {
		count--
		w.WriteByte('0')
	}
}

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

func main() {
	var s string
	for I(&s) == nil {
		solve(s)
	}
	w.Flush()
}

func solve(s string) {
	for i := range s {
		if s[i] == '1' && strings.Count(s[i:], "0") > 5 {
			O("yes\n")
			return
		}
	}
	O("no\n")
}


package main

import "fmt"
import "os"
import "bufio"

var s string
func main() {
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &s)
	i := 0
	zero := 0

	for i < len(s) {
		if  s[i] == '1' { break }
		i++
	}

	for i < len(s) {
		if s[i] == '0' {
			zero++
		}
		i++
	}

	if zero > 5 {
		fmt.Printf("yes")
		os.Exit(0)
	}
	fmt.Printf("no")
}


package main

import (
	"fmt"
)

func main() {
	var (
		str string
		cnt int
	)
	found := false
	fmt.Scanf("%s", &str)
	for i := range str {
		if str[i] == '1' {
			found = true
		} else if str[i] == '0' && found {
			cnt++
		}
	}
	if cnt >= 6 {
		fmt.Println("yes")
	} else {
		fmt.Println("no")
	}
}


package main

import (
	"fmt"
	"math"
)

func min(i, j int64) int64 {
	if i < j {
		return i
	}
	return j
}

func main() {
	var n, k int64
	fmt.Scan(&n, &k)
	var c = make([]int64, n)
	for i := range c {
		fmt.Scan(&c[i])
	}

	for i := 1; int64(i) < n; i++ {
		if c[i] > c[i-1]*2 {
			c[i] = 2 * c[i-1]
		}
	}

	var ans int64
	ans = math.MaxInt64
	var sum int64
	for i := n - 1; i >= 0; i-- {
		var need = k / (1 << uint(i))
		sum += need * c[i]
		k -= (need << uint(i))
		if k > 0 {
			ans = min(ans, sum+c[i])
		} else {
			ans = min(ans, sum)
		}
	}
	fmt.Println(ans)
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF913C(in io.Reader, out io.Writer) {
	search := func(l, r int64, f func(int64) bool) int64 {
		i, j := l, r
		for i < j {
			h := (i + j) >> 1
			if f(h) {
				j = h
			} else {
				i = h + 1
			}
		}
		return i
	}
	var n, l int
	Fscan(in, &n, &l)
	c := [31]int64{}
	for i := 0; i < n; i++ {
		Fscan(in, &c[i])
		if i > 0 && c[i] > 2*c[i-1] {
			c[i] = 2 * c[i-1]
		}
	}
	for i := n; i < 31; i++ {
		c[i] = c[i-1] << 1
	}
	ans := search(1, c[30], func(m int64) bool {
		s := 0
		for i := 29; i >= 0; i-- {
			if c[i] <= m {
				m -= c[i]
				s |= 1 << i
			}
		}
		return s >= l
	})
	Fprint(out, ans)
}

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


package main

import "fmt"

func main() {
	var n, l uint64
	fmt.Scan(&n, &l)

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

	sum := uint64(0)
	currPrice := c[0]
	prevPrice := c[0]

	for pos := 0; pos < len(c); pos++ {
		currPrice = c[pos]
		if currPrice < sum { // Current price is cheaper > rebuy all
			sum = currPrice
		}

		if currPrice > prevPrice<<1 { // Current price is too high > keep the old one
			currPrice = prevPrice << 1
		}

		sum += (l % 2) * currPrice
		prevPrice = currPrice
		l >>= 1
	}

	sum += l * (currPrice << 1)
	fmt.Println(sum)
}


package main

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

var sc *bufio.Scanner = bufio.NewScanner(os.Stdin)

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

func Count(left, right int, a []int) (cnt int) {
  for i, val := range a {
    if left <= i && i <= right {
      cnt += 1 - val
    } else {
      cnt += val
    }
  }
  return
}

func main() {
  sc.Split(bufio.ScanWords)
  n := nextInt()
  var a = make([]int, n)
  for i := range a {
    a[i] = nextInt()
  }
  best := 0
  for i := 0; i < n; i++ {
    for j := i; j < n; j++ {
      cnt := Count(i,j,a)
      if best < cnt {
        best = cnt
      }
    }
  }
  fmt.Println(best)
}


package main

import (
    "fmt"
    )

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

    an := make([]int, n, n)
    ones := 0
    for i := 0; i < n; i++ {
        fmt.Scan(&an[i])
        if an[i] == 1 {
            ones++
            an[i] = -1
        } else {
            an[i] = 1
        }
    }

    dp := make([]int, n, n)
    dp[0] = an[0]
    max := dp[0]
    for i := 1; i < n; i++ {
        dp[i] = dp[i-1] + an[i]
        if dp[i] < an[i] {
            dp[i] = an[i]
        }
        if max < dp[i] {
            max = dp[i]
        }
    }

    fmt.Println(ones + max)
}


package main

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

type MyScanner struct {
	*bufio.Scanner
	justScanned bool
}

func NewMyScanner() *MyScanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return &MyScanner{sc, false}
}

func (sc *MyScanner) Has() bool {
	sc.justScanned = true
	return sc.Scan()
}

func (sc *MyScanner) Int() int {
	if !sc.justScanned {
		sc.Scan()
	}
	sc.justScanned = false

	x, _ := strconv.Atoi(sc.Text())
	return x
}

func (sc *MyScanner) Bool() bool {
	if !sc.justScanned {
		sc.Scan()
	}
	sc.justScanned = false

	return sc.Bytes()[0] == byte('1')
}

var sc = NewMyScanner()

func solve() int {
	n := sc.Int()
	a := make([]bool, n)

	sum := 0
	for i := range a {
		a[i] = sc.Bool()
		if a[i] {
			sum++
		}
	}

	if sum == n {
		return n - 1
	}

	act, best := 0, 0
	for i := range a {
		if !a[i] {
			act++
			if act > best {
				best = act
			}
		} else {
			act--
			if act < 0 {
				act = 0
			}
		}
	}
	return best + sum
}

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


package main

import (
	"fmt"
)

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

	fmt.Scan(&n1, &n2, &k1, &k2)

	if n1 > n2 {
		fmt.Println("First")
	} else {
		fmt.Println("Second")
	}
}


package main

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

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

func main() {
	defer out.Flush()
	in.Split(bufio.ScanWords)

	a, b, _, _ := nextInt(), nextInt(), nextInt(), nextInt()

	if a > b {
		fmt.Println("First")
	} else {
		fmt.Println("Second")
	}
}

func nextInt() int {
	in.Scan()
	res, _ := strconv.Atoi(in.Text())
	return res
}


// Rockethon_2015_A
package main

import (
	"fmt"
)

var (
	first, second int
)

func main() {
	fmt.Scanf("%d", &first)
	fmt.Scanf("%d", &second)
	if first <= second {
		fmt.Printf("Second")
	} else {
		fmt.Printf("First")
	}
}


// 443B
package main

import (
	"fmt"
)

func count(s *string, n, k, l int) bool {
	for i := 0; i <= n+k-l*2; i++ {
		stat := true
		for j := 0; j < l; j++ {
			if i+j+l < n && (*s)[i+j] != (*s)[i+j+l] {
				stat = false
				break
			}
		}
		if stat {
			return true
		}
	}
	return false
}

func main() {
	var s string
	var k int
	fmt.Scan(&s, &k)
	n := len(s)
	ans := 0
	for i := (n + k) / 2; i > 0; i-- {
		if count(&s, n, k, i) {
			ans = i * 2
			break
		}
	}
	fmt.Println(ans)
}


package main

import (
  "fmt"
)

func Judge(line *string, n, k, l int) bool {
  for i := 0; i <= n+k-l*2; i++ {
    var flag bool = true
    for j := 0; j < l; j++ {
      if i+j+l < n && (*line)[i+j] != (*line)[i+j+l] {
        flag = false
        break
      }
    }
    if flag {
      return true
    }
  }
  return false
}

func main() {
  var line string
  var k int
  fmt.Scan(&line, &k)
  var n int = len(line)
  var res int = 0
  for i := (n + k) / 2; i > 0; i-- {
    if Judge(&line, n, k, i) {
      res = i * 2
      break
    }
  }
  fmt.Println(res)
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	line, _ := reader.ReadString('\n')

	s := strings.TrimSpace(line)
	stringLength := len(s)

	line, _ = reader.ReadString('\n')
	var k int

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

	newString := make([]rune, stringLength+k)
	copy(newString, []rune(s))

	bestRepeat := 0
	for i := 0; i < stringLength+k; i++ {
		for currentRepeat := 0; currentRepeat <= (stringLength+k-i)/2; currentRepeat++ {
			tandemRepeat := true
			for j := i; j < i+currentRepeat; j++ {
				if newString[j+currentRepeat] != newString[j] && newString[j+currentRepeat] != 0 {
					tandemRepeat = false
					break
				}
			}
			if tandemRepeat && currentRepeat > bestRepeat {
				bestRepeat = currentRepeat
			}

		}
	}
	fmt.Println(2*bestRepeat - 0)
}


package main

import (
	"fmt"
)

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

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

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

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

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

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


package main

import (
	"fmt"
)

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

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

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

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

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

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


package main

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

func solve() {
	var a [4][4]int
	for i := 0; i < 4; i++ {
		for j := 0; j < 4; j++ {
			a[i][j] = readInt()
		}
	}
	for i := 0; i < 4; i++ {
		if a[i][3] == 1 {
			for j := 0; j < 3; j++ {
				if a[i][j] == 1 {
					fmt.Println("YES")
					return
				}
			}
			if a[(i+1)%4][0] == 1 || a[(i+2)%4][1] == 1 || a[(i+3)%4][2] == 1 {
				fmt.Println("YES")
				return
			}
		}
	}
	fmt.Println("NO")
}

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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


package main

import (
	"fmt"
)
func main() {
	n := 0
	fmt.Scan(&n)
	s := ""
	fmt.Scan(&s)
	ans := 0
	for _, char := range(s) {
		if char == rune('+') {
			ans = ans + 1
		} else if char == rune('-') {
			if ans != 0 {
				ans = ans - 1
			}
		}
	}
	fmt.Println(ans)
}


package main

import (
	"fmt"
)

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

func main(){
	var n int
	fmt.Scan(&n)
	var s string
	fmt.Scan(&s)
	ans := n
	var i int
	var temp int

	for i = 0 ; i <= 100;i++{
		temp = i
		for _, char := range (s){
			if(char =='+'){
				temp ++
			}
			if(char =='-'){
				temp --
				if(temp <= -1){
				temp = -1
				break;
				}
			}
		}
		if(temp >= 0){
			ans = min(ans,temp)
		}
	}
	fmt.Print(ans)

}


package main

import "fmt"

func main() {
	var n int32
	var str string
	fmt.Scanf("%d\n",&n)
	fmt.Scanf("%s\n",&str)
	ans:=0
	for _,c:=range str{
		if c=='+'{
			ans++
		}else if c=='-'{
			if ans>0{
				ans--
			}
		}
	}
	fmt.Println(ans)
}


package main

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

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

	var n, max, min int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int, n)
	max = 0
	min = 100
	for i := 0; i < n; i++ {
		fmt.Fscanf(buf, "%d", &mat[i])
		if mat[i] > max {
			max = mat[i]
		}
		if mat[i] < min {
			min = mat[i]
		}
	}
	fmt.Fscanf(buf, "\n")
	if max == min {
		fmt.Printf("0\n")
		return
	}
	mid := (max + min) / 2
	hasmid := false
	for i := 0; i < n; i++ {
		if mat[i] != max && mat[i] != min && mat[i] != mid {
			fmt.Printf("-1\n")
			return
		}
		if mat[i] == mid {
			hasmid = true
		}
	}

	if ((max - min) & 1) == 1 {
		if max-min > 1&&hasmid {
			fmt.Printf("-1\n")
		}else{
			fmt.Printf("%d\n",max-min)
		}
	}else{
			fmt.Printf("%d\n",max-mid)
	}

}


package main

import (
	"fmt"
	"sort"
)

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

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

	sort.Ints(nums)
	allEqual := true
	for i := 1; i < n; i++ {
		nums[i] -= nums[0]
		allEqual = allEqual && nums[i] == 0
	}
	if allEqual {
		fmt.Println(0)
		return
	}

	for i := 1; i <= 100; i++ {
		for j := 1; j < n; j++ {
			if nums[j] == 0 {
				continue
			}
			if nums[j]%i != 0 {
				break
			}
			if nums[j]/i > 2 {
				break
			}
			if j == n-1 {
				fmt.Println(i)
				return
			}
		}
	}
	fmt.Println(-1)
}


// Author: sighduck
// URL: https://codeforces.com/contest/1154/problem/B

package main

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

func getUniqueElements(n int, a []int) []int {
	nums := make(map[int]bool)
	elems := []int{}
	for _, elem := range a {
		if !nums[elem] {
			nums[elem] = true
			elems = append(elems, elem)
		}
	}
	return elems
}

func Solve(n int, a []int) int {
	b := getUniqueElements(n, a)
	k := len(b)
	if k > 3 {
		return -1
	}
	sort.Ints(b)
	if len(b) == 1 {
		return 0
	}
	diff := b[len(b)-1] - b[0]
	if len(b) == 2 {
		if diff%2 == 1 {
			return diff
		}
		return diff / 2
	}
	if diff%2 == 1 || b[1]+diff/2 != b[2] {
		return -1
	}
	return diff / 2
}

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

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

	fmt.Fprintf(writer, "%d\n", Solve(n, a))
}


package main

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

var posMap = map[string]int{
    "^": 0,
    ">": 1,
    "v": 2,
    "<": 3,
}

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

    start, end := posMap[sPos], posMap[ePos]

    if start != end {
        posCW := (start + (n % 4)) % 4
        posCCW := (4 + start - (n % 4)) % 4
        if posCW == posCCW {
            fmt.Println("undefined")
        } else {
            if end == posCW {
                fmt.Println("cw")
            } else {
                fmt.Println("ccw")
            }
        }
    } else {
        fmt.Println("undefined")
    }
}


package main

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

func solve() {
	from := readString()
	to := readString()
	cnt := readInt() % 4

	a := "^>v<"
	b := "^<v>"
	cwStart := strings.Index(a, from)
	cwEnd := strings.Index(a, to)
	ccwStart := strings.Index(b, from)
	ccwEnd := strings.Index(b, to)
	res1 := (cwEnd - cwStart + 4) % 4
	res2 := (ccwEnd - ccwStart + 4) % 4
	if res1 == cnt && res2 == cnt {
		fmt.Println("undefined")
	} else if res1 == cnt {
		fmt.Println("cw")
	} else if res2 == cnt {
		fmt.Println("ccw")
	} else {
		fmt.Println("undefined")
	}
}

var scanner *bufio.Scanner

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

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

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

// IO

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

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

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

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

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


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	arr := gsls(reader)
	rot := gsli(reader)[0]

	start := pos(arr[0])
	end := pos(arr[1])

	// fmt.Printf("arr: %#v \n rot: %#v \n start: %v \n end: %v", arr, rot, start, end)

	cwEnd := posMod(start+rot, 4)
	ccwEnd := posMod(start-rot, 4)

	diff := posMod(end-start, 4)

	if diff == 0 || diff == 2 {
		fmt.Print("undefined")
	} else if end == cwEnd {
		fmt.Print("cw")
	} else if end == ccwEnd {
		fmt.Print("ccw")
	} else {
		fmt.Printf("cwEnd = %v, ccwEnd = %v", cwEnd, ccwEnd)
	}
	return
}

func pos(x string) (pos int) {
	switch x {
	case "^":
		pos = 0
	case ">":
		pos = 1
	case "v":
		pos = 2
	case "<":
		pos = 3
	}

	return
}

// Input helpers

// If you don't pass in a reference to the reader, and just instantiate a new
// one every time, it will work locally, with IO typed at human-speed, but not
// on Codeforces.

// Get Space-separated Line as Strings
//
// Example input:
// 1 test 382.0
// Example output:
// ["1", "test", "382.0"]

func gsls(reader *bufio.Reader) (arr []string) {
	// Get a full line
	input, _ := reader.ReadString('\n')

	//Strip newline and return chars, if any
	input = strings.TrimSuffix(input, "\n")
	input = strings.TrimSuffix(input, "\r")

	// Split at the spaces into an array
	arr = strings.Split(input, " ")

	return
}

// Get Space-separated Line as Integers
// Any non-valid integers will be 0
//
// Example input:
// test 1 12.3 -117
// Example output:
// [0, 1, 0, -117]

func gsli(reader *bufio.Reader) (arr []int) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.Atoi(e)
		arr = append(arr, cur)
	}

	return
}

// Get Space-separated Line as 64-bit Floats
// Any non-valid floats will be 0
//
// Example input:
// test 128.328 12 -11.0
// Example output:
// [0, 128.328, 12, -11]

func gslf(reader *bufio.Reader) (arr []float64) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.ParseFloat(e, 64)
		arr = append(arr, cur)
	}

	return
}

// Math helpers

// Positve Modulo
// Returns x mod y, but always positive

func posMod(x, y int) int {
	return (x%y + y) % y
}


package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var s []byte
	fmt.Scan(&s)
	n := 1 << uint(len(s))
	r := 0
	for i := n - 1; i > 0; i-- {
		var t []byte
		for j := 0; j < len(s); j++ {
			if (i>>uint(j))&1 != 0 {
				t = append(t, s[j])
			}
		}
		if t[0] == '0' || len(t) <= r {
			continue
		}
		v, _ := strconv.Atoi(string(t))
		w := int(math.Sqrt(float64(v)))
		if v == w*w {
			r = len(t)
		}
	}
	if r == 0 {
		fmt.Println("-1")
	} else {
		fmt.Println(len(s) - r)
	}
}


package main

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

type caseInput struct {
	num int
}

func readCaseInput(scanner *bufio.Scanner) caseInput {
	return caseInput{readInt(scanner)}
}

type caseOutput struct {
	ops int
}

func writeCaseOutput(writer *bufio.Writer, out caseOutput) {
	writef(writer, "%d\n", out.ops)
}

func solveCase(in caseInput) caseOutput {
	numStr := fmt.Sprintf("%d", in.num)
	root := int(math.Floor(math.Sqrt(float64(in.num))))
	for root > 0 {
		squareStr := fmt.Sprintf("%d", root*root)
		if len(lcs(numStr, squareStr)) == len(squareStr) {
			return caseOutput{len(numStr) - len(squareStr)}
		}
		root -= 1
	}
	return caseOutput{-1}
}

//	that's from rozetta code and seems to work
func lcs(a, b string) string {
	arunes := []rune(a)
	brunes := []rune(b)
	aLen := len(arunes)
	bLen := len(brunes)
	lengths := make([][]int, aLen+1)
	for i := 0; i <= aLen; i++ {
		lengths[i] = make([]int, bLen+1)
	}
	// row 0 and column 0 are initialized to 0 already

	for i := 0; i < aLen; i++ {
		for j := 0; j < bLen; j++ {
			if arunes[i] == brunes[j] {
				lengths[i+1][j+1] = lengths[i][j] + 1
			} else if lengths[i+1][j] > lengths[i][j+1] {
				lengths[i+1][j+1] = lengths[i+1][j]
			} else {
				lengths[i+1][j+1] = lengths[i][j+1]
			}
		}
	}

	// read the substring out from the matrix
	s := make([]rune, 0, lengths[aLen][bLen])
	for x, y := aLen, bLen; x != 0 && y != 0; {
		if lengths[x][y] == lengths[x-1][y] {
			x--
		} else if lengths[x][y] == lengths[x][y-1] {
			y--
		} else {
			s = append(s, arunes[x-1])
			x--
			y--
		}
	}
	// reverse string
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
	return string(s)
}

func solveSequential(scanner *bufio.Scanner, writer *bufio.Writer) {
	writeCaseOutput(writer, solveCase(readCaseInput(scanner)))
}

func main() {
	var scanner *bufio.Scanner
	if len(os.Args) > 1 {
		reader, err := os.Open(os.Args[1])
		if err != nil {
			panic(err)
		}
		defer reader.Close()
		scanner = bufio.NewScanner(reader)
	} else {
		scanner = bufio.NewScanner(os.Stdin)
	}
	scanner.Split(bufio.ScanWords)

	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	solveSequential(scanner, writer)
}

func readInt64(sc *bufio.Scanner) int64 {
	sc.Scan()
	res, err := strconv.ParseInt(sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func readInt(sc *bufio.Scanner) int {
	return int(readInt64(sc))
}

func writef(writer *bufio.Writer, formatStr string, values ...interface{}) {
	out := fmt.Sprintf(formatStr, values...)
	_, err := writer.WriteString(out)
	if err != nil {
		panic(err)
	}
}


package main

import "fmt"

func main() {
    const MOD int64 = 1000000007
    var n int
    fmt.Scan(&n)
    ans, prev, prevprev := int64(0), int64(0), int64(1)
    for i := 1; i < n; i++ {
        ans = (3*prevprev)%MOD
        prevprev = (prev+(2*prevprev))%MOD
        prev = ans
    }
    fmt.Println(ans)
}


package main
import "fmt"
func main() {
    var n int
    fmt.Scan(&n)
    if n == 1 {
        fmt.Println(0)
        return
    }
    var fpp int64
    var fp int64 = 0
    var f int64 = 3
    for i := 3; i <= n; i++ {
        fpp = fp
        fp = f
        f = (2 * fp + 3 * fpp) % 1000000007
    }
    fmt.Println(f % 1000000007)

    return
}


package main

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

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

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

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

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

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

	r := 0
	for i :=0; i < n - 1; i++ {
		if a[i] >= a[i + 1] + c && a[i] - a[i+1] - c > r  {
			r = a[i] - a[i+1] - c
		}
	}

	fmt.Fprintln(writer, r)

	writer.Flush()
}


// wa on test 4
package main

import (
	"fmt"
)

func main() {

	var (
		n, c, max, i int32
		x            [128]int32
	)

	fmt.Scan(&n)
	fmt.Scan(&c)
	for i = 1; i <= n; i++ {
		fmt.Scan(&x[i])
	}
	max = x[1] - x[2]
	for i = 2; i < n; i++ {
		if x[i]-x[i+1] > max {
			max = x[i] - x[i+1]
		}
	}

	max = max - c
	if max < 0 {
		max = 0
	}
	fmt.Println(max)
}


//https://codeforces.com/contest/385/problem/A

package main

import (
	"fmt"
	"log"
)

func main() {
	var n, c int
	_, err := fmt.Scan(&n, &c)
	if err != nil {
		log.Fatal(err)
	} else {
		days := make([]int, n)
		for i := 0; i < n; i++ {
			_, err := fmt.Scan(&days[i])
			if err != nil {
				log.Fatal(i, err)
			}
		}
		fmt.Println(findMaxProffit(c, days))
	}
}

func findMaxProffit(berriesCost int, days []int) int {
	maxDiff := 0
	for i := 0; i < len(days)-1; i++ {
		left := days[i]
		right := days[i+1]
		currentDiff := left - right
		if currentDiff > maxDiff {
			maxDiff = currentDiff
		}
	}
	res := maxDiff - berriesCost

	if res > 0 {
		return res
	}
	return 0
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var cupsCount, volumeOfCup int

	fmt.Fscan(reader, &cupsCount, &volumeOfCup)

	var friendsCount = cupsCount - 1
	cupsVolume := make([]int, cupsCount)

	for i := 0; i < cupsCount; i++ {
		fmt.Fscan(reader, &cupsVolume[i])
	}

	sort.Ints(cupsVolume)

	var amount = 0
	for i := 0; i < friendsCount; i++ {
		amount += cupsVolume[i]
	}

	if amount > volumeOfCup {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}


package main

import "fmt"

func main() {
    var n,s,a int
    fmt.Scan(&n,&s)
    max, total := 0, 0
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        total += a
        if max < a { max = a }
    }
    total -= max
    if total <= s { fmt.Println("YES") } else { fmt.Println("NO") }
}


package main

import (
	"fmt"
)

func main() {
	var n,m,a int
	max:=-10000
	s:=0
	fmt.Scan(&m,&n)
	for i:=0;i<m;i++ {
		fmt.Scan(&a)
		if a>max {
			max=a
		}
		s+=a
	}
	if s-max<=n {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

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

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

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

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

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

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

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

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

var scanner *bufio.Scanner

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

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

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

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


package main

import (
  "fmt"
  "bufio"
  "os"
  "strconv"
  "strings"
  /*
  "sort"
  "math"
  */
)

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

  var fields = [3][3][3]string{}
  for i := 0; i < 3; i++ {
    for j := 0; j < 3; j++ {
      for k := 0; k < 3; k++ {
        scanner.Scan()
        fields[i][k][j] = scanner.Text()
      }
    }
  }
  row := ReadInt32()
  col := ReadInt32()
  row = (row - 1) % 3
  col = (col - 1) % 3
  flag := false
  for i := 0; i < 3; i++ {
    if strings.Contains(fields[row][col][i], ".") {
      flag = true
    }
    fields[row][col][i] = strings.Replace(fields[row][col][i], ".", "!", -1)
  }

  if !flag {
    for i := 0; i < 3; i++ {
      for j := 0; j < 3; j++ {
        for k := 0; k < 3; k++ {
          fields[i][j][k] = strings.Replace(fields[i][j][k], ".", "!", -1)
        }
      }
    }
  }

  for i := 0; i < 3; i++ {
    for j := 0; j < 3; j++ {
      for k := 0; k < 3; k++ {
        fmt.Printf("%s ", fields[i][k][j])
      }
      fmt.Printf("\n")
    }
    fmt.Printf("\n")
  }
}

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

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

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


package main

import "fmt"

func fillBigCell(x int, y int, board [][]rune) int {
	count := 0
	for i := x * 3; i < x*3+3; i++ {
		for j := y * 3; j < y*3+3; j++ {
			coox, cooy := i+x, j+y
			if board[coox][cooy] == '.' {
				board[coox][cooy] = '!'
				count++
			}
		}
	}

	return count
}

func main() {
	board := make([][]rune, 11)
	for i := 0; i < 11; i++ {
		board[i] = make([]rune, 11)

		if i != 3 && i != 7 {
			for j := 0; j < 11; j++ {
				fmt.Scanf("%c", &board[i][j])
			}
		}
		fmt.Scanf("\n")
	}
	var lastX, lastY int
	fmt.Scanf("%d%d", &lastX, &lastY)

	bigCellX := (lastX - 1) % 3
	bigCellY := (lastY - 1) % 3

	count := fillBigCell(bigCellX, bigCellY, board)
	if count == 0 {
		for i := 0; i < 11; i++ {
			for j := 0; j < 11; j++ {
				if board[i][j] == '.' {
					board[i][j] = '!'
				}
			}
		}
	}

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

		if i != 3 && i != 7 {
			for j := 0; j < 11; j++ {
				fmt.Printf("%c", board[i][j])
			}
		}
		fmt.Println()
	}
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	word := "CODEFORCES"

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

	if strings.HasSuffix(s, word) {
		fmt.Println("YES")
		return
	}
	i := 0
	for ; i < len(s) && i < len(word); i++ {
		if s[i] != word[i] {
			break
		}
	}

	if strings.HasSuffix(s, word[i:]) {
		fmt.Println("YES")
		return
	}

	fmt.Println("NO")
}


package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	size := len(s)
	extra := size - len("CODEFORCES")
	if extra < 0 {
		fmt.Println("NO")
		return
	}
	for i := 0; i <= size-extra; i++ {
		x := s[:i] + s[i+extra:]
		if x == "CODEFORCES" {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	word := "CODEFORCES"

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

	i := 0
	for ; i < len(s) && i < len(word); i++ {
		if s[i] != word[i] {
			break
		}
	}

	if strings.HasSuffix(s, word[i:]) {
		fmt.Println("YES")
		return
	}

	fmt.Println("NO")
}


package main

import "fmt"

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

	cnt := 0

	for {
		if a < 1 || b < 2 || c < 4 {
			break
		}

		cnt++

		a -= 1
		b -= 2
		c -= 4
	}

	fmt.Println(7 * cnt)
}


package main

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

func getmin(a, b, c int) int {
	if a <= b && a <= c {
		return a
	}
	if b <= a && b <= c {
		return b
	}
	if c <= a && c <= b {
		return c
	}
	return a
}
func main() {
	var a, b, c int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &a, &b, &c)
	b /= 2
	c /= 4
	min := getmin(a, b, c)
	fmt.Println(min * 7)
}


package main

import (
    "fmt"
)

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

func main()  {
    var (
        a uint16
        b uint16
        c uint16
    )

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

    k := min(a, min(b / 2, c / 4))

    fmt.Printf("%v\n", 7*k)
}


package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	str, _, _ := r.ReadLine()
	fmt.Print(getLongestLen(string(str)))
}

func getLongestLen(str string) int {
	if !isPalindrome(str) {
		return len(str)
	}
	if isOneLetter(str) {
		return 0
	}
	return len(str)-1
}

func isPalindrome(str string) bool {
	for i := 0; i <= (len(str)-1) / 2; i++ {
		if str[i] != str[len(str)-1-i] {
			return false
		}
	}
	return true
}

func isOneLetter(str string) bool {
	for i := 1; i < len(str); i++ {
		if str[0] != str[i] {
			return false
		}
	}
	return true
}