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

var notes = []string{ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#",
                      "A", "B", "H" }

func position(a string) int {
  for i := 0; i < 12; i++ {
    if notes[i] == a {
      return i
    }
  }
  return -1
}

func distance(a, b string) int {
  i, j := position(a), position(b)
  if i <= j {
    return j-i
  } else {
    return 12+j-i
  }
  return -1
}

func kind(a, b, c string) string {
  x, y := distance(a, b), distance(b, c)
  if x == 4 && y == 3 {
    return "major"
  } else if x == 3 && y == 4 {
    return "minor"
  }
  return "strange"
}

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

  x, y, z := getS(), getS(), getS()
  permutations := [][]string{
      []string{ x, y, z },
      []string{ x, z, y },
      []string{ y, x, z },
      []string{ y, z, x },
      []string{ z, x, y },
      []string{ z, y, x },
    }
  for _, p := range permutations {
    s := kind(p[0], p[1], p[2])
    if s != "strange" {
      writer.WriteString(fmt.Sprintf("%s\n", s))
      return
    }
  }
  writer.WriteString("neither\n")
}


package main
import "fmt"
func main()
{
    var a int
    fmt.Scanf("%a", &a)
    fmt.Println(a / 2520)
}


package main
import "fmt"
func main() {
    var a int64
    fmt.Scanf("%lld", &a)
    fmt.Println(a / 2520)
}


package main

import (
	"fmt"
)

func main() {
	x := int64(8 * 9 * 5 * 7)
	var n int64
	fmt.Scan(&n)
	var i = int64(0)

	for ; i*x < n; i = i*i + 1 {
	}

	for ; i*x > n; i /= 2 {
	}

	for ; i*x < n; i++ {
	}
	fmt.Println(i - 1)
}


package main

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

/* solution */

func solve() {
	a, b, c := readInt(), readInt(), readInt()
	min := a
	if b < min {
		min = b
	}
	if c < min {
		min = c
	}
	printInt(min + 1)
}

/* stubs */

func main() {

	var f *os.File
	if runtime.GOROOT() == "C:\\Soft\\Go" {
		f, _ = os.Open("input.txt")
		defer f.Close()
	} else {
		f = os.Stdin
	}

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

	reader = bufio.NewScanner(f)

	const maxCapacity = 1024 * 1024
	buf := make([]byte, maxCapacity)
	reader.Buffer(buf, maxCapacity)

	reader.Split(bufio.ScanWords)

	solve()

}

var reader *bufio.Scanner
var writer *bufio.Writer

func read() string {
	reader.Scan()
	return reader.Text()
}

func readInt() int {
	reader.Scan()
	ret, _ := strconv.Atoi(reader.Text())
	return ret
}

func print(s string) {
	writer.WriteString(s)
	writer.WriteString("\n")
}

func printInt(i int) {
	print(strconv.Itoa(i))
}

func printInt64(i int64) {
	print(strconv.FormatInt(i, 10))
}

func readInt64() int64 {
	reader.Scan()
	ret, _ := strconv.ParseInt(reader.Text(), 10, 64)
	return ret
}


package main

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

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

    var n, l, r int
    fmt.Fscan(in, &n, &l, &r)

    m1 := 0
    for i := 1; i <= l; i++ {
        m1 += i
    }
    m1 += n - l

    m2 := 1
    j := 1
    for i := 1; i < r; i++ {
        j *= 2
        m2 += j
    }
    m2 += (n - r) * j

    fmt.Fprintln(out, m1, m2)
}


package main

import (
	"fmt"
)

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

	min := make([]int, 3)
	max := make([]int, 3)

	for i := 0; i < 3; i++ {
		if _, err := fmt.Scanf("%d %d\n", &min[i], &max[i]); err != nil {
			return
		}
		if max[i] > n {
			max[i] = n
		}
	}

	var f, s, t int
	var ok bool = false

	for i := max[0]; i >= min[0]; i-- {
		ami := n - i - max[2]
		if ami < min[1] {
			ami = min[1]
		}
		amx := n - i - min[2]
		if amx > max[1] {
			amx = max[1]
		}
		for j := ami; j >= amx; j-- {
			k := n - i - j
			if k >= min[2] && k <= max[2] {
				f = i
				s = j
				t = k
				ok = true
				break
			}
		}
		if ok {
			break
		}
	}

	fmt.Printf("%d %d %d\n", f, s, t)
}


package main

import (
	"fmt"
)

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

	min := make([]int, 3)
	max := make([]int, 3)

	for i := 0; i < 3; i++ {
		if _, err := fmt.Scanf("%d %d\n", &min[i], &max[i]); err != nil {
			return
		}
		if max[i] > n {
			max[i] = n
		}
	}

	var f, s, t int
	var ok bool = false

	for i := max[0]; i >= min[0]; i-- {
		ami := n - i - max[2]
		if ami < 1 || ami > n-2 || ami < min[1] {
			ami = min[1]
		}
		amx := n - i - min[2]
		if amx < 1 || amx > n-2 || amx > max[1] {
			amx = max[1]
		}
		for j := amx; j >= ami; j-- {
			k := n - i - j
			if k >= min[2] && k <= max[2] {
				f = i
				s = j
				t = k
				ok = true
				break
			}
		}
		if ok {
			break
		}
	}

	fmt.Printf("%d %d %d\n", f, s, t)
}


package main

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

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

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

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 n int
	for I(&n) == nil {
		solve(n)
	}
	w.Flush()
}

func solve(n int) {
	var in [3][6]int
	var arr []int
	o := make(map[int]bool)
	o[0] = true
	for i := 0; i < n; i++ {
		for j := range in[i] {
			in[i][j] = readInt()
			if _, exists := o[in[i][j]]; !exists {
				arr = append(arr, in[i][j])
				o[in[i][j]] = true
			}
		}
	}
	for i := 0; i < 6; i++ {
		for j := 0; j < 6; j++ {
			for k := 0; k < 6; k++ {
				a := in[0][i]*100 + in[1][j]*10 + in[2][k]
				b := in[0][i]*100 + in[2][j]*10 + in[1][k]
				c := in[2][i]*100 + in[0][j]*10 + in[1][k]
				d := in[1][i]*100 + in[0][j]*10 + in[2][k]
				e := in[1][i]*100 + in[2][j]*10 + in[0][k]
				f := in[2][i]*100 + in[1][j]*10 + in[0][k]
				if _, exists := o[a]; !exists {
					arr = append(arr, a)
					o[a] = true
				}
				if _, exists := o[b]; !exists {
					arr = append(arr, b)
					o[b] = true
				}
				if _, exists := o[c]; !exists {
					arr = append(arr, c)
					o[c] = true
				}
				if _, exists := o[d]; !exists {
					arr = append(arr, d)
					o[d] = true
				}
				if _, exists := o[e]; !exists {
					arr = append(arr, e)
					o[e] = true
				}
				if _, exists := o[f]; !exists {
					arr = append(arr, f)
					o[f] = true
				}
				aa := in[0][i]*10 + in[1][j]
				bb := in[1][i]*10 + in[0][j]
				cc := in[0][i]*10 + in[2][j]
				dd := in[2][i]*10 + in[0][j]
				ee := in[2][i]*10 + in[1][j]
				ff := in[1][i]*10 + in[2][j]
				if _, exists := o[aa]; !exists {
					arr = append(arr, aa)
					o[aa] = true
				}
				if _, exists := o[bb]; !exists {
					arr = append(arr, bb)
					o[bb] = true
				}
				if _, exists := o[cc]; !exists {
					arr = append(arr, cc)
					o[cc] = true
				}
				if _, exists := o[dd]; !exists {
					arr = append(arr, dd)
					o[dd] = true
				}
				if _, exists := o[ee]; !exists {
					arr = append(arr, ee)
					o[ee] = true
				}
				if _, exists := o[ff]; !exists {
					arr = append(arr, ff)
					o[ff] = true
				}
			}
		}
	}
	sort.Ints(arr)
	if arr[0] != 1 {
		O("0\n")
		return
	}
	for i := range arr {
		if i+1 != arr[i] {
			O(i, "\n")
			return
		}
	}
	O(arr[len(arr)-1], "\n")
}


package main

import "fmt"

func main() {
	var n int
	var freq [10]int
	_, _ = fmt.Scanf("%d\n", &n)
	for i :=0; i < n; i++ {
		for j := 0; j < 6; j++ {
			var num int
			if j < 5 {
				_, _ = fmt.Scanf("%d", &num);
			} else {
				_, _ = fmt.Scanf("%d\n", &num);
			}
			freq[num]++
		}
	}
	for i := 1; i <= 999; i++ {
		temp := i
		var taken [3]int;
		var till = 0
		for temp > 0 {
			digit := temp % 10
			if freq[digit] > 0 {
				freq[digit]--;
				taken[till] = digit
			} else {
				fmt.Println(i - 1)
				return
			}
			till++
			temp /= 10
		}
		for j := 0; j < till; j++ {
			freq[taken[j]]++
		}
	}
	fmt.Println(999)
}


package main

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

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

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

	x, y, n := nextInt(), nextInt(), nextInt()
	var fi, fpre int64;

	if n == 1 {
		fi = int64(x)
	} else {
		fi = int64(y)
	}

	fpre = int64(x)

	for i := 3; i <= n; i++ {
		// println(fi, fpre)
		fi, fpre = fi - fpre, fi
		// println(fi, fpre)
	}

	fi = fi % 1000000007

	if fi < 0 {
		fi = 1000000007 + fi
	}

	println(fi)
}

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

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

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

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

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

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


package main

import (
	"fmt"
)

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

	an := fn(x, y, n)
	if an < 0 {
		fmt.Println(1000000007 - (-an % 1000000007))
	} else {
		fmt.Println(an % 1000000007)
	}
}

func fn(x, y, n int) int {
	if n == 1 {
		return x
	} else if n == 2 {
		return y
	} else if n == 3 {
		return y - x
	} else { // n > 3
		head := [3]int{y - x, x, y}
		pos := n % 3
		sign := 1
		if ((n-1)/3)%2 != 0 {
			sign = -1
		}
		return head[pos] * sign
	}
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var f1, f2, n int

	if scanner.Scan() {
		line := scanner.Text()

		fmt.Sscanf(line, "%d %d", &f1, &f2)

	}

	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)
	}

	fn := f2%1000000007 - f1%1000000007
	for i := 3; i <= n; i++ {
		fn, f2 = (fn-f2)%1000000007, fn%1000000007
	}

	for f2 < 0 {
		f2 += 1000000007
	}
	fmt.Println(f2)
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var f1, f2, n int

	if scanner.Scan() {
		line := scanner.Text()

		fmt.Sscanf(line, "%d %d", &f1, &f2)

	}

	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d", &n)
	}

	series := [7]int{-1, f1, f2, f2 - f1, -f1, -f2, f1 - f2}

	fn := series[n%6]

	modulo := fn % 1000000007
	for modulo < 0 {
		modulo += 1000000007
	}
	fmt.Println(modulo)
}


package main

import (
  "fmt"
  "strings"
)

var n int
var str string
func main() {
  fmt.Scanf("%d\n", &n)
  fmt.Scanf("%s", &str)
  ll := 2
  max_subs := 1
	for ll < n/2+1 {
	    subs := strings.Contains(str[ll:], str[0:ll])
	    if subs {
	      max_subs = ll
	    }
	    ll+=1
	}
	fmt.Println(n-max_subs+1)
}


package main

import (
	"fmt"
)

func main() {
	w, str, choice := 0, "", 0
	fmt.Scan(&w, &str)
	for i := 1; i <= w/2; i++ {
		if str[0:i] == str[i:2*i] {
			choice = i
		}
	}
	fmt.Println(w - choice + 1)
}


package main

import "fmt"

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


package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 2048 * 2048)
	n1, _ := strconv.ParseInt(readLine(reader), 2, 64)
	n2, _ := strconv.ParseInt(readLine(reader), 2, 64)
	fmt.Println(strconv.FormatInt(n1 ^ n2, 2))
}

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

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

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


package main

import(
	"fmt"
	"strconv"
)

func main() {
	var a string
	var b string
	fmt.Scanf("%s\n", b)
	fmt.Scanf("%s\n", a)
	val1, _ := strconv.ParseUint(a, 2, 32)
	val2, _ := strconv.ParseUint(b, 2, 32)
	val3 := val1 * val2

	ans := strconv.FormatUint(val3, 2)
	if len(ans) != len(a)+1 {
		fmt.Println("0" + ans)
	} else {
		fmt.Println(ans)
	}
}


package main

import (
	"os"
	"fmt"
)

func main() {
	var n, m string
	fmt.Fscan(os.Stdin, &n, &m)
	var r []byte
	carry := 0
	for i := len(n) - 1; i >= 0; i-- {
		acc := runeToInt(n[i]) + runeToInt(m[i]) + carry
		r = append(r, byte(acc % 2))
		carry = acc / 2
	}
	if carry == 1 { r = append(r, 1) }
	for i := len(r)-1; i >= 0; i-- {
		fmt.Print(r[i])
	}
}

func runeToInt(r byte) int {
	return int(r - '0')
}


package main

import "fmt"

func main() {
	var k, l, m, n, d int
	fmt.Scanf("%d\n%d\n%d\n%d\n%d", &k, &l, &m, &n, &d)
	var b = make([]bool, d, d)
	mult := 1
	for _, num := range []int{k, l, m, n} {
		mult = 1
		for ; mult*num <= d; mult++ {
			b[mult*num-1] = true
		}
	}
	count := 0
	for _, val := range b {
		if val {
			count++
		}
	}
	fmt.Println(count)
}


package main

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

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

	var s string
	Fscan(in, &s)
	c := 0
	for _, name := range []string{"Danil", "Olya", "Slava", "Ann", "Nikita"} {
		if strings.Index(s, name) >= 0 {
			c++
		}
	}
	if c == 1 {
		Fprintln(out, "YES")
	} else {
		Fprintln(out, "NO")
	}
}

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


package main

import (
	"fmt"
	"strings"
)

func main() {
	var friends = []string{"Danil", "Olya", "Slava", "Ann", "Nikita"}
	var (
		problems string
		count    int
	)
	fmt.Scan(&problems)

	for _, friend := range friends {
		if has := strings.Contains(problems, friend); has {
			count++
		}
		if count > 1 {
			fmt.Print("NO\n")
			return
		}
	}
	if count == 0 {
		fmt.Print("NO\n")
		return
	}
	fmt.Print("YES\n")
}


package main

import "fmt"

func Max( x, y int ) int { // math.Max() は問題を起こすらしい。。。
  if x > y {
    return x
  }
  return y
}

func main() {
	var N, K int
	fmt.Scan( &N, &K )
	var S string
	fmt.Scan( &S )
	ypfx := make( []int, N + 1, N + 1 ); // type, length, capacity
	npfx := make( []int, N + 1, N + 1 );
	qpfx := make( []int, N + 1, N + 1 );
	for i := 0; i < N; i++ { // seems like go does not support ++i.....
	  ypfx[ i + 1 ] = ypfx[ i ];
	  npfx[ i + 1 ] = npfx[ i ];
	  qpfx[ i + 1 ] = qpfx[ i ];
	  if( S[ i ] == 'Y' ) {
	    ypfx[ i + 1 ]++;
	  } else if( S[ i ] == 'N' ) {
	    npfx[ i + 1 ]++;
	  } else {
	    qpfx[ i + 1 ]++;
	  }
	}
	original_max := 0;
	for i := 0; i < N; i++ {
	  if( S[ i ] != 'N' ) { // syntax error: missing { after if clause えええええ
	    continue;
	  }
	  j := i;
	  for j < N && S[ j ] == 'N' { // while() はだめなんかい！！
	    j++;
	  }
	  original_max = Max( original_max, j - i );
	  i = j;
	}
	if( original_max > K ) {
	  fmt.Println( "NO" );
	  return;
	}
	for i := 0; i + K <= N; i++ { // i を左界とする長さ K の区間を調べる
	  if( ypfx[ i + K ] - ypfx[ i ] > 0 ) { // ええええ -> line: 34
	    continue;
	  }
	  if( i + K < N && S[ i + K ] == 'N' ) {
	    continue;
	  }
	  fmt.Println( "YES" );
	  return;
	}
	fmt.Println( "NO" );
}


package main

import "fmt"

func main(){
	var a,b,c,d,e int
	var ans=false
	fmt.Scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
	for i:=c;i<d;i++{
		if a<=i*e && i*e<=b{
			ans=true
		}
	}
	if ans{
		fmt.Printf("YES\n")
	} else{
		fmt.Printf("NO\n")
	}
}


package main

import (
	"fmt"
	"strings"
)

//func calc(first,second int){
//
//	for i:=1;i<1000000000;i++{
//		if i&1==1{
//			first -= i
//			if first<0{
//				fmt.Print( "Vladik")
//				return
//			}
//		}else{
//			second -= i
//			if second<0{
//				fmt.Print("Valera")
//				return
//			}
//		}
//	}
//	return
//}

func main(){
	set := make(map[string]bool)
	set["a"] = true
	set["e"] = true
	set["i"] = true
	set["o"] = true
	set["u"] = true

	var t int
	fmt.Scanln(&t)
	var ele string
	fmt.Scan(&ele)
	arr := make([]string,0)
	arr = append(arr,string(ele[0]))
	for i:=1;i<t;i++{
		temp := string(arr[len(arr)-1])
		if set[temp]==true && set[string(ele[i])]==true{
			continue
		}else{
			arr = append(arr,string(ele[i]))
		}
	}
	just := strings.Join(arr,"")
	fmt.Print(just)
}


package main

import (
	"fmt"
	"os"
)

func settest() (*os.File, *os.File) {
	f, err := os.Open("a.dat")
	if err != nil {
		panic(err)
	}

	oldStdin := os.Stdin
	os.Stdin = f

	return f, oldStdin
}

func main() {
	/*f, oldStdin := settest()
	defer f.Close()
	defer func() { os.Stdin = oldStdin }()*/

	var s string
	var n int
	fmt.Scan(&n)
	fmt.Scan(&s)

	m := map[byte]bool {
		'a': true,
		'e': true,
		'i': true,
		'o': true,
		'u': true,
	}

	var r []byte

	for i := 0; i < len(s); i++ {
		if i > 0 && m[s[i - 1]] && m[s[i]] {

		} else {
			r = append(r , s[i])
		}
	}

	fmt.Println(string(r))
}


package main

import (
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"strconv"
	"strings"

	log "github.com/Sirupsen/logrus"
)

func init() {
	log.SetLevel(log.ErrorLevel)
	log.Println("started")
}

// Case .
type Case struct {
	a, b, x, y, z int64
}

func solve(c Case, w io.Writer) {
	a := 2*c.x + c.y - c.a
	b := c.y + 3*c.z - c.b
	if a < 0 {
		a = 0
	}
	if b < 0 {
		b = 0
	}
	w.Write(([]byte)(fmt.Sprintf("%d\n", a+b)))
}

func parseInput(lines <-chan string, res chan<- Case) {
	for {
		ab1, ok := <-lines
		if !ok {
			close(res)
			return
		}
		ab := int64s(words(ab1))
		xyz := int64s(words(<-lines))
		res <- Case{ab[0], ab[1], xyz[0], xyz[1], xyz[2]}
	}
}

func int64s(w []string) []int64 {
	res := make([]int64, 0, len(w))
	for _, word := range w {
		i, err := strconv.ParseInt(word, 10, 64)
		if err != nil {
			panic(err)
		}
		res = append(res, i)
	}
	return res
}

func words(s string) []string {
	prep := strings.Split(s, " ")
	res := make([]string, 0, len(prep))
	for _, l := range prep {
		if len(l) > 0 {
			res = append(res, l)
		}
	}
	return res
}

func run() error {
	exp, err := ioutil.ReadFile("expected.txt")
	if err == nil {
		fmt.Println("--------- expected --------- ")
		fmt.Println((string)(exp))
		fmt.Println("--------- computed --------- ")
	}

	inData, err := ioutil.ReadAll(os.Stdin)
	//inData, err := ioutil.ReadFile("in.txt")
	if err != nil {
		return fmt.Errorf("read input: %s", err)
	}
	lines := make(chan string, 8)
	cases := make(chan Case, 8)
	go func() {
		for _, line := range strings.Split((string)(inData), "\n") {
			s := strings.TrimSpace(line)
			if len(s) > 0 {
				lines <- s
			}
		}
		close(lines)
	}()
	go parseInput(lines, cases)
	for c := range cases {
		solve(c, os.Stdout)
	}
	return nil
}

func main() {
	if err := run(); err != nil {
		log.Fatal(err)
	}
}


package main

import "fmt"

func main() {
    var yc, bc uint64
    var y,g,b uint64
    var yn, bn uint64
    fmt.Scan(&yc, &bc, &y, &g, &b)
    yn = 2*y + 1*g
    bn = 1*g + 3*b
    var total int
    if yn > yc {
        total += yn - yc
    }
    if bn > bc {
        total += bn - bc
    }
    fmt.Print(total)
}


package main
import "fmt"
func main(){
 var  yellowcris int64
var   bluecris   int64
var  yellowball int64
var   greenball   int64
var  blueball int64
  fmt.Scan(&yellowcris)
  fmt.Scan(&bluecris)
  fmt.Scan(&yellowball)
  fmt.Scan(&greenball)
  fmt.Scan(&blueball)
  // fmt.Print(yellowcris)
  // fmt.Print(bluecris)
  // fmt.Print(yellowball)
  // fmt.Print(greenball)
  // fmt.Print(blueball+yellowball)
  var totalcrris int64 = yellowcris+bluecris
  var predictecris int64 = 0
  predictecris += yellowball*2
  predictecris += greenball*2
  predictecris += blueball*3
  fmt.Print(predictecris-totalcrris)
}


package main
import (
	"fmt"
	//"sort"
)
func find(x int) int{
	t,k:=0,1
	for ;x>0; {
		if x%10==0 {
			t+= (x%10)*k
			k*= 10
		}
		x/=10
	}
	return t
}

func main() {
	var n,m,x,y int
	fmt.Scan(&n,&m)
	c:= n+m
	x=find(n)
	y=find(m)
	c=find(c)
	if x+y==c {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


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 reduce(x int) int {
  y := 0
  for x != 0 {
    y = 10*y + x%10
    x /= 10
  }
  return y
}

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

  a, b := getI(), getI()
  c := a + b
  result := "NO"
  if reduce(a) + reduce(b) == reduce(c) {
    result = "YES"
  }
  writer.WriteString(fmt.Sprintf("%s\n", result))
}


package main

import "fmt"

func main() {
	var x, y uint16
	fmt.Scanf("%d %d\n", &x, &y)
	if x%2 == 0 || y%2 == 0 {
		fmt.Println("Malvika")
	} else {
		fmt.Println("Akshat")
	}
}


package main

import(
	"fmt"
)

func main() {
	var n, m int
	fmt.Scanf("%d %d\n", &n, &m)
	if (n * m) % 2 == 1 {
		fmt.Println("Akshat")
	} else {
		fmt.Println("Malvika")
	}
}


package main

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

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

var n, m int

func main() {
	fmt.Fscan(reader, &n, &m)
	if n*m%2 == 0 {
		fmt.Println("Malvika")
	} else {
		fmt.Println("Akshat")
	}
}


package main
import ("fmt"
	"math")
func main(){
var inputSquare float64
var inputSquare2 float64
n, err := fmt.Scanf("%f\n", &inputSquare)
if err != nil || n != 1 {
    // handle invalid input
    fmt.Println(n, err)
}
c, err := fmt.Scanf("%f\n", &inputSquare2)
if err != nil || c != 1 {
    // handle invalid input
    fmt.Println(n, err)
}
var x int
	x = int(math.Min(inputSquare,inputSquare2))
	if x%2 == 0 {
		fmt.Println("Malvika")
	} else {
		fmt.Println("Akshat")
}
//fmt.Println(inputSquare,inputSquare2)
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var n, m, a float64
	_, err := fmt.Scanf("%f %f %f", &n, &m, &a)
	fmt.Println(math.Ceil(m/a) * math.Ceil(n/a))
}


func main() {
    var a int
    var m int
    var n int
    fmt.Scanf("%d %d %d", &m, &n, &a)
    // fmt.Println("m:",m)
    // fmt.Println("n:",n)
    // fmt.Println("a:",a)
    m = m/a
    n = n/a
    // m = int(float32(m/a) + 0.5)
    // n = int(float32(n/a) + 0.5)
    if m%a!=0 || m==0 {m++}
    if n%a!=0 || n==0 {n++}
    // fmt.Println(m)
    // fmt.Println(n)
    // fmt.Println(m*n)
    // fmt.Println("m:",m)
    // fmt.Println("n:",n)
    fmt.Println(m*n)
}


package main

import (
  "fmt"
)

func main(){
  var i, j, k int
  fmt.Scanf("%d %d %d\n", &i, &j, &k)
  var int n = i/k
  var int m = j/k
  if i%k!=0{
    n++
  }
  if j%k!=0{
    m++
  }
  fmt.Println(n*m)
}


package main

import "fmt"

func main() {
	var n,m,a int
    	fmt.Scanf("%d", &n,&m,&a);
	fmt.Println("%d",(n/a+1)*(m/a+1));
}


package main

import "fmt"

func round(n float64) int {
	if  n1-float64(n2) < 0.00000001 {
		return int(n)
	} else {
		return int(n) +1
	}
}
func main() {
	var n, m, a int
	fmt.Scanf("%d,%d,%d", &n, &m, &a)
	fmt.Println(round(float64(n)/float64(a)) * round(float64(m)/float64(a)))
}


package main

import "fmt"

func main() {
	var m, n, a uint64
	fmt.Scanf("%d %d %d", m, n, a)

	total := m * n
	result := total / a

	fmt.Println(result)
}


package main

import ( "fmt" )

func main () {

	var n, nn, m, a, i int

	fmt.Scan ( &n, &m, &a )

	nn = n

	for m > 0 {

		for nn > 0 { nn -= a ; i++ }
		nn = n ; m -= a

	}

	fmt.Println ( i )

}


// hello
package main

import (
    "fmt"
    "strings"
)

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

    fmt.Print(strings.ToUpper(str[0:1]))
    len := len(str)
    if len > 1 {
        fmt.Print(strings.ToLower(str[1:len]))
    }
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	a131()
}

func a131() {
	var s, newS string
	fmt.Scan(&s)
	for i := range s {
		switch {
		case s[i] > 96:
			if i == 0 {
				newS += string(s[i] - 32)
			}
			if i == 1 {
				fmt.Println(s)
			}
		case s[i] < 91:
			newS += string(s[i] + 32)
		default:
			newS += string(s[i])
		}
	}
	fmt.Println(newS)
}


package main

import (
	"fmt"
)

func main() {
	var KBD = []string{"qwertyuiop", "asdfghjkl;", "zxcvbnm,./"}

	var kbd [3][10]rune
	for i := range KBD {
		for j, c := range KBD[i] {
			kbd[i][j] = c
		}
	}
	L, R, shift := make(map[rune]rune), make(map[rune]rune), make(map[rune]rune)
	// make L
	for i := range KBD {
		for j := range KBD[i] {
			if j == 9 {
				break
			}
			L[kbd[i][j]] = kbd[i][j+1]
		}
	}
	// make R
	for i := range KBD {
		for j := range KBD[i] {
			if j == 0 {
				continue
			}
			R[kbd[i][j]] = kbd[i][j-1]
		}
	}
	var d, mole string
	fmt.Scanln(&d)
	if d == "R" {
		shift = R
	} else {
		shift = L
	}
	fmt.Scanln(&mole)
	fmt.Println(mole)
	for _, c := range mole {
		fmt.Printf(string(shift[c]))
	}
	fmt.Println()
}


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{}
	f := func() {
		for _, v := range a {
			if i := sort.SearchInts(dp, v+1); i < len(dp) {
				dp[i] = v
			} else {
				dp = append(dp, v)
			}
		}
	}
	for i := 0; i < 5 && t > 0; i++ {
		t--
		cur := len(dp)
		f()
		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"
	"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) }


package main

import "fmt"

func Process(a []int64) (int64, []int64) {
	var m = map[int64]bool{}
	var r = make([]int64, 0)

	for i := len(a) - 1; i >= 0; i-- {
		if _, exist := m[a[i]]; !exist {
			r = append([]int64{a[i]}, r...)
		}

		m[a[i]] = true
	}

	return int64(len(r)), r
}

func main() {
	var n int64

	fmt.Scanln(&n)

	var a, _ = ScanN(n)

	var r1, r2 = Process(a)

	fmt.Println(r1)
	PrintSlice(r2)
}

func ScanN(n int64) ([]int64, error) {
	in := make([]int64, n)
	for i := range in {
		_, err := fmt.Scan(&in[i])
		if err != nil {
			return in[:i], err
		}
	}
	return in, nil
}

func PrintSlice(a []int64) {
	for i := 0; i < len(a); i++ {
		if i == len(a)-1 {
			fmt.Print(a[i])
		} else {
			fmt.Print(a, " ")
		}
	}
}


package main

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

func Init() {
}

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

	seen := make(map[int]bool)
	good := make([]bool, N)
	for i := N - 1; i >= 0; i-- {
		if !seen[A[i]] {
			seen[A[i]] = true
			good[i] = true
		}
	}

	for i, v := range A {
		if good[i] {
			io.Printf("%d ", v)
		}
	}
	io.Println()
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


package main

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

type edge struct {
	id int
	n1 *node
	n2 *node
	w int
	left int
}

type node struct {
	id int
	edges []*edge
}
var edges []*edge
var nodes []*node
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	q := 1
	//fmt.Fscanf(in, "%d\n", &q)
	for ii := 0; ii < q; ii++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		f := make([][][]int, n+1) // f[i][j] filled in the first i elements, remaining j odd number
		a := make([]int, n+1)
		for i := 1; i <= n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
		}
		fmt.Fscanf(in, "\n")
		for i := 0; i < n + 1; i++ {
			f[i] = make([][]int, n+1)
			for j := 0; j < n + 1; j++ {
				f[i][j] = make([]int, 2)
				f[i][j][0] = -1
				f[i][j][1] = -1
			}
		}
		if a[0] == 0 {
			f[1][(n+1)/2-1][1] = 0
			if n > 1 {
				f[1][n/2-1][0] = 0
			}
		}
		for i := 2; i <= n; i++ {
			for j := 0; j < n; j++ {
				if a[i] == 0 {
					f[i][j][0] = min(f[i-1][j][0], f[i-1][j][1] + 1)
					f[i][j][1] = min(f[i-1][j+1][0] + 1, f[i-1][j+1][1])
				} else if a[i] % 2 == 0 {
					f[i][j][0] = min(f[i-1][j][0], f[i-1][j][1] + 1)
				} else {
					f[i][j][1] = min(f[i-1][j+1][0]+1, f[i-1][j+1][1])
				}
			}
		}
		fmt.Fprintf(out, "%d\n", min(f[n][0][0], f[n][0][1]))
	}
	return
}

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

func solve(e *edge, from *node) int {
	n1 := e.n1
	n2 := e.n2
	cur := 0
	if n1 != from {
		cur += solveNode(n1, e)
		e.left = cur
	}
	if n2 != from {
		cur += solveNode(n2, e)
		e.left = cur
	}
	return e.left
}

func solveNode(n *node, from *edge) int {
	if len(n.edges) == 1 && n.edges[0] == from{
		return 1
	}
	cur := 1
	for _, e := range n.edges {
		if e != from {
			cur += solve(e, n)
		}
	}
	return cur
}


package main

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

type edge struct {
	id int
	n1 *node
	n2 *node
	w int
	left int
}

type node struct {
	id int
	edges []*edge
}
var edges []*edge
var nodes []*node
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	q := 1
	//fmt.Fscanf(in, "%d\n", &q)
	for ii := 0; ii < q; ii++ {
		n := 0
		fmt.Fscanf(in, "%d\n", &n)
		f := make([][][]int, n+1) // f[i][j] filled in the first i elements, remaining j odd number
		a := make([]int, n+1)
		for i := 1; i <= n; i++ {
			fmt.Fscanf(in, "%d", &a[i])
		}
		fmt.Fscanf(in, "\n")
		for i := 0; i < n + 1; i++ {
			f[i] = make([][]int, n+1)
			for j := 0; j < n + 1; j++ {
				f[i][j] = make([]int, 2)
				f[i][j][0] = -1
				f[i][j][1] = -1
			}
		}
		if a[0] == 0 {
			f[1][(n+1)/2-1][1] = 0
			f[1][n/2-1][0] = 0
		}
		for i := 2; i <= n; i++ {
			for j := 0; j < n; j++ {
				if a[i] == 0 {
					f[i][j][0] = min(f[i-1][j][0], f[i-1][j][1] + 1)
					f[i][j][1] = min(f[i-1][j+1][0] + 1, f[i-1][j+1][1])
				} else if a[i] % 2 == 0 {
					f[i][j][0] = min(f[i-1][j][0], f[i-1][j][1] + 1)
				} else {
					f[i][j][1] = min(f[i-1][j+1][0]+1, f[i-1][j+1][1])
				}
			}
		}
		fmt.Fprintf(out, "%d\n", min(f[n][0][0], f[n][0][1]))
	}
	return
}

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

func solve(e *edge, from *node) int {
	n1 := e.n1
	n2 := e.n2
	cur := 0
	if n1 != from {
		cur += solveNode(n1, e)
		e.left = cur
	}
	if n2 != from {
		cur += solveNode(n2, e)
		e.left = cur
	}
	return e.left
}

func solveNode(n *node, from *edge) int {
	if len(n.edges) == 1 && n.edges[0] == from{
		return 1
	}
	cur := 1
	for _, e := range n.edges {
		if e != from {
			cur += solve(e, n)
		}
	}
	return cur
}


package main

import (
	"fmt"
	"strconv"
)

func change(first bool, digit string) string {
	n, _ := strconv.Atoi(digit)
	if n <= 4 {
		return digit
	}
	if first && n == 9 {
		return digit
	}
	n = 9 - n
	return strconv.Itoa(n)
}

func main() {
  digits := ""
  ans := ""
  fmt.Scanf("%s\n", &digits)
  if (len(digits) == 1) {
  	fmt.Println(change(false, digits))
  	return
  }
  for i := 0; i < len(digits); i ++ {
  	ans += change(i == 0, digits[i:i+1])
  }
  fmt.Println(ans)
}


package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	a := s.Text()
	var c int
	for i:=0; i<len(a) ; i++ {
		b := a[i] - '0'
		if 9 -b < b {
			c = int(9-b)
		} else {
			c=int(b)
		}
		fmt.Print(c)
	}
}


package main

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

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

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

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

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

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

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


package main

import "fmt"

func minInvert(t int) int {
	inv := 9 - t
	if t < inv {
		return t
	}
	return inv
}

func main() {
	var S string
	fmt.Scan(&S)
	for _, r := range S {
		t := int(r - '0')
		fmt.Printf("%d", minInvert(t))
	}
	fmt.Println()
}


package main

import (
	"fmt"
)

func main() {
	var d, cnt, index int
	var st, st1 string
	fmt.Scanln(&d)

	for d > 0 {
		fmt.Scanln(&st)
		fmt.Scanln(&st1)
		a := make([]rune, 0)
		b := make([]rune, 0)

		for _, y := range st {
			a = append(a, y)
		}
		if len(st) > len(st1) {
			cnt = 5
		}

		for _, y := range st1 {
			if len(b) > len(a) {
				cnt = 5
				break
			}
			if (index <= len(a)-1) && (a[index] == y) {
				b = append(b, y)
				index++
				continue
			} else if (len(b) > 1) && (y == b[len(b)-1]) {
				continue
			} else {
				cnt = 5
				break
			}
		}

		if cnt == 5 {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}
		cnt = 0
		index = 0

		d--
	}
}


package main

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

var scanner *bufio.Scanner

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

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

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

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

	del := 0
	start := 0
	for cur := 0; cur < N; cur++ {
		if cur+1 == N || data[cur]+1 != data[cur+1] {
			rem := cur - start - 1
			if cur+1 < N {
				rem--
			}
			if rem > 0 {
				del += rem
			}
			start = cur
		}
	}
	if len(data) > 1 {
		if data[0] == 1 && data[1] == 2 {
			del += 1
		}
		if data[len(data)-1] == 1000 && data[len(data)-2] == 999 {
			del += 1
		}
	}
	fmt.Println(del)
}


// Group the consecutive elements
// When a group start with 1 or end with 1000, it can contribute "length - 1" items.
// "length - 2" otherwise.
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	g, cur := [][]int{[]int{-1}}, 0

	for i := 0; i < n; i++ {
		scanner.Scan()
		num, _ := strconv.Atoi(scanner.Text())
		if g[cur][len(g[cur])-1] == num-1 {
			g[cur] = append(g[cur], num)
		} else {
			g = append(g, []int{num})
			cur++
		}
	}

	sum := 0
	for _, v := range g {
		if len(v) < 2 {
			continue
		}
		if (v[0] == 1) || (v[len(v)-1] == 1000) {
			sum += len(v) - 1
		} else {
			sum += len(v) - 2
		}
	}
	fmt.Println(sum)
}


package main

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

func fastGetInt(b []byte) int64 {
	neg := false
	if b[0] == '-' {
		neg = true
		b = b[1:]
	}
	var n int64
	n = 0
	for _, v := range b {
		n = n*10 + int64(v-'0')
	}
	if neg {
		return -n
	}
	return n
}

//========== Implement Algorithm =======================
func solution(x int64) int64 {
	var temp int64
	temp = 1
	var count int64
	count = 0
	for temp < x/2 {
		temp = temp * 2
		count++
	}
	if temp*2 == x {
		return 0
	}
	if temp%2 == 1 {
		count++
	}
	return count
}

func main() {

	scanner := bufio.NewScanner(os.Stdin)

	//================== Variables used ====================
	var x, ret int64
	//======================================================

	//============== Get return value from File ============
	if len(os.Args) >= 2 {

		file, err := os.Open(os.Args[1])
		if err != nil {
			log.Fatalf("failed opening file: %s", err)
		}
		scanner = bufio.NewScanner(file)
		defer file.Close()

	}
	scanner.Split(bufio.ScanWords)
	//======================= I/O ==========================
	scanner.Scan()
	x = fastGetInt(scanner.Bytes())

	//======================================================
	ret = solution(x)
	//==================== OUTPUT ==========================

	fmt.Print(ret + 1)
}


package main

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

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

func findMinBacteries(n float64) int {
	c := 0
	for p := 0; n > 0; p++ {
		s := math.Pow(2, float64(p))
		if s > n {
			n -= math.Pow(2, float64(p-1))
			p = 0
			c++
		} else if s == n {
			n = 0
			c++
		}
	}
	return c
}


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
    }
    fmt.Println(a)
}


package main

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

var N, M int

func main() {
	fsc := NewFastScanner()
	N, M = fsc.NextInt(), fsc.NextInt()
	var left, right int
	left = M - 1
	right = N - M
	fmt.Println(left, right)
	if right > left {
		fmt.Println(M + 1)
	} else if right <= left {
		fmt.Println(M - 1)
	}

}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) 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 *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

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


package main

import "fmt"

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


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 n == m{
		fmt.Println(m)
	}
	else if(u > l){
		fmt.Println(m+1)
	}else{
		fmt.Println(m-1)
	}
}


package main

import "fmt"
import "strconv"

func main(){
	var bfuck string
	fmt.Scan(&bfuck)
	var size string
	for i:=0; i<len(bfuck); i++ {
		if string(bfuck[i]) == ">" {
			size += "1000"
		}
		if string(bfuck[i]) == "<" {
			size += "1001"
		}
		if string(bfuck[i]) == "+" {
			size += "1010"
		}
		if string(bfuck[i]) == "-" {
			size += "1011"
		}
		if string(bfuck[i]) == "." {
			size += "1100"
		}
		if string(bfuck[i]) == "," {
			size += "1101"
		}
		if string(bfuck[i]) == "[" {
			size += "1110"
		}
		if string(bfuck[i]) == "]" {
			size += "1111"
		}
	}
	var hasil int64
	hasil, _ = strconv.ParseInt(size, 2, 64)
	hasil = hasil % 1000003
	fmt.Println(hasil)
}


package main

import "fmt"

func main() {
    var n int64
    fmt.Scanf("%d", &n)
    r := int64(0)
    for i := 2; i < n/2; i+=2 {
        r += 1
    }
    fmt.Println(r)
}


package main

import "fmt"

func solve(n int64) int64 {
    if n < 6 {
        return 0
    }
    if n == 6 {
        return 1
    }
    if n%4 == 0 {
        return n/4 - 1
    }
    return n/4
}

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


package main

import "fmt"
import "math"

var n float64

func main() {
        fmt.Scanln(&n)
        if int(n)%2 == 0 {
                fmt.Println(0)
                return
        }
        ans := int(math.Ceil(((n / 2) / 2)))
        ans -= 1
        fmt.Println(ans)
}


package main

import (
	"fmt"
)

func main() {
	var n, o int
	fmt.Scanln(&n)
	if n%4 == 0 {
		o = n/4 - 1
	} else {
		o = n / 4
	}
	fmt.Println(o)
}


package main

import "fmt"

func main() {
	n, x, y, c := 0, 0, 0, int64(0)
	fmt.Scan(&n, &x, &y, &c)
	r,l,m:=n*2+1,-1,0
	for r-l>1{
		m = int((int64(r)+int64(l))/2)
		tiles:=count(n,x,y,m)
		if (tiles<c) {
			l=m
		} else {
			r=m
		}
	}
	fmt.Print(r)
}

func count(N,X,Y,T int) int64 {
	n,x,y,t:=int64(N),int64(X),int64(Y),int64(T)
	out := 2*t*t + 2*t + 1
	out -= sq(t-dist(x,y,x,0))
	out -= sq(t-dist(x,y,x,n))
	out -= sq(t-dist(x,y,n,y))
	out -= sq(t-dist(x,y,0,y))
	h:=t-dist(x,y,0,-1)
	if (h>0) {out+=(sq(h)+h)/2}
	h=t-dist(x,y,n,-1)
	if (h>0) {out+=(sq(h)+h)/2}
	h=t-dist(x,y,0,n+1)
	if (h>0) {out+=(sq(h)+h)/2}
	h=t-dist(x,y,n,n+1)
	if (h>0) {out+=(sq(h)+h)/2}
	return out
}

func sq(n int64) int64 {if (n<0) {return 0}else{return n*n}}
func dist(x1,y1,x2,y2 int64) int64 {return abs(x1-x2)+abs(y1-y2)}
func abs(n int64) int64 {if (n<0) {return -n}else{return n}}


package main

import (
	"fmt"
)

func main() {
	var n int
	var a []int
	var flag int = 0
	var ok bool = true
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	for i := 1; i < n; i++ {
		switch {
		case a[i-1] < a[i] && flag > 0:
			ok = false
		case a[i-1] == a[i] && flag == 0:
			flag = 1
		case a[i-1] == a[i] && flag > 1:
			ok = false
		case a[i-1] > a[i] && flag < 2:
			flag = 2
		}
	}
	if ok {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import (
	"fmt"
)

func check(nums []int) bool {
	i := 1

	for ; i < len(nums); i++ {
		if nums[i] <= nums[i-1] {
			break
		}
	}

	// fmt.Println("Stop increasing ", i)

	for ; i < len(nums); i++ {
		if nums[i] > nums[i-1] {
			return false
		}

		if nums[i] < nums[i-1] {
			break
		}
	}

	// fmt.Println("Stop constant ", i)

	if i == 1 && len(nums) != 1 {
		return false
	}

	for ; i < len(nums); i++ {
		if nums[i] >= nums[i-1] {
			return false
		}
	}

	// fmt.Println("Stop decreasing ", i)
	return i == len(nums)
}

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

	nums := make([]int, t)

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

	// fmt.Println(nums)
	if check(nums) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

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

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


package main

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

func solve() {
	n := readInt()
	a := make([]int, n)
	freq := make([]int, 101)
	start := make([]int, 101)
	end := make([]int, 101)
	up := 0
	for i := 0; i < n; i++ {
		a[i] = readInt()
		if freq[a[i]] == 0 {
			start[a[i]] = i
		}
		freq[a[i]]++
		end[a[i]] = i
		up = max(up, a[i])
	}
	index := up
	for i := 1; i <= start[index]; i++ {
		if a[i] <= a[i-1] {
			fmt.Println("NO")
			return
		}
	}
	for i := start[index]; i <= end[index]; i++ {
		if a[i] != index {
			fmt.Println("NO")
			return
		}
	}
	for i := end[index] + 1; i < len(a); i++ {
		if a[i] >= a[i-1] {
			fmt.Println("NO")
			return
		}
	}
	fmt.Println("YES")
}

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
}

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


package main

import "fmt"

func main() {
    var n, k int
    fmt.Scan(&n, &k)
    if (n/k) & 2 == 0 {
        fmt.Print("NO")
    } else {
        fmt.Print("YES")
    }
}


package main

import "fmt"

func main() {
	var n, k int64
	fmt.Scanf("%ld %ld", &n, &k)
	ret := false

	if k == n {
		ret = true
	} else {
		div := n / k

		if div%2 == 0 {
			ret = false
		} else {
			ret = true
		}
	}

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


package main

import "fmt"
import "math/big"

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

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


package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	var s string
	fmt.Scan(&s)
	ans := 0
	just_max := 0
	for i := 0; i + k  - 1 < n; i++ {
	  was := 0
	  for j := i; j < i + k; j++ {
	    if s[j] == 'Y' {
	      was = 1
	    }
	  }
	  if was == 0 {
	    if i + k >= n || s[i + k] != 'N' {
	      ans = 1
	    }
	  }
	}
	if ans == 0 {
	  fmt.Println("NO")
	} else {
	  for i := 0; i < n; i++ {
	    cur := 0
	    for j := i; j < n; j++ {
	      if s[j] == 'N' {
	        cur++
	        if just_max < cur {
	          just_max = cur
	        }
	      } else {
	        cur = 0
	      }
	    }
	  }
	  if just_max > k {
	    fmt.Println("NO")
	  } else {
	    fmt.Println("YES")
	  }
	}
}


package main

import (
    "fmt"
)

func main() {
    var pos [2]int
    Loop:
    for j := 1; j <= 5; j++ {
        var l string
        fmt.Scanf("%d", &l)
        ss := strings.Split(l, " ")
        for i, s := range ss {
            if s == "1" {
                pos[0] = i+1
                pos[1] = j
                beak Loop
            }
        }
    }
}


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

func p263a(in io.Reader) int {
	abs := func(x int) int {
		if x < 0 {
			return -x
		}
		return x
	}
	n := 5
	i, j := 0, 0
	for {
		v := 0
		fmt.Fscanf(in, "%d", &v)
		if v == 1 {
			break
		}
		i++
	}
	// manhatten distance
	i, j = i/n, i%n
	if j == 0 {
		j = 5
	}
	x, y := abs(i-3), abs(j-3)
	return x + y
}

func main() {
	fmt.Println(p263a(os.Stdin))
}


package main

import (
	"fmt"
)

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

		var line string
		fmt.Scanln(&line)

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

	fmt.Println("YES")
}


package main

import "fmt"

func isVowel(c byte) bool {
    if c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' {
        return true
    } else {
        return false
    }
}

func main() {
    var s string
    fmt.Scanf("%s", &s)
    succ := true
    for i, c := range []byte(s) {
        cur := true
        if !isVowel(c) {
            if c == 'n' {
                cur = (i == len(s) - 1) || isVowel(s[i+1])
            } else {
                cur = (i < len(s) - 1) && isVowel(s[i+1])
            }
        }
        if !cur {
            succ = false
        }
    }
    if succ {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}


package main

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

func readLine(reader *bufio.Reader) string {
	line, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(line), "\r\n")
}

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

func main() {
	vowels := make(map[rune]int)
	var l rune
	for l = 'a'; l <= 'z'; l++ {
		if l == 'a' {
			vowels[l] = -1
		}
		if l == 'e' {
			vowels[l] = -1
		}
		if l == 'i' {
			vowels[l] = -1
		}
		if l == 'o' {
			vowels[l] = -1
		}
		if l == 'u' {
			vowels[l] = -1
		}
	}

	isBerlanese := true
	var word string
	fmt.Scanf("%s", &word)

	if len(word) > 1 {
		for i := 0; i < len(word)-1; i++ {
			if isBerlanese == false {
				break
			}
			letter := rune(word[i])
			nextLetter := rune(word[i+1])
			if letter == 'n' {
				continue
			}

			_, isVowel := vowels[letter]
			if isVowel == true {
				continue
			} else {
				_, nextIsVowel := vowels[nextLetter]
				if nextIsVowel == false {
					isBerlanese = false
					break
				}
			}
		}
	} else {
		letter := rune(word[0])
		if letter == 'n' {
			isBerlanese = true
		} else if _, V := vowels[letter]; V == true {
			isBerlanese = true
		} else {
			isBerlanese = false
		}
	}
	if isBerlanese == true {
		fmt.Printf("%s\n", "YES")
	} else {
		fmt.Printf("%s\n", "NO")
	}
}


package main

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

func main() {
	sc := NewScanner()

	S := sc.NextLine()

	flag := false
	for i := 0; i < len(S); i++ {
		switch S[i] {
		case 'a', 'i', 'u', 'e', 'o', 'n':
			flag = false
		default:
			if flag {
				fmt.Println("NO")
				return
			}
			flag = true
		}
	}
	if flag {
		fmt.Println("NO")
		return
	}
	fmt.Println("YES")

}

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

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

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

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

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

	return mp
}

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


package main

import "fmt"

func main() {
    var s string
	fmt.Scan(&s)
	t := true
	flag := false
	for  i,a := range(s){
	    f := true
	    for _,b := range([]rune{'a','o','u','i','e'}) {
    	        if a == b { f = false }
    	}
	    if  flag &&  f {
	        t = false
	        break
	    } else if flag && !f {
	        flag = false
	    } else if !flag && f && a != 'n'{
	        flag  = true
	    } else if  f && i == len(s)-1 && a != 'n'  {
	        t = false
	        break
	    }

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


package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1024*1024)

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

func main() {
	bTemp, _ := strconv.ParseInt(readLine(), 10, 64)
	b := int64(bTemp)
	gTemp, _ := strconv.ParseInt(readLine(), 10, 64)
	g := int64(gTemp)
	if g < min {
		min = g
	}
	nTemp, _ := strconv.ParseInt(readLine(), 10, 64)
	n := int64(nTemp)
	min := Min(n, g)
	minBoys = n - min
	maxBoys := Min(n, b)
	fmt.Print(maxBoys - minBoys + 1)
}

func readLine() string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(str), "\r\n")
}


package main

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

var reader = bufio.NewReaderSize(os.Stdin, 1024*1024)

func main() {
	bTemp, _ := strconv.ParseInt(readLine(), 10, 64)
	min := int64(bTemp)
	gTemp, _ := strconv.ParseInt(readLine(), 10, 64)
	g := int64(gTemp)
	if g < min {
		min = g
	}
	nTemp, _ := strconv.ParseInt(readLine(), 10, 64)
	n := int64(nTemp)
	if min >= n {
		fmt.Print(n + 1)
	} else {
		fmt.Print(min + 1)
	}
}

func readLine() string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}
	return strings.TrimRight(string(str), "\r\n")
}


package main

import "fmt"

func main() {
	var a, b, n int
	fmt.Scan(&a, &b, &n)
	ans := a
	if b < ans {
		ans = b
	}
	if n < ans {
		ans = n
	}
	fmt.Println(ans + 1)
}


package main

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

func solve() {
    n := readInt()
    init := [2]int{}
    a, c := make([][2]int, n), make([]int, n)
    for i := 0; i < n; i++ {
        ch := readString()
        if ch == "B" {
            c[i] = 1
        }
        for j := range a[i] {
            v := readInt()
            if v > n {
                init[j] += v-n
                v = n
            }
            a[i][j] = v
        }
    }

    const inf = 100000000
    const mx = 1<<16
    mem := [mx][2][16*16+1]int{}
    was := [mx]bool{}
    for i, v := range mem {
        for col, u := range v {
            for j := range u {
                mem[i][col][j] = inf
            }
        }
    }
    mem[0][0][0] = 0

    ans := inf
    d := [mx][2]int{}
    q := []int{0}
    was[0] = true
    for len(q) > 0 {
        cur := q[0]
        curD := d[cur]
        //fmt.Println("BFS", cur, curD)
        for col, u := range mem[cur] {
            for cnt, val := range u {
                if cur == (1<<uint(n))-1 {
                    ans = min(ans, val)
                }

                r, b := 0, 0
                if col == 0 {
                    r = cnt
                } else {
                    b = cnt
                }

                for bit := 0; bit < n; bit++ {
                    mask := 1 << uint(bit)
                    if cur & mask == 0 {
                        next := cur | mask
                        priceR, priceB := max(a[bit][0]-curD[0], 0), max(a[bit][1]-curD[1], 0)
                        //fmt.Println(" Price", priceR, priceB, val)
                        steps := max(priceR-r, priceB-b)
                        nextR, nextB := r+steps-priceR, b+steps-priceB
                        nextCol, nextVal := 0, nextR+nextB
                        if nextB > 0 {
                            nextCol = 1
                        }
                        if nextVal < len(u) {
                            mem[next][nextCol][nextVal] = min(mem[next][nextCol][nextVal], val+steps+1)
                            //fmt.Println(" Updated", next, nextCol, nextVal, "->", mem[next][nextCol][nextVal])
                        }

                        if !was[next] {
                            was[next] = true

                            nextD := curD
                            nextD[c[bit]]++
                            d[next] = nextD

                            q = append(q, next)
                        }
                    }
                }
            }
        }
        q = q[1:]
    }

    ans += max(init[0], init[1])
    fmt.Println(ans)
}

// Helpers

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

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

// Math

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

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

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

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

// Sort

type Ints64 []int64

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

/* Sort tempalte
func (a ) Len() int           { return len(a) }
func (a ) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ) Less(i, j int) bool { return  }
*/


package main

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

func solve() {
    n := readInt()
    init := [2]int{}
    a, c := make([][2]int, n), make([]int, n)
    for i := 0; i < n; i++ {
        ch := readString()
        if ch == "B" {
            c[i] = 1
        }
        for j := range a[i] {
            v := readInt()
            if v > n {
                init[j] += v-n
                v = n
            }
            a[i][j] = v
        }
    }

    const inf = 100000000
    const mx = 1<<16
    const sz = 16*16+1
    mem := [mx][2][sz]int{}
    was := [mx]bool{}
    for i := range mem {
        for col := range mem[0] {
            diff := max(init[col]-init[1-col], 0)
            for j := range mem[i][col] {
                val := inf
                if i == 0 && j <= diff {
                    val = 0
                }
                mem[i][col][j] = val
            }
        }
    }

    ans := inf
    d := [mx][2]int{}
    q := make([]int, 1, 1<<16)
    q[0] = 0
    un := uint(n)
    was[0] = true
    for curI := 0; curI < len(q); curI++  {
        cur := q[curI]
        curD := d[cur]
        //fmt.Println("BFS", cur, curD)
        for col, u := range mem[cur] {
            for cnt, val := range u {
                if cur == (1<<uint(n))-1 {
                    ans = min(ans, val)
                }

                if val >= inf {
                    continue
                }

                r, b := 0, 0
                if col == 0 {
                    r = cnt
                } else {
                    b = cnt
                }

                for bit := uint(0); bit < un; bit++ {
                    mask := 1 << bit
                    if cur & mask == 0 {
                        next := cur | mask
                        priceR, priceB := max(a[bit][0]-curD[0], 0), max(a[bit][1]-curD[1], 0)
                        //fmt.Println(" Price", priceR, priceB, val)
                        steps := max(priceR-r, priceB-b)
                        nextR, nextB := r+steps-priceR, b+steps-priceB
                        nextCol, nextVal := 0, nextR+nextB
                        if nextB > 0 {
                            nextCol = 1
                        }
                        if nextVal < sz {
                            mem[next][nextCol][nextVal] = min(mem[next][nextCol][nextVal], val+steps+1)
                            //fmt.Println(" Updated", next, nextCol, nextVal, "->", mem[next][nextCol][nextVal])
                        }

                        if !was[next] {
                            was[next] = true

                            nextD := curD
                            nextD[c[bit]]++
                            d[next] = nextD

                            q = append(q, next)
                        }
                    }
                }
            }
        }
    }

    ans += max(init[0], init[1])
    fmt.Println(ans)
}

// Helpers

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

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

// Math

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

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

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

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

// Sort

type Ints64 []int64

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

/* Sort tempalte
func (a ) Len() int           { return len(a) }
func (a ) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ) Less(i, j int) bool { return  }
*/


package main

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

func solve() {
    n := readInt()
    init := [2]int{}
    a, c := make([][2]int, n), make([]int, n)
    for i := 0; i < n; i++ {
        ch := readString()
        if ch == "B" {
            c[i] = 1
        }
        for j := range a[i] {
            v := readInt()
            if v > n {
                init[j] += v-n
                v = n
            }
            a[i][j] = v
        }
    }

    const inf = 1000000
    const mx = 1<<16
    const sz = 16*16+1
    mem := [mx][2][sz]int{}
    was := [mx]bool{}
    for i := range mem {
        for col := range mem[0] {
            //diff := max(init[col]-init[1-col], 0)
            for j := range mem[i][col] {
                val := inf
                if i == 0 && init[col] >= j {
                    val = 0
                }
                mem[i][col][j] = val
            }
        }
    }

    ans := inf
    d := [mx][2]int{}
    q := make([]int, 1, 1<<16)
    q[0] = 0
    un := uint(n)
    was[0] = true
    for curI := 0; curI < len(q); curI++  {
        cur := q[curI]
        curD := d[cur]
        //fmt.Println("BFS", cur, curD)
        for col, u := range mem[cur] {
            for cnt, val := range u {
                if cur == (1<<un)-1 {
                    ans = min(ans, val)
                }

                if val >= inf {
                    continue
                }

                r, b := 0, 0
                if col == 0 {
                    r = cnt
                } else {
                    b = cnt
                }

                for bit := uint(0); bit < un; bit++ {
                    mask := 1 << bit
                    if cur & mask == 0 {
                        next := cur | mask
                        priceR, priceB := max(a[bit][0]-curD[0], 0), max(a[bit][1]-curD[1], 0)
                        //fmt.Println(" Price", priceR, priceB, val)
                        steps := max(priceR-r, priceB-b)
                        nextR, nextB := r+steps-priceR, b+steps-priceB
                        nextCol, nextVal := 0, nextR+nextB
                        if nextB > 0 {
                            nextCol = 1
                        }
                        if nextVal < sz {
                            mem[next][nextCol][nextVal] = min(mem[next][nextCol][nextVal], val+steps+1)
                            //fmt.Println(" Updated", next, nextCol, nextVal, "->", mem[next][nextCol][nextVal])
                        }

                        if !was[next] {
                            was[next] = true

                            nextD := curD
                            nextD[c[bit]]++
                            d[next] = nextD

                            q = append(q, next)
                        }
                    }
                }
            }
        }
    }

    ans += max(init[0], init[1])
    fmt.Println(ans)
}

// Helpers

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

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

// Math

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

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

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

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

// Sort

type Ints64 []int64

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

/* Sort tempalte
func (a ) Len() int           { return len(a) }
func (a ) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ) Less(i, j int) bool { return  }
*/


package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
    var howmanya = strings.Count(s, "a")
	var long = len(s)
	if 2*howmanya > long {
		fmt.Print(long)
	}
    else {
		fmt.Print(howmanya * 2 - 1)
	}
}


package main

import "fmt"

func min(a,b int) int  {
	if(a < b){
		return a
		}
	return b
}
func katta(a,b int) int  {
	if(a < b){
		return b
	}
	return a
}
func ab(x int) int {
	if(x <= -1){
		x *= -1
	}
	return x
}

func main()  {
	var s string
	fmt.Scan(&s)
	cnt := 0
	for i := 0 ; i < len(s) ; i++{
		if(string(s[i]) == string("a")){
			cnt++
		}
	}
	uzun := len(s) - cnt
	if(uzun > cnt){
		fmt.Println(cnt + cnt - 1)
	}else{
		fmt.Println(len(s))
	}
}


package main

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

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

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

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

	if lenA > lenS/2 {
		return lenS
	}

	return lenA + 1
}


package main

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

var scanner *bufio.Scanner

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

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

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

func genPrimes() []int {
	primes := make([]int, 0, 170)
	var isDivisible [1001]bool
	for i := 2; i <= 1000; i++ {
		if !isDivisible[i] {
			primes = append(primes, i)
			for j := i + i; j <= 1000; j += i {
				isDivisible[j] = true
			}
		}
	}
	return primes
}

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

func main() {
	N := nextInt()
	if N == 1 {
		fmt.Println("1 0")
		return
	}
	primes := genPrimes()

	primeFactors := make(map[int]int)
	for _, p := range primes {
		for N%p == 0 {
			N /= p
			primeFactors[p]++
		}
		if N == 1 {
			break
		}
	}

	if N != 1 {
		primeFactors[N]++
	}

	maxExp := 0
	for _, exp := range primeFactors {
		if exp > maxExp {
			maxExp = exp
		}
	}

	pow := 1
	numSqrts := 0
	muls := 0

	bitlen := bits.Len(uint(maxExp))
	if bitlen < maxExp {
		bitlen++
	}
	numSqrts = bitlen - 1
	pow = 1 << uint(bitlen-1)

	var base int64 = 1
	for p, exp := range primeFactors {
		base *= int64(p)
		if exp < pow {
			muls = 1
		}
	}

	fmt.Println(base, muls+numSqrts)
}


/*
URL:
https://codeforces.com/problemset/problem/1062/B
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	n int
)

func main() {
	n = ReadInt()

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

	memo := TrialDivision(n)
	PrintfDebug("n: %v\n", memo)

	fin := 1
	for k := range memo {
		fin *= k
	}

	M := make(map[int]int)
	S := make(map[int]int)
	for k, v := range memo {
		mul := 0
		sqrt := 0
		for v > 1 {
			if v%2 == 1 {
				v++
				mul++
			} else {
				v /= 2
				sqrt++
			}
		}
		M[k] = mul
		S[k] = sqrt
	}

	maxSqrt := 0
	for _, v := range S {
		ChMax(&maxSqrt, v)
	}
	// ans := 0
	// for k, v := range S {
	// 	ans += v
	// 	ans += M[k]

	// 	ans += 2 * (maxSqrt - v)
	// }

	// if maxSqrt > 0 {
	// 	fmt.Println(fin, maxSqrt+1)
	// } else {
	// 	fmt.Println(fin, 0)
	// }

	if maxSqrt == 0 {
		fmt.Println(fin, 0)
		return
	}

	// すべてがmaxsqrtなら掛け算は一切不要
	for _, v := range S {
		if v != maxSqrt {
			fmt.Println(fin, maxSqrt+1)
			return
		}
	}

	fmt.Println(fin, maxSqrt)
}

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

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

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

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

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

	return p
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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


package main

import "fmt"

func main(){
  var n int
  fmt.Scan(&n)
  maxV := 1
  ansV := 1
  ansCnt := 0
  is := false
  for i := 2; i <= n; i++ {
    if n % i == 0 {
      ansV *= i
      cnt := 0;
      for n % i == 0 {
        n /= i
        cnt++
      }
      if maxV != 1 {
        is = true
      }
      if maxV < cnt {
        maxV = cnt
      }

    }
  }
  for maxV > 1 {
    if maxV % 2 == 1 {
      maxV++
      is = true
    }
    ansCnt++
    maxV /= 2
  }
  if is == true {
    ansCnt++
  }
  fmt.Println(ansV, ansCnt)
}


package main

import (
	"fmt"
)

func factor(mp map[int]int,n int)  {
	for i:=2 ; i*i <= n; i++ {
		for n%i==0&&n>0 {
			n/=i
			mp[i]++
		}
	}
	if n>1 {
		mp[n]++
	}
}
func newRes(mp map[int]int) int{
	val:=1
	for k,v := range mp {
		//fmt.Printf("k:%d,v:%d\n",k,v)
		for cnt:=0;cnt<(v+1)/2;cnt++ {
			val*=k
		}
	}
	return val
}

func main()  {
	var n int
	_,_=fmt.Scanln(&n)
	mp:=make(map[int]int)
	res,step:=n,0
	for {
		for k,_:= range mp {
			delete(mp,k)
		}
		factor(mp,res)
		ret:=newRes(mp)
		//fmt.Printf("before:%d ,after:%d\n",res,ret)
		if ret == res {
			break
		} else {
			step++
			res=ret
		}
	}
	if res==n {//prime
		step=0
	}else if res*res!=n {//square
		step=step+1
	}
	fmt.Println(res,step)
}


package main

import (
	"fmt"
	"sort"
)

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


package main

import (
	"fmt"
)

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

	var participants []int
	for i := 0; i < n; i++ {
		var input int
		fmt.Scan(&input)
		participants = append(participants, input)
	}

	var kValue = participants[k]
	var count int
	for _, p := range participants {
		if p >= kValue && p > 0 {
			count++
		}
	}

	fmt.Println(count)

}


package main

import "fmt"

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

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

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

	var i int
	for i=k-1; arr[i]>=arr[k-1]; i++ {
	}
	fmt.Println(i)
}


package main

import (
	"fmt"
)

func main() {
	var n, c int

	fmt.Scan(&n, &c)

	xi := make([]int, n)

	for i := range xi {
		fmt.Scan(&xi[i])
	}

	max, dif := 0, 0

	for i:=0; i<n-1; i++ {
		dif = xi[i] - xi[i+1]
		if dif > max {
			max = dif
		}
	}

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


package main
import (
	"fmt"
)
func main() {
	var n,c,x,l,e int
	fmt.Scan(&n,&c)
	v:= make([]int,n)
	fmt.Scan(&l)
	e=0
	for i:=1;i<n;i++ {
		fmt.Scan(&x)
		if e>(l-x-c) {
			e=e
		} else {e=l-x-c}
		l=x
	}
	fmt.Println(e)
}


//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
		}
	}
	return maxDiff - berriesCost
}


package main

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

const div int64 = 1000000007

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

	if n == 2 {
		return b
	}

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

	return b
}

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

	if m > n {
		n, m = m, n
	}

	fmt.Printf("%d\n", (cucl(n)+int64(2*(m-1)))%div)
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1292B(_r io.Reader, _w io.Writer) {
	type point struct{ x, y int64 }
	abs := func(x int64) int64 {
		if x < 0 {
			return -x
		}
		return x
	}
	dis := func(a, b point) int64 { return abs(a.x-b.x) + abs(a.y-b.y) }

	var ax, ay, bx, by, tt int64
	var p, st point
	Fscan(_r, &p.x, &p.y, &ax, &ay, &bx, &by, &st.x, &st.y, &tt)
	ps := []point{}
	for ; p.x < 1e17 && p.y < 1e17; p.x, p.y = ax*p.x+bx, ay*p.y+by {
		ps = append(ps, p)
	}

	ans := 0
	for i, p := range ps {
		t := tt
		if d := dis(st, p); d <= t {
			t -= d
			c := 1
			for j := i; j > 0; j-- {
				if d := dis(ps[j], ps[j-1]); d <= t {
					t -= d
					c++
				} else {
					break
				}
			}
			if i+1 < len(ps) {
				if d := dis(ps[0], ps[i+1]); d <= t {
					t -= d
					c++
					for j := i + 2; j < len(ps); j++ {
						if d := dis(ps[j], ps[j-1]); d <= t {
							t -= d
							c++
						} else {
							break
						}
					}
				}
			}
			if c > ans {
				ans = c
			}
		}
	}
	Fprint(_w, ans)
}

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


package main

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

func solve(j Jam) {
	size := int32(j.Int())
	infinite := false
	sum := int32(0)
	prevPrevFigure := int64(0)
	prevFigure := int64(0)
	for i := int32(0); i < size; i++ {
		figure := j.Int();
		switch figure {
		case 1: //	circle
			switch prevFigure {
			case 1:
				infinite = true
			case 2:
				sum += 3
			case 3:
				sum += 4
			}
		case 2: //	triangle
			switch prevFigure {
			case 1:
				if prevPrevFigure == 3 {
					sum += 2
				} else {
					sum += 3
				}
			case 2:
				infinite = true
			case 3:
				sum += 3
			}
		case 3: //	square
			switch prevFigure {
			case 1:
				sum += 4
			case 2:
				infinite = true
			case 3:
				infinite = true
			}
		}
		if infinite {
			break
		}

		prevPrevFigure = prevFigure
		prevFigure = figure
	}
	if infinite {
		j.P("Infinite\n")
	} else {
		j.P("Finite\n")
		j.P("%d\n", sum)
	}
}

func main() {
	jam, closeFunc := JamNew()
	defer closeFunc()
	solve(jam)
}

type Jam interface {
	Scanner() *bufio.Scanner
	Writer() *bufio.Writer
	Close()

	Str() string
	Int() int64
	Float() float64

	P(format string, values ...interface{})
	PF(format string, values ...interface{})
}

func JamNew() (Jam, func()) {
	if len(os.Args) > 1 {
		panic("running with input file path is not supported")
	}

	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 0, 1024*1024), 1024*1024)

	var writer = bufio.NewWriter(os.Stdout)
	jam := &jam{scanner, writer}
	return jam, jam.Close
}

type jam struct {
	sc *bufio.Scanner
	wr *bufio.Writer
}

func (j *jam) Close() {
	if err := j.wr.Flush(); err != nil {
		panic(err)
	}
}

func (j *jam) Scanner() *bufio.Scanner {
	return j.sc
}

func (j *jam) Writer() *bufio.Writer {
	return j.wr
}

func (j *jam) Str() string {
	if !j.sc.Scan() {
		panic("failed to scan next token")
	}

	return j.sc.Text()
}

func (j *jam) Int() int64 {
	if !j.sc.Scan() {
		panic("failed to scan next token")
	}

	res, err := strconv.ParseInt(j.sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}

	_, _ = fmt.Fprintf(os.Stderr, "scanned %d", res)
	_ = os.Stderr.Sync()

	return res
}

func (j *jam) Float() float64 {
	j.sc.Scan()
	res, err := strconv.ParseFloat(j.sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}

func (j *jam) P(format string, values ...interface{}) {
	_, err := fmt.Fprintf(j.wr, format, values...)
	if err != nil {
		panic(err)
	}
}

func (j *jam) PF(format string, values ...interface{}) {
	_, err := fmt.Fprintf(j.wr, format, values...)
	if err != nil {
		panic(err)
	}
	if err = j.wr.Flush(); err != nil {
		panic(err)
	}
}


package main

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

func solve(j Jam) {
	T := int16(j.Int())
	for t := int16(0); t < T; t++ {
		in := j.Str()
		runeCount := make([]int, 26)
		for _, r := range []rune(in) {
			rIdx := int(r - 'a')
			runeCount[rIdx] += 1
		}
		presentRunes := make([]int, 0, 26)
		for r := range runeCount {
			if runeCount[r] > 0 {
				presentRunes = append(presentRunes, r)
			}
		}
		result := make([]rune, 0)
		seed := presentRunes[0]
		for i := 0; i < runeCount[seed]; i++ {
			result = append(result, rune('a'+seed))
		}
		presentRunes = presentRunes[1:]
		left, right := seed, seed
		retryRunes := make([]int, 0, 26)
		for _, r := range presentRunes {
			if right+1 != r {
				for i := 0; i < runeCount[r]; i++ {
					result = append(result, rune('a'+r))
				}
				right = r
			} else if left+1 != r {
				for i := 0; i < runeCount[r]; i++ {
					result = append([]rune{rune('a' + r)}, result...)
				}
				left = r
			} else {
				retryRunes = append(retryRunes, r)
			}
		}
		valid := true
		for _, r := range retryRunes {
			if abs(right-r) != 1 {
				for i := 0; i < runeCount[r]; i++ {
					result = append(result, rune('a'+r))
				}
				right = r
			} else if abs(left-r) != 1 {
				for i := 0; i < runeCount[r]; i++ {
					result = append([]rune{rune('a' + r)}, result...)
				}
				left = r
			} else {
				valid = false
				break
			}
		}
		if !valid {
			j.P("No answer\n")
		} else {
			j.P("%s\n", string(result))
		}
	}
}

func main() {
	jam, closeFunc := JamNew()
	defer closeFunc()
	solve(jam)
}

type Jam interface {
	Scanner() *bufio.Scanner
	Writer() *bufio.Writer
	Close()

	Str() string
	Int() int64
	Float() float64

	P(format string, values ...interface{})
	PF(format string, values ...interface{})
}

func JamNew() (Jam, func()) {
	if len(os.Args) > 1 {
		panic("running with input file path is not supported")
	}

	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 0, 1024*1024), 1024*1024)

	var writer = bufio.NewWriter(os.Stdout)
	jam := &jam{scanner, writer}
	return jam, jam.Close
}

type jam struct {
	sc *bufio.Scanner
	wr *bufio.Writer
}

func (j *jam) Close() {
	if err := j.wr.Flush(); err != nil {
		panic(err)
	}
}

func (j *jam) Scanner() *bufio.Scanner {
	return j.sc
}

func (j *jam) Writer() *bufio.Writer {
	return j.wr
}

func (j *jam) Str() string {
	if !j.sc.Scan() {
		panic("failed to scan next token")
	}

	return j.sc.Text()
}

func (j *jam) Int() int64 {
	if !j.sc.Scan() {
		panic("failed to scan next token")
	}

	res, err := strconv.ParseInt(j.sc.Text(), 10, 64)
	if err != nil {
		panic(err)
	}

	_, _ = fmt.Fprintf(os.Stderr, "scanned %d", res)
	_ = os.Stderr.Sync()

	return res
}

func (j *jam) Float() float64 {
	j.sc.Scan()
	res, err := strconv.ParseFloat(j.sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return res
}

func (j *jam) P(format string, values ...interface{}) {
	_, err := fmt.Fprintf(j.wr, format, values...)
	if err != nil {
		panic(err)
	}
}

func (j *jam) PF(format string, values ...interface{}) {
	_, err := fmt.Fprintf(j.wr, format, values...)
	if err != nil {
		panic(err)
	}
	if err = j.wr.Flush(); err != nil {
		panic(err)
	}
}

//	GoLang shorthand methods for math go below
//	TODO wipe unused methods before submitting

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

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

func abs(a int) int {
	if a < 0 {
		return -a
	}
	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 a
	}
	return b
}

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


package main

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

type IO struct {
	scanner *bufio.Scanner
	writer *bufio.Writer
}
func NewIO() IO {
	io := IO{scanner: bufio.NewScanner(os.Stdin),
		writer: bufio.NewWriter(os.Stdout)}
	io.scanner.Split(bufio.ScanWords)
	return io
}
func toInt(buf []byte) (n int) {
	sgn bool := false
	for _, v := range buf {
		if v == '-' {
			sgn = true
		} else {
			n = n*10 + int(v-'0')
		}
	}
	if sgn {
		n = -n
	}
	return
}
func (io *IO) NextInt() int {
	io.scanner.Scan()
	return toInt(io.scanner.Bytes())
}
func (io *IO) Write(data ...interface{}) {
	for _, el := range data {
		switch el.(type) {
			case int:
				io.writer.WriteString(strconv.Itoa(el.(int)))
			case string:
				io.writer.WriteString(el.(string))
			case rune:
				io.writer.WriteRune(el.(rune))
		}
	}
}
func (io *IO) Writeln(data ...interface{}) {
	io.Write(data...)
	io.writer.WriteRune('\n')
}
func (io *IO) Flush() {
	io.writer.Flush()
}

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

const N int = 100

func main() {
	io := NewIO()

	n := io.NextInt()
	var a [N](int)
	ans := 0
	for i:=0; i<n; i++ {
		a[i] = io.NextInt()
		if i>0 && a[i]!=1 && a[i-1]!=1 {
			goto Bad
		}
		if i>1 && a[i]==2 && a[i-1]==1 && a[i-2]==3 {
			ans--
		}
		if i>0 {
			if Max(a[i],a[i-1])==2 {
				ans += 3
			} else {
				ans += 4
			}
		}
	}

	io.Writeln("Finite")
	io.Writeln(ans)
	io.Flush()
	return

Bad:
	io.Writeln("Infinite")
	io.Flush()
	return
}


package main

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

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

    input.Scan()
    n, _ := strconv.Atoi(input.Text())

    a := make([]int, n, n)
    for i := range a {
        input.Scan()
        a[i], _ = strconv.Atoi(input.Text())
    }

    const (
        _ = iota
        circle
        triangle
        square
    )

    ans := 0
    for i := 1; i < n; i++ {
        if a[i - 1] == circle {
            if a[i] == triangle {
                ans += 3
            } else {
                ans += 4
            }
        } else if a[i - 1] == triangle {
            if a[i] == circle {
                ans += 3
            } else {
                ans = -1
                break
            }
        } else {
            if a[i] == circle {
                ans += 4
            } else {
                ans = -1
                break
            }
        }
    }

    if ans == -1 {
        fmt.Println("Infinite")
    } else {
        fmt.Println("Finite")
        fmt.Println(ans)
    }
}


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

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

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

const (
	MOD = 1e9 + 7
)

type (

)

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

	return b
}

func main () {
	var (
		n, a, b, c int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)

	fmt.Fscanln(input, &n, &a, &b, &c)

	dp := make([]struct{cnt, l int}, 15)

	dp[0].l = n
	dp[0].l = n
	dp[0].l = n

	for i := 0; i <= n; i++ {
		if dp[i].cnt + 1 > dp[i + a].cnt && dp[i].l - a >= 0 {
			dp[i + a].cnt = dp[i].cnt + 1
			dp[i + a].l = dp[i].l - a
		}

		if dp[i].cnt + 1 > dp[i + b].cnt && dp[i].l - b >= 0 {
			dp[i + b].cnt = dp[i].cnt + 1
			dp[i + b].l = dp[i].l - b
		}

		if dp[i].cnt + 1 > dp[i + c].cnt && dp[i].l - c >= 0 {
			dp[i + c].cnt = dp[i].cnt + 1
			dp[i + c].l = dp[i].l - c
		}
	}

	fmt.Println(max(max(dp[n].cnt, dp[n].cnt), dp[n].cnt))
}


package main

import (
        "fmt"
        "errors"
    )

func Recur(n int, parts []int, count int) (int, error) {
    var result int
    var err error
    if n == 0 {
        result = count
    } else {
        if n < 0 {
            err = errors.New("Error")
        } else {
            for _, part := range parts {
                answ, check := Recur(n - part, parts, count + 1)
                if check == nil && answ > result {
                    result = answ
                }
            }
        }

    }

    return result, err
}

func main() {
    var n, a, b, c int
    fmt.Scanln(&n, &a, &b, &c)

    parts := [3]int{a, b, c}

    answ,_ := Recur(n, parts[:], 0)

    fmt.Println(answ)
}


package main

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

var (
	bufin  = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
)

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

/*
f(x) = 2*x - .5
4*x - 1.5
2^(n+1) x - (2^n - 1)
*/

const M = 1000000007

func main() {
	defer bufout.Flush()
	var N, K uint64
	scanf("%d%d", &N, &K)
	N = (2*N - 1) % M
	z := getx(K)
	printf("%d\n", (int64(z)*int64(N)+1)%M)
}

func getx(N uint64) int {
	if N < 30 {
		return 1 << N
	}
	if N%2 == 0 {
		Y := getx(N)
		return int(int64(Y) * int64(Y) % M)
	}
	return getx(N-1) * 2 % M
}


package main

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

var (
	bufin  = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
)

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

/*
f(x) = 2*x - .5
4*x - 1.5
2^(n+1) x - (2^n - 1)
*/

const M = 1000000007

func main() {
	defer bufout.Flush()
	var N, K uint64
	scanf("%d%d", &N, &K)
	N = (2*N - 1) % M
	z := getx(K)
	printf("%d\n", (int64(z)*int64(N)+1)%M)
}

func getx(N uint64) int {
	if N < 30 {
		return 1 << N
	}
	if N%2 == 0 {
		Y := getx(N >> 1)
		return int(int64(Y) * int64(Y) % M)
	}
	return getx(N-1) * 2 % M
}


package main

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

func check(e error) {
	if e != nil {
		panic(e)
	}
}

func main() {
	printf("%d", Problem791A())
}

func Problem791A () int {
	idx := 0
	var a,b int
	scanf("%d %d\n", &a, &b)

	for a < b {
		a = a * 3
		b = b * 2
		idx+=1
	}

	return idx
}

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

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


package main

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

func main(){
	reader := bufio.NewReader(os.Stdin);
	for{
		text,_ := reader.ReadString('\n');
		text = strings.Replace(text, "\n", "", -1);
		splitted := strings.Split(text, " ");
		a,_ := strconv.ParseInt(splitted[0], 10, 32);
		b,_ := strconv.ParseInt(splitted[1], 10, 32);
		var cnt int = 0;
		for a<=b{
			cnt++;
			a*=3;
			b*=2;
		}
		fmt.Fprintf(os.Stdout, "%d\n", cnt);
	}
}


package main

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

func main(){
	reader := bufio.NewReader(os.Stdin);
	for{
		text,_ := reader.ReadString('\n');
		text = strings.TrimSuffix(text, "\n");
		splitted := strings.Split(text, " ");
		a,_ := strconv.ParseInt(splitted[0], 10, 32);
		b,_ := strconv.ParseInt(splitted[1], 10, 32);
		fmt.println(b);
		fmt.Printf("%d %d\n", a, b);
		var cnt int = 0;
		for a<=b{
			cnt++;
			a*=3;
			b*=2;
		}
		fmt.Printf("%d\n", cnt);
		break;
	}
}


package main

import (
	"fmt"
	"strconv"
)

func main() {
	var k string
	var r int
	fmt.Scanf("%s %d\n", &k, &r)
	unitDigit, _ := strconv.Atoi(string(k[len(k)-1]))
	flag := false
	for i := 0; i <= 9; i++ {
		x := strconv.Itoa(unitDigit * i)
		newUnitDigit, _ := strconv.Atoi(string(x[len(x)-1]))
		// fmt.Println(unitDigit, i, x, newUnitDigit, r)
		if newUnitDigit == r {
			fmt.Println(i)
			flag = true
			break
		}
	}
	if !flag {
		fmt.Println(r)
	}

}


package main

import (
	"bufio"
	"os"

	"strings"
	"strconv"
	"fmt"
)

func getString() string {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		return sc.Text()
	}
	return sc.Text()
}

func main() {
	str := getString()
	ar := strings.Split(str, " ")
	k, _ := strconv.Atoi(ar[0])
	r, _ := strconv.Atoi(ar[1])
	if dec :=  k%10; dec != 0 {
		i := 1
		for {
			if dec%r == 0 {
				fmt.Println(i)
				return
			} else {
				i++
				dec = dec * i
				continue
			}
		}
	} else {
		fmt.Println(1)
	}

}


package main

import "fmt"

func main() {
	var k, r int
	fmt.Scan(&k, &r)
	var cnt = 1
	var remain = k % 10
	for remain != r {
		remain = (k + remain) % 10
		cnt++
	}
	fmt.Print(cnt)
}


package main

import "fmt"

func main() {
	var k, r int
	fmt.Scan(&k, &r)
	var cnt = 1
	var remain = k % 10
	for remain != r && remain == 0 {
		remain = (k + remain) % 10
		cnt++
	}
	fmt.Print(cnt)
}


package main

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

func solve(n int, arr []int) int {
	current := 0

	for i := range arr {
		if arr[i]-current > 15 {
			return current + 15
		}
		current = arr[i]
	}

	return current
}

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

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

	arr := make([]int, n)

	for i := range arr {
		fmt.Fscanf(r, "%d", &arr[i])
	}

	fmt.Fprintf(os.Stdout, "%d\n", solve(n, arr))
}


package main

import "fmt"

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


package main

import "fmt"

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

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

	pre := 0
	ans := 0
	for i := 0; i < n; i++ {
		if tn[i]-pre > 15 {
			ans = pre + 15
			break
		} else {
			pre = tn[i]
			if i == n-1 {
				ans = pre + 15
			}
		}
	}

	if ans == 0 {
		ans = 90
	}

	fmt.Println(ans)
}


package main

import "fmt"

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

	start := 0
	next := 0
	minutes := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&next)
		if next - start > 15 {
			minutes = (start + 15)
			break
		}
		start = next
		minutes = start
		if i == n-1 {
			minutes += (90 - next)
		}
	}
	fmt.Print(minutes)
}


package main

import (
	"fmt"
)

func weirdSum(a, b int) (int, int) {
	for a != 0 && b != 0 {
		if a >= 2*b {
			a -= 2 * b
			continue

		} else if b >= 2*a {
			b -= 2 * a
			continue
		}

		break
	}

	return a, b
}

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

	fmt.Println(weirdSum(a, b))
}


package main

import (
	"fmt"
)

func weirdSum(a, b int64) (int64, int64) {
	for a != 0 && b != 0 {
		if a >= 2*b {
			a -= 2 * b
			continue

		} else if b >= 2*a {
			b -= 2 * a
			continue
		}

		break
	}

	return a, b
}

func main() {
	var a, b int64
	fmt.Scanf("%d %d", &a, &b)

	fmt.Println(weirdSum(a, b))
}