package main

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

func main() {
	sc := NewScanner()
	c, v0, v1, a, l := sc.NextInt(), sc.NextInt(), sc.NextInt(), sc.NextInt(), sc.NextInt()

	remain := c - l
	count := 0
	speed := v0
	for remain > 0 {
		remain += l

		count++

		remain -= speed
		speed += a
		if speed > v1 {
			speed = v1
		}
	}

	fmt.Println(count)
}

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

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

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

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

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

	return mp
}

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


package main

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

type Team struct {
    main uint8
    second  uint8
}

func main() {
	in := bufio.NewReader(os.Stdin)
	var n,c uint8
	var s []Team

	fmt.Fscanf(in, "%d\n", &n)
	for i:= uint8(0); i < n; i++{
		var t Team
		fmt.Fscanf(in, "%d %d\n", &t.main, &t.second)
		s = append(s, t)
	}
	for i:= uint8(0); i < n; i++{
		for j:= uint8(0); j < n; j++{
			if i != j{
				if s[i].main == s[j].second{
					c++
				}
			}
		}
	}
	fmt.Println(c)

}


package main

import "fmt"

func main() {
	var n, k, a, count int
	var arr []int
	fmt.Scanf("%d %d\n", &n, &k)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		arr = append(arr, a)
	}
	for i := 0; i < n; i++ {
		if arr[i] >= arr[k] && arr[k] > 0 {
			count++
		}
	}
	fmt.Println(count)
}


package main

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

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

// 8 5
// 10 9 8 7 7 7 5 5

func checkInputs() int {
	in := getInput()
	index, _ := strconv.Atoi(strings.Split(in[0], " ")[1])
	count := 0

	values := strings.Split(in[1], " ")

	check, _ := strconv.Atoi(values[index])

	for _, val := range values {
		v, err := strconv.Atoi(val)
		if err != nil {
			log.Fatal(err)
		}

		if v > 0 && v >= check {
			count++
			continue
		}
	}
	return count
}

func getInput() []string {
	inputs := []string{}
	reader := bufio.NewReader(os.Stdin)

	for len(inputs) != 2 {
		s, err := reader.ReadString('\n')
		if err != nil && err != io.EOF {
			log.Fatal(err)
		}
		s = strings.TrimRight(s, "\r\n")
		inputs = append(inputs, s)
	}
	return inputs
}


package main

import (
	"fmt"
)

func main() {
	var n, k, ret int
	var arr [50]byte
	fmt.Scanf("%d %d", &n, &k)

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

	for i := 49; i > 0; i-- {
		if arr[i] > 0 && k > 0 {
			ret += int(arr[i])
			k -= int(arr[i])
		}
	}

	fmt.Println(ret)
}


package main

import ("fmt")

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


package main

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

func main() {
	var n int
	var k int
	var scores []int
	var scanner = bufio.NewScanner(os.Stdin)
	n, k = takeInput(scanner)
	scores = getScores(scanner)

	fmt.Println(checkScores(n, k, scores))

}

func takeInput(scanner *bufio.Scanner) (int, int) {

	scanner.Scan()
	tempInput := strings.Split(scanner.Text(), " ")
	var n int
	n, _ = strconv.Atoi(tempInput[0])
	var k int
	k, _ = strconv.Atoi(tempInput[1])
	return n, k
}

func getScores(scanner *bufio.Scanner) []int {
	var input string
	var scores []int

	scanner.Scan()
	input = scanner.Text()

	tempScores := strings.Split(input, " ")

	for _, scoreString := range tempScores {
		score, _ := strconv.Atoi(scoreString)
		scores = append(scores, score)
	}

	return scores
}

func checkScores(n int, k int, scores []int) int {

	var advancers int = 0
	for _, value := range scores {
		if value <= 0 {
			return advancers
		}
		if value >= scores[k] {
			advancers++
		}
	}
	return advancers
}


package main

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

func Round(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var T, target, si int
	var result []int
	Fscan(in, &T)
	Fscan(in, &target)

	for ; T > 0; T-- {
		Fscan(in, &si)
		result = append(result, si)
	}

	var mid int
	i, j := 0, len(result)-1
	for i <= j {
		mid = (i + j) / 2
		if result[mid] < result[target] {
			j = mid - 1
		} else if result[mid] > result[target] {
			i = mid + 1
		} else {
			if result[target] == 0 {
				for ; mid > 0; mid-- {
					if result[mid] != result[target] {
						break
					}
				}

				Fprintln(out, mid)

			} else {

				for ; mid < len(result); mid++ {
					if result[mid] != result[target] {
						break
					}
				}

				Fprintln(out, mid)
			}

			return
		}
	}

	Fprintln(out, mid+1)

}

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


package main

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

var (
	reader *bufio.Reader
	writer *bufio.Writer
)

func init() {
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
}
func scanf(format string, args ...interface{}) (int, error) {
	return fmt.Fscanf(reader, format, args...)
}

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

func getAddresses(n []int) []interface{} {
	adds := make([]interface{}, len(n))
	for i := 0; i < len(n); i++ {
		adds[i] = &n[i]
	}
	return adds
}

func main() {
	defer writer.Flush()
	var n, k int
	scanf("%d %d\n", &n, &k)
	arr := make([]int, n)
	fmt.Fscan(reader, getAddresses(arr)...)
	answer := k
	if arr[k] > 0 {
		for i := k; i < n; i++ {
			if arr[k-1] == arr[i] {
				answer++
			} else {
				break
			}
		}
	} else {
		for i := k - 2; i >= 0; k++ {
			if arr[i] > 0 {
				answer = i + 1
				break
			}
		}
	}
	printf("%d\n", answer)

}


package main

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

var (
	reader *bufio.Reader
	writer *bufio.Writer
)

func init() {
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
}
func scanf(format string, args ...interface{}) (int, error) {
	return fmt.Fscanf(reader, format, args...)
}

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

func getAddresses(n []int) []interface{} {
	adds := make([]interface{}, len(n))
	for i := 0; i < len(n); i++ {
		adds[i] = &n[i]
	}
	return adds
}

func main() {
	defer writer.Flush()
	var n, k int
	scanf("%d %d\n", &n, &k)
	arr := make([]int, n)
	fmt.Fscan(reader, getAddresses(arr)...)
	answer := k
	if arr[k] > 0 {
		for i := k; i < n; i++ {
			if arr[k-1] == arr[i] {
				answer++
			} else {
				break
			}
		}
	} else {
		for i := k - 1; i >= 0; i-- {
			if arr[i] > 0 {
				break
			}
			answer--
		}
	}
	printf("%d\n", answer)

}


package main

import "fmt"

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

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

	cutoffScore := scores[k-1]

	var nAdvanced int
	for i := 0; scores[i] >= cutoffScore; i++ {
		nAdvanced++
	}

	fmt.Print(nAdvanced)
}


package main

import (
    "fmt"
)

func main() {
    var k, n int
    fmt.Scanf("%d %d\n", &n, &k)
    members := make([]int, n)
    for i:= 0; i < n; i++ {
        fmt.Scanf("%d", &members[i])
    }
    limitScore := members[k-1]
    if limitScore == 0 {
        fmt.Println("0")
        return
    }
    membersFinalNum := k
    for i := k; members[i] >= limitScore && i < len(members); i++ {
        membersFinalNum += 1
    }
    fmt.Println(membersFinalNum)
}


package main

import "fmt"
import "bytes"
import "io/ioutil"
import "os"
import "strconv"

func task_solution(n int, k int, a []int) int {
	if a[k - 1] > 0 {
		for i := k; i < len(a); i += 1 {
			if a[i] != a[k - 1] {
				return i
			}
		}
		return len(a)
	}
	for i := k; i > 0; i -= 1 {
		if a[i] != 0 {
			return i
		}
	}
	return 0
}

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

	in_raw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}
	in_raw_arr := bytes.Split(bytes.TrimSpace(in_raw), []byte(" "))
	in := []int{}
	for _, val := range in_raw_arr {
		parsed_int, err := strconv.Atoi(string(val))
		if err != nil {
			panic(err)
		}
		in = append(in, parsed_int)
	}

	fmt.Println(task_solution(n, k, in))
}


package main

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

var k_cf702d, a_cf702d, b_cf702d, t_cf702d int

func startCar(d int64) float64 {
	if d <= int64(k_cf702d) {
		return float64(int64(a_cf702d)*d)
	}
	return float64(a_cf702d*k_cf702d) + math.Min(float64(float64(t_cf702d) + startCar(d-int64(k_cf702d))), float64(int64(b_cf702d)*(d-int64(k_cf702d))))
}

func main() {

	//fmt.Printf("%f\n", math.MaxFloat64)
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Buffer([]byte{}, int(math.Pow(10,8)))

	scanner.Scan()
	dkabtStr := scanner.Text()
	dkabtStrArr := strings.Split(dkabtStr, " ")
	d, _ := strconv.ParseInt(dkabtStrArr[0], 10, 64)
	k_cf702d, _ = strconv.Atoi(dkabtStrArr[1])
	a_cf702d, _ = strconv.Atoi(dkabtStrArr[2])
	b_cf702d, _ = strconv.Atoi(dkabtStrArr[3])
	t_cf702d, _ = strconv.Atoi(dkabtStrArr[4])

	var resp float64
	if d <= int64(k_cf702d) {
		resp = float64(int64(a_cf702d) * d)
	} else {
		resp = float64(a_cf702d*k_cf702d)
		carAvg := (float64(t_cf702d)/float64(k_cf702d)) + float64(a_cf702d)
		if  carAvg <= float64(b_cf702d) {
			resp += float64(d - int64(k_cf702d)) * carAvg
		} else {
			resp += float64((d - int64(k_cf702d)) * int64(b_cf702d))
		}
	}

	//resp := math.Min(float64(int64(b_cf702d)*d), startCar(d))

	fmt.Printf("%f\n", math.Ceil(resp))
}


package main

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

const (
	n = 1000000007
)

func sum(a, b int) int {
	s := a + b
	if s >= n {
		return s - n
	}
	return s
}

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

func g0(a, b, h, w int) int {
	if a == 0 && b == 0 {
		return 1
	}
	var s int
	for x := h + 1; x <= a; x++ {
		s += g0(b, a - x, w, h)
	}
	return s
}

func f0(a, b int) int {
	if a == 0 || b == 0 {
		return 1
	}
	var s int
	for x := 1; x <= a; x++ {
		s += f0(b, a - x)
	}
	return s
}

func power(a, n int) int {
	r := 1
	for n > 0 {
		if (n & 1) != 0 {
			r = mul(r, a)
		}
		n /= 2
		if n > 0 {
			a = mul(a, a)
		}
	}
	return r
}

func inv(a int) int {
	return power(a, n - 2)
}

var facts []int
var ifacts []int

func cnk(n, k int) int {
	if k < 0 || k > n || n < 0 {
		return 0
	}
	return mul(mul(facts[n], ifacts[k]), ifacts[n-k])
}

func f1(a, b int) int {
	return sum(cnk(a + b - 1, a), cnk(a + b - 1, b))
}

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

func solve(a, b, h int) int {
	q := f1(a, b)
	h += 1
	if a == 0 {
		return 1
	}
	if b == 0 {
		if a >= h {
			return 1
		}
		return 0
	}
	p := 0
	for ka := 1; ka * h <= a; ka++ {
		for kb := max(1, ka - 1); kb <= ka + 1 && kb <= b; kb++ {
			c0 := cnk(b - 1, kb - 1)
			c1 := cnk(a - ka * (h - 1) - 1, ka - 1)
			fmt.Printf("%d %d %d %d\n", ka, kb, c0, c1)
			d := mul(c0, c1)
			if ka == kb {
				p = sum(p, d)
			}
			p = sum(p, d)
		}
	}
	return mul(p, inv(q))
}

func main() {
	m := 200100
	facts = make([]int, m)
	ifacts = make([]int, m)
	facts[0] = 1
	for i := 1; i < m; i++ {
		facts[i] = mul(facts[i-1], i)
	}
	ifacts[m-1] = inv(facts[m-1])
	for i := m-2; i >= 0; i-- {
		ifacts[i] = mul(ifacts[i+1], i+1)
	}
	cin := NewParser(bufio.NewReaderSize(os.Stdin, 1<<16))
	a := cin.nextInt()
	b := cin.nextInt()
	h := cin.nextInt()
	fmt.Printf("%d\n", solve(b, a, h))
}

// some io

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

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

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

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

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

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

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

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


package main

import (
	"fmt"
)

func get_digits(n int) []bool {
	output := make([]bool, 10)
	for n > 0 {
		output[n%10] = true
		n = n/10
	}
	return output
}

func compatible(digits []bool, n int) bool {
	for n > 0 {
		if digits[n%10] {
			return true
		}
		n = n/10
	}
	return false
}

func main() {
	var input int
	fmt.Scan(&input)
	digits := get_digits(input)
	ans := 0
	for i:=1; i<=input; i++ {
		if input%i == 0 && compatible(digits, i) {
			ans++
		}
	}
	fmt.Println(ans)
}


package main

import (
        "fmt"
        "sort"
)

var n int
var k int
var x int

func main() {
        fmt.Scan(&n, &k, &x)
        cnt := 0
        a := make([]int, n+k)
        for i := 0; i < n; i++ {
                fmt.Scan(&a[i])
        }
        for i := n; i < n+k; i++ {
                a[i] = x
        }
        sort.Ints(a)
        a = a[:len(a)-2]
        for _, value := range a {
                cnt += value
        }
        fmt.Println(cnt)
}


package main

import "fmt"

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

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

    a = make([]int, n)

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

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

    fmt.Print(res + x * 2)
}


package main

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

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

type Int64Slice []int64

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

type Sq struct {
	v [8]int
}

func (sq *Sq) isPara() bool {
	chk1, chk2 := false, false

	for i := 2; i < 8; i = i + 2 {
		if sq.v[i] == sq.v[0] {
			chk1 = true
		}
	}
	for i := 3; i < 8; i = i + 2 {
		if sq.v[i] == sq.v[1] {
			chk2 = true
		}
	}

	if chk1 && chk2 {
		return true
	}
	return false
}

func check2in1(s1 *Sq, s2 *Sq, j int) bool {
	xin, yin := false, false

	xlarge, xsmall := 0, 0
	ylarge, ysmall := 0, 0
	for i := 0; i < 8; i = i + 2 {
		if s1.v[i] < s2.v[j*2] {
			xlarge = xlarge + 1
		}
		if s1.v[i] > s2.v[j*2] {
			xsmall = xsmall + 1
		}
	}
	if xlarge != 4 && xsmall != 4 {
		xin = true
	}

	for i := 1; i < 8; i = i + 2 {
		if s1.v[i] < s2.v[j*2+1] {
			ylarge = ylarge + 1
		}
		if s1.v[i] > s2.v[j*2+1] {
			ysmall = ysmall + 1
		}
	}
	if ylarge != 4 && ysmall != 4 {
		yin = true
	}
	if xin && yin {
		return true
	}
	return false
}

func check1in2(s1 *Sq, s2 *Sq, i int) bool {
	xaddy := s1.v[i*2] + s1.v[i*2+1]
	xsuby := s1.v[i*2] - s1.v[i*2+1]

	var xaddy2 [4]int
	var xsuby2 [4]int

	for j := 0; j < 4; j++ {
		xaddy2[j] = s2.v[j*2] + s2.v[j*2+1]
		xsuby2[j] = s2.v[j*2] - s2.v[j*2+1]
	}

  xin, yin := false, false
	xlarge, xsmall := 0, 0
	ylarge, ysmall := 0, 0

	for j := 0; j < 4; j++ {
		if xaddy2[j] < xaddy {
			xlarge = xlarge + 1
		}
		if xaddy2[j] > xaddy {
			xsmall = xsmall + 1
		}
	}
	if xlarge != 4 && xsmall != 4 {
		xin = true
	}

	for j := 0; j < 4; j++ {
		if xsuby2[j] < xsuby {
			ylarge = ylarge + 1
		}
		if xsuby2[j] > xsuby {
			ysmall = ysmall + 1
		}
	}
	if ylarge != 4 && ysmall != 4 {
		yin = true
	}
	if xin && yin {
		return true
	}
	return false

}

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

	var s1, s2 Sq

	for i := 0; i < 8; i++ {
		s1.v[i] = ReadInt32()
	}

	for i := 0; i < 8; i++ {
		s2.v[i] = ReadInt32()
	}

	if !s1.isPara() {
		s1, s2 = s2, s1
	}

  chk1in2, chk2in1 := false, false

	for i := 0; i < 4; i++ {
		if check2in1(&s1, &s2, i) {
			chk2in1 = true
		}
	}
	for i := 0; i < 4; i++ {
		if check1in2(&s1, &s2, i) {
			chk1in2 = true
		}
	}

	if chk1in2 || chk2in1 {
		fmt.Printf("YES")
	} else {
		fmt.Printf("NO")
	}
}

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

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

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

}

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

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

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

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

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

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

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

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

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

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


package main

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

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

	var n, m int
	fmt.Fscanf(reader, "%d %d\n", &n, &m)
	var pa, pb [10][10]bool
	for i := 0;i < n;i ++ {
		var x, y int
		if i == n - 1 {
			fmt.Fscanf(reader, "%d %d\n", &x, &y)
		} else {
			fmt.Fscanf(reader, "%d %d ", &x, &y)
		}
		pa[x][y] = true
		pa[y][x] = true
	}
	for i := 0;i < m;i ++ {
		var x, y int
		if i == m - 1 {
			fmt.Fscanf(reader, "%d %d\n", &x, &y)
		} else {
			fmt.Fscanf(reader, "%d %d ", &x, &y)
		}
		pb[x][y] = true
		pb[y][x] = true
	}

	solution := make([]bool, 10)

	canDeduce := true
	for i := 1; i < 10;i ++ {
		for j := 1;j < 10;j ++ {
			if !pa[i][j] {
				continue
			}
			var b1, b2 bool
			for k := 1; k < 10;k ++ {
				if pb[i][k] && k != j {
					solution[i] = true
					b1 = true
				}
				if pb[k][j] && k != i {
					solution[j] = true
					b2 = true
				}
			}
			if b1 && b2 {
				canDeduce = false
			}
		}
	}

	ans, ansCount := 0, 0
	for i := 1;i < len(solution);i ++ {
		if solution[i] {
			ans, ansCount = i, ansCount + 1
		}
	}
	if ansCount == 1 {
		fmt.Printf("%d", ans)
	} else if canDeduce {
		fmt.Printf("0")
	} else {
		fmt.Printf("-1")
	}

}


package main

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

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


// Codeforces 1076 B Divisor Subtraction train
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
)
var in *bufio.Reader

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

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

var n int64
var sieve []int
var primes []int
var nPrimes int
var nsub int64

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n int64
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	s = strings.Trim(s, " \n\r")
	n, err = strconv.ParseInt(s, 10, 64)
	if err != nil {
		fmt.Println("Parse int64 failed, err,s:", err,s)
		panic(err)
	}
}

func count_primes() {
	maxPrime := 100222
	sieve = make([]int, maxPrime)
	primes = make([]int, 10000)
	nPrimes = 0
	for i := 2; i<maxPrime; i++ {
		if sieve[i]==0 {
			primes[nPrimes] = i;
			nPrimes++
			for j:=i+i; j<maxPrime; j+=i {
				sieve[j] = 1
			}
		}
	}
}

func solve() {
	if n % 2 == 0 {
		nsub = n/2
		return
	}
	count_primes()
	for i:=0; i<nPrimes; i++ {
		if (n % int64(primes[i])) == 0 {
			n -= int64(primes[i])
			nsub = 1 + (n/2)
			break
		}
	}
	// now n is prime number
	nsub = 1
}

func printRes() {
    fmt.Println(nsub)
}

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


// Codeforces 1076 B Divisor Subtraction train
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
)
var in *bufio.Reader

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

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

var n int64
var sieve []int
var primes []int64
var nPrimes int
var nsub int64

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n int64
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	s = strings.Trim(s, " \n\r")
	n, err = strconv.ParseInt(s, 10, 64)
	if err != nil {
		fmt.Println("Parse int64 failed, err,s:", err,s)
		panic(err)
	}
}

func count_primes() {
	maxPrime := 100222
	sieve = make([]int, maxPrime)
	primes = make([]int, 19000)
	nPrimes = 0
	for i := 2; i<maxPrime; i++ {
		if sieve[i]==0 {
			primes[nPrimes] = i;
			nPrimes++
			for j:=i+i; j<maxPrime; j+=i {
				sieve[j] = 1
			}
		}
	}
}

func solve() {
	if n % 2 == 0 {
		nsub = n/2
		return
	}
	count_primes()
	for i:=0; i<nPrimes; i++ {
		if (n % int64(primes[i])) == 0 {
			n -= int64(primes[i])
			nsub = 1 + (n/2)
			return
		}
	}
	// now n is prime number
	nsub = 1
}

func printRes() {
    fmt.Println(nsub)
}

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


package main

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

func matrix(a int) [][]int {
	var matrix = [][]int{}
	for j:= 0 ; j<a ;j++ {
		array := []int{}
		for k:= 0 ; k<a; k++ {
			if  j == 0 {
				array = append(array,1)
			} else {
				if k == 0 {
					array = append(array,1)
				} else {
					array = append(array,array[k-1] + matrix[j-1][k])
				}
			}
			}
			matrix = append(matrix,array)
		}
		return matrix
	}

func main() {
	var number int
	var err error
	for {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print("Enter number: ")
	text, _ := reader.ReadString('\n')
	text =  strings.TrimRight(text,"\r\n")
	number,err = strconv.Atoi(text)
	if err == nil {
		if number > 0 && number < 11 {
			break
		} else {
			fmt.Println("Enter number > 2 and < 10^5")
		}
		fmt.Println(err)
	}
}
fmt.Println(matrix(number)[number][number])
}


package main

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

func matrix(a int) [][]int {
	var matrix = [][]int{}
	for j:= 0 ; j<a ;j++ {
		array := []int{}
		for k:= 0 ; k<a; k++ {
			if  j == 0 {
				array = append(array,1)
			} else {
				if k == 0 {
					array = append(array,1)
				} else {
					array = append(array,array[k-1] + matrix[j-1][k])
				}
			}
			}
			matrix = append(matrix,array)
		}
		return matrix
	}

func main() {
	var number int
	var err error
	for {
	reader := bufio.NewReader(os.Stdin)
	fmt.Print("Enter number: ")
	text, _ := reader.ReadString('\n')
	text =  strings.TrimRight(text,"\r\n")
	number,err = strconv.Atoi(text)
	if err == nil {
		if number > 0 && number < 11 {
			break
		} else {
			fmt.Println("Enter number > 2 and < 10^5")
		}
		fmt.Println(err)
	}
}
fmt.Println(matrix(number)[number-1][number-1])
}


package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	matrix := make([][]int, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]int, n)
	}
	for i := 0; i < 2; i++ {
		for j := 0; j < n; j++ {
			if i == 0 {
				matrix[0][j] = 1
			} else {
				matrix[j][0] = 1
			}
		}
	}
	fill(matrix, 1, 1)
	fmt.Println(matrix[n-1][n-1])
	// for i := 0; i < n; i++ {
	// 	for j := 0; j < n; j++ {
	// 		fmt.Print(matrix[i][j], " ")
	// 	}
	// 	fmt.Println()
	// }
}

func fill(matrix [][]int, i int, j int) {
	if matrix[i][j] == 0 && matrix[i][j-1] != 0 && matrix[i-1][j] != 0 {
		matrix[i][j] = matrix[i-1][j] + matrix[i][j-1]
		if i < len(matrix) && j+1 < len(matrix[i]) {
			fill(matrix, i, j+1)
		}
		if i+1 < len(matrix) && j < len(matrix[i]) {
			fill(matrix, i+1, j)
		}
	}
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(reader, &n)

	arr := []int{1, 1, 1, 1, 1}

	for n > 1 {
		for i := 1; i < 5; i++ {
			arr[i] = arr[i] + arr[i-1]
		}

		n--
	}

	fmt.Println(arr[4])
}


package main

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

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

type Vertice struct {
	X int
	Y int
}

func dist(a, b Vertice) int {
	x, y := a.X-b.X, a.Y-b.Y
	return x*x + y*y
}

func isRight(a, b, c Vertice) bool {
	es := []int{dist(a, b), dist(b, c), dist(c, a)}
	sort.Ints(es)

	return es[0]+es[1] == es[2]
}

func getAdjs(v Vertice) []Vertice {
	return []Vertice{Vertice{v.X - 1, v.Y}, Vertice{v.X + 1, v.Y}, Vertice{v.X, v.Y - 1}, Vertice{v.X, v.Y + 1}}
}

func solve(a, b, c Vertice) string {
	if isRight(a, b, c) {
		return "RIGHT"
	}

	for i := 0; i < 3; i++ {
		var v1, v2, v3 Vertice
		switch i {
		case 0:
			v1, v2, v3 = a, b, c
		case 1:
			v1, v2, v3 = b, c, a
		case 2:
			v1, v2, v3 = c, a, b
		}
		adjs := getAdjs(v1)
		for _, v := range adjs {
			if isRight(v, v2, v3) {
				return "ALMOST"
			}
		}
	}

	return "NEITHER"
}

func main() {
	defer w.Flush()

	a, b, c := Vertice{}, Vertice{}, Vertice{}
	fmt.Fscanf(r, "%d %d %d %d %d %d", &a.X, &a.Y, &b.X, &b.Y, &c.X, &c.Y)

	fmt.Fprintf(w, "%v", solve(a, b, c))
}


package main

import (
	"fmt"
)

type Pont struct {
	x, y int32
}

func (o *Pont) read() {
	fmt.Scan(&o.x)
	fmt.Scan(&o.y)
}

func (o *Pont) add(oo Pont) {
	o.x += oo.x
	o.y += oo.y
}

func (o *Pont) eq(oo Pont) bool {
	return o.x == oo.x && o.y == oo.y
}

func isRA(A, B, C Pont) bool {
	AB := Pont{B.x - A.x, B.y - A.y}
	AC := Pont{C.x - A.x, C.y - A.y}
	return 0 == AB.x*AC.x+AB.y*AC.y
}

func isRATRI(A, B, C Pont) bool {
	if A.eq(B) || A.eq(C) || B.eq(C) {
		return false
	}
	return isRA(A, B, C) || isRA(B, A, C) || isRA(C, A, B)
}

func main() {

	var (
		P     [3]Pont
		dir   = [4]Pont{Pont{0, 1}, Pont{1, -1}, Pont{-1, -1}, Pont{-1, 1}}
		delta = Pont{1, 0}
		i, j  int32
	)

	P[0].read()
	P[1].read()
	P[2].read()
	if isRATRI(P[0], P[1], P[2]) {
		fmt.Println("RIGHT")
		return
	}

	almost := false

outer:
	for i = 0; i < 3; i++ {
		for j = 0; j < 4; j++ {
			P[i].add(dir[j])
			if isRATRI(P[0], P[1], P[2]) {
				almost = true
				break outer
			}
			P[i].add(delta)
		}
	}

	if almost {
		fmt.Println("ALMOST")

	} else {
		fmt.Println("NEITHER")
	}

}


package main

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

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

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

	var la, ra, ta, lb, rb, tb int64
	fmt.Fscanf(reader, "%d %d %d\n", &la, &ra, &ta)
	fmt.Fscanf(reader, "%d %d %d", &lb, &rb, &tb)

	factor := gcd(ta, tb)

	var ans1, ans2 int64

	// Bob first, Alice after
	// (la - lb) + (ka * ta) - (kb * tb) = diff > 0
	diff1 := (la - lb) % factor
	if diff1 < 0 {
		diff1 += factor
	}
	if rb - lb + 1 < diff1 {
		ans1 = 0
	} else if rb - lb + 1 > diff1 + (ra - la + 1) {
		ans1 = ra - la + 1
	} else {
		ans1 = rb - lb + 1 - diff1
	}

	diff2 := (lb - la) % factor
	if diff2 < 0 {
		diff2 += factor
	}
	if ra - la + 1 < diff2 {
		ans2 = 0
	} else if ra - la + 1 > diff1 + (rb - lb + 1) {
		ans2 = rb - lb + 1
	} else {
		ans2 = ra - la + 1 - diff2
	}
	if ans1 > ans2 {
		fmt.Printf("%d", ans1)
	} else {
		fmt.Printf("%d", ans2)
	}

}


package main

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

func solve() {
	a := readInt()
	b := readInt()
	if a < b {
		a = b
	}

	ar = []string{"0/1", "1/1", "5/6", "2/3", "1/2", "1/3", "1/6"}
	fmt.Println(ar[a])
}

var scanner *bufio.Scanner

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

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

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

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


package main

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

func main() {
	var y, w, z uint8
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d %d\n", &y, &w)
	if y >= w {
		z = 6 - y + 1
	} else {
		z = 6 - w + 1
	}
	if z == 1 {
		fmt.Println("1/1")
	} else if z == 2 {
		fmt.Println("5/6")
	} else if z == 3 {
		fmt.Println("1/2")
	} else if z == 4 {
		fmt.Println("1/3")
	} else if z == 5 {
		fmt.Println("1/5")
	} else if z == 6 {
		fmt.Println("1/6")
	}
}


package main

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

func main() {
	var wWins, yWins, targetHigherWins int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &yWins)
	fmt.Fscan(reader, &wWins)
	if wWins > yWins {
		targetHigherWins = wWins
	} else {
		targetHigherWins = yWins
	}
	rolls := 6 - targetHigherWins + 1
	if rolls == 3 {
		fmt.Print(1, "/", 2)
	} else if rolls%2 == 0 {
		fmt.Print(rolls/2, "/", 3)
	} else {
		fmt.Print(rolls, "/", 6)
	}
}


package main

import "fmt"

func main()  {
	var yScore int
	fmt.Scan(&yScore)
	var wScore int
	fmt.Scan(&wScore)

	maxNo := yScore

	if yScore > wScore {
		maxNo = yScore
	} else {
		maxNo = wScore
	}
	maxNo = 6 - maxNo+1
	maxNo = 6 / 3
	if maxNo = 0 {
		maxNo = 1
	}
	fmt.Printf("1/%d", maxNo)
}


package main

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

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

	c := make([][]int, 2)
	c[0] = make([]int, n)
	c[1] = make([]int, n)
	k := make([]int, 2)
	pos := make([]int, 2)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	steps := 0
	winner := -1
	loop := false

	for j := 0; j < 2; j++ {
		scanner.Scan()
		var ek error
		k[j], ek = strconv.Atoi(scanner.Text())
		if ek != nil {
			return
		}
		for i := 0; i < k[j] && scanner.Scan(); i++ {
			a, err := strconv.Atoi(scanner.Text())
			if err != nil {
				return
			}
			c[j][i] = a
		}
	}

	init_sit := situation_to_code(c, k, pos, n)

	for true {
		f := make([]int, 2)
		f[0] = c[0][pos[0]]
		f[1] = c[1][pos[1]]

		for i := 0; i < 2; i++ {
			c[i][pos[i]] = 0
			pos[i]++
			if pos[i] >= n {
				pos[i] = pos[i] % n
			}
		}

		ic := -1
		if f[0] > f[1] {
			ic = 0
		} else { // not equal guaranteed
			ic = 1
		}

		ip := pos[ic] + k[ic] - 1
		if ip >= n {
			ip = ip % n
		}
		c[ic][ip] = f[(ic+1)%2]
		ip++
		if ip >= n {
			ip = ip % n
		}
		c[ic][ip] = f[ic]

		k[ic]++
		k[(ic+1)%2]--

		steps++

		curr_sit := situation_to_code(c, k, pos, n)
		if curr_sit == init_sit {
			loop = true
			break
		}
		if k[(ic+1)%2] == 0 {
			winner = ic + 1
			break
		}
	}

	if loop {
		fmt.Println(-1)
	} else {
		fmt.Println(steps, winner)
	}
}

func situation_to_code(c [][]int, k, p []int, n int) string {
	res := make([]string, n+2)
	res[0], res[1] = strconv.Itoa(k[0]), strconv.Itoa(k[1])
	rp := 2
	for i := 0; i < 2; i++ {
		for j := 0; j < k[i]; j++ {
			pos := (p[0] + j) % n
			res[rp] = strconv.Itoa(c[i][pos])
			rp++
		}
	}
	return strings.Join(res, ",")
}


package main

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

const N = 10

type Deck struct {
	cards []int
}

func (d *Deck) addCard(c int) {
	d.cards = append(d.cards, c)
}

func (d *Deck) isLosing() bool {
	return len(d.cards) == 0
}

func (d *Deck) hash() int64 {
	var h int64
	for _, c := range d.cards {
		h = N*h + int64(c)
	}
	return h
}

func oneRound(d1, d2 *Deck) {
	var c1, c2 int
	c1, d1.cards = d1.cards[0], d1.cards[1:]
	c2, d2.cards = d2.cards[0], d2.cards[1:]
	d := d1
	if c1 < c2 {
		c1, c2 = c2, c1
		d = d2
	}
	d.addCard(c2)
	d.addCard(c1)
}

func makeKey(d1, d2 Deck) string {
	return strconv.FormatInt(d1.hash(), 10) + "#" + strconv.FormatInt(d2.hash(), 10)
}

func main() {
	nextInt()
	var d1, d2 Deck
	k1 := nextInt()
	for i := 0; i < k1; i++ {
		d1.addCard(nextInt() - 1)
	}
	k2 := nextInt()
	for i := 0; i < k2; i++ {
		d2.addCard(nextInt() - 1)
	}
	was := make(map[string]struct{})
	for rounds := 0; ; rounds++ {
		if d1.isLosing() {
			fmt.Println(rounds, 2)
			return
		}
		if d2.isLosing() {
			fmt.Println(rounds, 1)
			return
		}
		key := makeKey(d1, d2)
		if _, ok := was[key]; ok {
			break
		}
		was[key] = struct{}{}
		oneRound(&d1, &d2)
	}
	fmt.Println(-1)
}

func init() {
	// maybe defer writer.Flush() in main

	lineScanner = bufio.NewScanner(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)

	/*
		inputFile, err := os.Open("a.in")
		if err != nil {
			panic(err)
		}
		outputFile, err := os.Create("a.out")
		if err != nil {
			panic(err)
		}
		lineScanner = bufio.NewScanner(inputFile)
		writer = bufio.NewWriter(outputFile)
	*/

	wordScanner = bufio.NewScanner(strings.NewReader(""))
	wordScanner.Split(bufio.ScanWords)
}

var lineScanner *bufio.Scanner
var wordScanner *bufio.Scanner

var writer *bufio.Writer

func nextLine() (string, error) {
	if !lineScanner.Scan() {
		if err := lineScanner.Err(); err != nil {
			panic(err)
		}
		return "", errors.New("nextLine: EOF reached")
	}
	return lineScanner.Text(), nil
}

func nextWord() string {
	for !wordScanner.Scan() {
		if err := wordScanner.Err(); err != nil {
			panic(err)
		}
		line, err := nextLine()
		if err != nil {
			return ""
		}
		wordScanner = bufio.NewScanner(strings.NewReader(line))
		wordScanner.Split(bufio.ScanWords)
	}
	return wordScanner.Text()
}

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

func nextInt64() int64 {
	res, err := strconv.ParseInt(nextWord(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func nextFloat64() float64 {
	res, err := strconv.ParseFloat(nextWord(), 64)
	if err != nil {
		panic(err)
	}
	return res
}


package main

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

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

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

	n := int64(scanInt(scanner))
	m := int64(scanInt(scanner))
	x := int64(1)
	for i := int64(1); i <= n; i++ {
		x *= 3
		if x >= m {
			x = ((x%m)*(n/i))%m
			for j := n%i; j != 0; j-- {
				x *= 3
				if x >= m {
					x %= m
				}
			}
			break
		}
	}
	x--
	if x == -1 {
		x = m-1
	}
	writer.WriteString(fmt.Sprintf("%d\n", x))
}


// 172B
package main

import (
	"fmt"
)

func main() {
	var x [100005]int
	var a, b, m, r, s int
	fmt.Scan(&a, &b, &m, &r)
	for ; ; r = (r*a + b) % m {
		x[r] += s
	}
	fmt.Print(s - x[r] + 1)
}


// 172B
package main

import (
	"fmt"
)

func main() {
	var x [100005]int
	var a, b, m, r, s int
	fmt.Scan(&a, &b, &m, &r)
	for x[r] = 0; r == (r*a+b)%m; {
		x[r] += s
	}
	fmt.Print(s - x[r] + 1)
}


package main

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

var scanner *bufio.Scanner

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

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

  s := getS()
  n := len(s)
  for i := range s {
    if s[i] == '.' {
      continue
    }
    jump := 0
    for {
      jump++
      if i + 4*jump >= n {
        break
      }
      okay := true
      for j := 1; j <= 4; j++ {
        if s[i+j*jump] == '.' {
          okay = false
          break
        }
      }
      if okay {
        writer.WriteString("yes\n")
        return
      }
    }
  }
  writer.WriteString("no\n")
}


package main

import (
	"fmt"
)

var count [10]int
var numbers []int

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

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

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

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

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

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


package main

import (
	"fmt"
)

var count [10]int
var numbers []int

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

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

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

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

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

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


package main

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

const maxn = 18
const maxm = 110

var a [1 << maxn][maxm]int64
var s [maxn]int
var cnt [10]int
var wid uint

func allzero(x int) bool {
    for i := uint(0); i < wid; i++ {
        if ((1<<i)&x) != 0 && s[i] != 0 {
            return false
        }
    }
    return true
}

func cc(x int) int {
    ans := 1
    for x != 0 {
        ans *= x
        x--
    }
    return ans
}

func main() {
    scanner.Split(bufio.ScanWords)
    n := scanner.NextInt64()
    m := scanner.NextInt()
    for i := 0; i < 10; i++ {
        cnt[i] = 0
    }
    for i := 0; i < (1 << maxn); i++ {
        for j := 0; j < maxm; j++ {
            a[i][j] = 0
        }
    }
    wid = 0
    for n != 0 {
        s[wid] = int(n % 10)
        cnt[s[wid]]++
        wid++
        n /= 10
    }
    a[0][0] = 1
    for i := 0; i < (1 << wid); i++ {
        if i > 0 && allzero(i) {
            for j := 0; j < m; j++ {
                a[i][j] = 0
            }
        }
        for j := 0; j < m; j++ {
            if a[i][j] == 0 {
                continue
            }
            for k := uint(0); k < wid; k++ {
                if (i & (1 << k)) != 0 {
                    continue
                }
                a[i|(1<<k)][(j*10+s[k])%m] += a[i][j]
            }
        }
    }
    ans := a[(1<<wid)-1][0]
    for i := 0; i < 10; i++ {
        ans = ans / int64(cc(cnt[i]))
    }
    fmt.Println(ans)
}

type Scanner struct {
    *bufio.Scanner
}

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

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

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

func (self *Scanner) NextInt64() int64 {
    x, err := strconv.ParseInt(self.Next(), 10, 64)
    if err != nil {
        panic(err)
    }
    return x
}

func (self *Scanner) NextDouble() float64 {
    x, err := strconv.ParseFloat(self.Next(), 64)
    if err != nil {
        panic(err)
    }
    return x
}


package main

import (
	"fmt"
	"os"
)

var p, x, y int

func check(nowx int) bool {
	i := (nowx / 50) % 475
	for j := 0; j < 25; j++ {
		i = (i*96 + 42) % 475
		if i+26 == p {
			return true
		}
	}
	return false
}

func main() {
	fmt.Scan(&p)
	fmt.Scan(&x)
	fmt.Scan(&y)

	var ansa int

	for nowx := y/50*50 + x%50; ; nowx += 50 {
		for nowx < y {
			nowx += 50
		}
		if check(nowx) {
			ansa = (nowx - x) / 100
			if (nowx-x)%100 != 0 {
				ansa++
			}
//			fmt.Println(nowx)
			fmt.Println(ansa)
			os.Exit(0)
		}
	}
}


package main

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

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


package main

import "fmt"

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

    res := 1
    acum := 0
    first := true
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        if a == 1 {
            if !first {
                res *= acum + 1
            }
            first = false
            acum = 0
        } else {
            acum++
        }
    }
    fmt.Println(res)
}


package main

import "fmt"

func main() {
    var n int64
    var ans, m, t, i int64
    var a [200]int64
    fmt.Scanf("%I64d\n",&n)
    for i = 1; i <= n; i++ {
        fmt.Scanf("%I64d",&a[i])
    }

    t = 1
    ans = 1
    for a[t] == 0 {
        t = t + 1
        if t == n+1 {
            break
        }
    }
    m = 0;
    for i = t; i <= n; i++ {
        if a[i]==1 {
            ans = ans * (m + 1)
            m = 0
        } else {
            m = m + 1
        }
    }

    fmt.Println(ans)
}


package main

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

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

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

	a := nextInt()
	min := 0
	i := a

	for ; i <= 1000000008; i++ {
		if has8(i) {
			min = i - a
			break
		}
	}

	println(min)
}

func has8(n int) bool {
	for n > 0 {
		if n % 10 == 8 {
			return true
		}

		n /= 10
	}

	for n < 0 {
		if n % 10 == -8 {
			return true
		}

		n /= 10
	}

	return false
}

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

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

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

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


package main

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

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


package main

import (
	"fmt"
)

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

func main() {
	var n int
	fmt.Scan(&n)
	t := make([][]int, 3)
	for i := 0; i < 3; i++ {
		t[i] = make([]int, 0, 5000)
	}
	for i := 1; i <= n; i++ {
		var x int
		fmt.Scan(&x)
		x--
		t[x] = append(t[x], i)
	}
	z := 1 << 30
	for i := 0; i < 3; i++ {
		z = min(z, len(t[i]))
	}
	fmt.Println(z)
	for i := 0; i < z; i++ {
		fmt.Printf("%d %d %d\n", t[0][0], t[1][0], t[2][0])
		for j := 0; j < 3; j++ {
			t[j] = t[j][1:]
		}
	}
}


package main

import "fmt"

func isLucky(a int64) bool {
	if a < 0 {
		a *= -1
	}
	for ; a > 0; a /= 10 {
		if a%10 == 8 {
			return true
		}
	}
	return false
}

func main() {
	var a int64
	fmt.Scan(&a)
	for i := int64(1); i <= 10; i++ {
		if isLucky(i + a) {
			fmt.Printf("%d\n", i)
			return
		}
	}
}


package main
import (
	"fmt"
)

func main(){
	var str string
	fmt.Scanf("%s\n", &str)
	var dest = [5]string {"Danil", "Olya", "Slava", "Ann" ,"Nikita"}
	sum := 0
	for i := 0; i < 5; i++{
		if matchStr(str, dest[i]){
			sum++
		}
	}
	if sum == 1{
		fmt.Println("YES")
	}else{
		fmt.Println("NO")
	}
}

func matchStr(src string, dest string) bool{
	for i := 0; i + len(dest) - 1 < len(src); i++{
		flag := true
		for j := 0; j < len(dest); j++{
			if src[i + j] != dest[j]{
				flag = false
			}
		}
		if flag {
			return true
		}
	}
	return false
}


package main
import (
	"fmt"
)

func code877A(){
	var str string
	fmt.Scanf("%s\n", &str)
	var dest = [5]string {"Danil", "Olya", "Slava", "Ann" ,"Nikita"}
	sum := 0
	for i := 0; i < 5; i++{
		sum += matchStr(str, dest[i])
	}
	if sum == 1{
		fmt.Println("YES")
	}else{
		fmt.Println("NO")
	}
}

func matchStr(src string, dest string) int{
	sum := 0
	for i := 0; i + len(dest) - 1 < len(src); i++{
		flag := true
		for j := 0; j < len(dest); j++{
			if src[i + j] != dest[j]{
				flag = false
			}
		}
		if flag {
			sum++
		}
	}
	return sum
}


package main

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

var scanner *bufio.Scanner

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

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

  n, k := getI(), getI()

  notPrime := make([]bool, n+1)
  primes := []int{}
  p := 2
  for p <= n {
    primes = append(primes, p)
    for i := 2*p; i <= n; i += p {
      notPrime[i] = true
    }
    for p++; p <= n && notPrime[p]; p++ {
    }
  }

  count := 0
  for i := 1; i < len(primes); i++ {
    s := primes[i-1] + primes[i] + 1
    if s <= n && !notPrime[s] {
      count++
      if count == k {
        writer.WriteString("YES\n")
        return
      }
    }
    if s > n {
      writer.WriteString("NO\n")
      return
    }
  }
}


package main

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

var scanner *bufio.Scanner

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

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

  n, k := getI(), getI()

  notPrime := make([]bool, n+1)
  primes := []int{}
  p := 2
  for p <= n {
    primes = append(primes, p)
    for i := 2*p; i <= n; i += p {
      notPrime[i] = true
    }
    for p++; p <= n && notPrime[p]; p++ {
    }
  }

  count := 0
  for i := 1; i < len(primes); i++ {
    s := primes[i-1] + primes[i] + 1
    if s > n {
      break
    }
    if !notPrime[s] {
      count++
      if count == k {
        writer.WriteString("YES\n")
        return
      }
    }
  }
  writer.WriteString("NO\n")
}


package main

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

func seive_of_eratosthenes(n int64) ([]int64, []bool) {
	var isPrime []bool = []bool{}
	var i int64
	var j int64
	for i = 0; i <= n; i++ {
		isPrime = append(isPrime, true)
	}

	for i = 2; i*i <= (n); i++ {
		if isPrime[i] == true {
			for j = i * i; j <= n; j += i {
				isPrime[j] = false
			}
		}
	}
	var result []int64 = []int64{}
	for i = 2; i <= n; i++ {
		if isPrime[i] == true {
			result = append(result, i)
		}
	}
	return result, isPrime
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	words := strings.Fields(scanner.Text())
	n, _ := strconv.ParseInt(words[0], 10, 64)
	k, _ := strconv.ParseInt(words[1], 10, 64)
	var res []int64 = []int64{}
	var isPrime []bool
	res, isPrime = seive_of_eratosthenes(n)
	var count int64 = 0
	// var i int64
	for i := 0; i < len(res)-1; i++ {
		if res[i]+res[i+1]+1 <= n {
			if isPrime[res[i]+res[i+1]+1] == true {
				count++
			}
		}
	}
	if k <= count {
		fmt.Printf("YES\n", count)

	} else {
		fmt.Printf("NO\n")
	}

}


package main

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

type in struct {
	Scanner *bufio.Scanner
}

func (in *in) s() string {
	in.Scanner.Scan()
	return in.Scanner.Text()
}
func (in *in) i() int {
	ret, _ := strconv.ParseInt(in.s(), 10, 32)
	return int(ret)
}
func (in *in) i64() int64 {
	ret, _ := strconv.ParseInt(in.s(), 10, 64)
	return ret
}
func (in *in) f() float64 {
	ret, _ := strconv.ParseFloat(in.s(), 64)
	return ret
}
func (in *in) ss(n int64) []string {
	a := make([]string, n)
	for i := range a {
		a[i] = in.s()
	}
	return a
}
func (in *in) is(n int64) []int64 {
	a := make([]int64, n)
	for i := range a {
		a[i] = in.i64()
	}
	return a
}
func (in *in) fs(n int64) []float64 {
	a := make([]float64, n)
	for i := range a {
		a[i] = in.f()
	}
	return a
}
func (in *in) imat(h int64, w int64) [][]int64 {
	a := make([][]int64, h)
	for y := range a {
		a[y] = make([]int64, w)
		for x := range a[y] {
			a[y][x] = in.i64()
		}
	}
	return a
}

func stdin() in {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	max := 1048576
	buf := make([]byte, max)
	scn.Buffer(buf, max)
	return in{Scanner: scn}
}

type arr []int

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

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

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

const maxn = 2e5 + 7
const inf = 0x3f3f3f3f

func main() {
	in := stdin()
	n, k := in.i(), in.i()
	ar := make([]arr, maxn)
	for i := 0; i < n; i++ {
		for x, cnt := in.i(), 0; x > 0; x /= 2 {
			ar[x] = append(ar[x], cnt)
			cnt++
		}
	}
	ans := inf
	for i := 0; i < n; i++ {
		if len(ar[i]) < k {
			continue
		}
		sort.Sort(ar[i])
		sum := 0
		for j := 0; j < k; j++ {
			sum += ar[i][j]
		}
		if sum < ans {
			ans = sum
		}
	}
	fmt.Println(ans)
}


package main

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

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

    return a,b,c
}

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    a, b, c:= getLine(scanner)
    n := int (float64(b - a )/float64(c) + 1)
    if n > 0 && a + c*(n-1) == b {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}


package main

import (
	"fmt"
)

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

	can := false
	if c == 0 {
		if a == b {
			can = true
		}
	} else {
		delta := b - a
		if (delta < 0 && c < 0) || (delta > 0 && c > 0) {
			if delta%c == 0 {
				can = true
			}
		}
	}

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


package main

import "fmt"

func main() {
    var a, b, c int
    fmt.Scan(&a, &b, &c)
    if c == 0  {
        if a == b {
            fmt.Print("YES")
        } else {
            fmt.Print("NO")
        }
        return
    }
    if (b-a)%c == 0 {
        fmt.Print("YES")
    } else {
        fmt.Print("NO")
    }

}


package main

import "fmt"

func main() {
	var (
		a, b, c int
	)
	fmt.Scanf("%d%d%d", &a, &b, &c)
	if checkNum(a, b, c) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
func checkNum(a, b, c int) bool {
	if c == 0 {
		return a == b
	}
	leftOver := b - a
	if leftOver%c == 0 && leftOver/c > 0 {
		return true
	}
	return false
}


package main

import (
    "fmt"
)

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

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

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

        hasFirst := word[0] == target[1]
        hasSecond := word[1] == target[0]

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


package main

import (
    "fmt"
)

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

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

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

        hasFirst := word[0] == target[1]
        hasSecond := word[1] == target[0]

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


package main

import (
    "fmt"
)

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

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

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

        hasFirst := word[0] == target[1]
        hasSecond := word[1] == target[0]

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


package main

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

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

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

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


package main

import "fmt"

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


package main

import "fmt"

func main() {
    var n int    // membuat variabel n dengan jenis int
    var a [7]int  // membuat variabel array a dengan isi 7 elemen berjenis int
    fmt.Scan(&n)  // mengambil input
    for i := 0; i < 7; i++ {  // looping
        fmt.Scan(&a[i])   // mengambil input ke 2
        total += a[i]    / total ditambah array elemen ke i
    }
    n %= total       // n dimodulo total
    ans := 0    // membuat variabel ans kemudian diisi dengan 0
    if n == 0 {    // jika n sama denga 0
        ans = 6     // ans sama dengan 6
        for ; ans >= 0; ans-- {  // looping ke 2
            if a[ans] > 0 {   // jika array a elemen ke ans lebih besar dari 0
                break     // keluar dari fungsi
            }
        }
    } else {      // lainnya
        for n > a[ans] {  // looping ke 3
            n -= a[ans]  // n dikurang array a elemen ke ans
            ans++     // ans ditambah
        }
    }
    fmt.Println(ans+1)   // cetak hasil ans ditambah 1
}


package main

import (
	"fmt"
)

func solve(n int, is []int) {
	sum := 0
	for _, v := range is {
		sum += v
	}
	if n > sum {
		n = n % sum
	}

	for i, v := range is {
		if n-v <= 0 {
			fmt.Println(i + 1)
			return
		}
		n -= v
	}

}

func main() {
	var n, tmp int

	_, err := fmt.Scan(&n)
	if err != nil {
		panic(err)
	}
	is := make([]int, 0, 7)
	for i := 0; i < 7; i++ {
		fmt.Scan(&tmp)
		if err != nil {
			panic(err)
		}
		is = append(is, tmp)
	}
	solve(n, is)
}


package main

import (
	"fmt"
	"strings"
)

func main() {

	var wayLen, jumpDist int;
	fmt.Scanf("%d %d\n", &wayLen, &jumpDist)

	var wayMap string;
	fmt.Scan(&wayMap)

	gIdx := strings.Index(wayMap, "G")
	tIdx := strings.Index(wayMap, "T")

	if gIdx > tIdx {
		wayMap = Reverse(wayMap)
		gIdx, tIdx = tIdx, gIdx
	}

	for i := gIdx + jumpDist; i < wayLen; i += jumpDist {
		switch wayMap[i] {
			case '#': {
				fmt.Println("NO")
				return
			}
			case 'T': {
				fmt.Println("YES")
				return
			}
		}
	}

	fmt.Println("NO")
}

func Reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


package main

import (
	"fmt"
)

func pr(str string) int{
	k:=0;
	j:=0;
	k1:=-1
	//var newstr string
	for _,i:=range str{
		if i=='0'{
			k++
			j++
			if k>k1{
				k1=k
			}
		}else{
			k=0
			str=str[j:]
		}
	}
return k1
}
func pr1(str string) int{
	k:=0;
	j:=0;
	k1:=-1
	//var newstr string
	for _,i:=range str{
		if i=='1'{
			k++
			j++
			if k>k1{
				k1=k
			}
		}else{
			k=0
			str=str[j:]
		}
	}
	return k1
}

func main() {
	var str string
fmt.Scan(&str)
a:=pr1(str)
b:=pr(str)
if a>=7||b>=7{
	fmt.Println("YES")
}else{
	fmt.Println("NO")
}
}


package main

import (
	"fmt"
	"math"
	"runtime/debug"
)

type Range struct {
	left, right int
}

var (
	isNotPrime []bool
	primes     []int
	n          int
)

func main() {
	debug.SetGCPercent(-1)

	fmt.Scanf("%d", &n)
	// n = 14

	calcPrimes(n)

	x1Range := getRange(n)

	x0Range := getRange(x1Range.left)

	for i := x1Range.left + 1; i < x1Range.right; i++ {
		x0Range = joinRanges(x0Range, getRange(i))
	}

	fmt.Println(x0Range.left)
}

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 joinRanges(r1, r2 Range) Range {
	left := min(r1.left, r2.left)

	right := max(r1.right, r2.right)

	return Range{left, right}
}

func getRange(n int) Range {
	divider := findMaxPrimeDivider(n)

	return Range{n - divider + 1, n}
}

func findMaxPrimeDivider(x int) int {
	sqrtx := int(math.Sqrt(float64(x))) + 1

	for i := 0; i < len(primes) && primes[i] < sqrtx; i++ {
		if x%primes[i] == 0 {
			d := x / primes[i]

			for isNotPrime[d] && d%primes[i] == 0 {
				d /= primes[i]
			}

			if !isNotPrime[d] {
				return d
			}
		}
	}

	return 1
}

func calcPrimes(n int) {
	isNotPrime = make([]bool, n+1)

	for i := 2; i*i <= n; i++ {
		if !isNotPrime[i] {
			for j := i * i; j <= n; j += i {
				isNotPrime[j] = true
			}
		}
	}

	primes = make([]int, 0, n/2)

	for i := 2; i <= n; i++ {
		if !isNotPrime[i] {
			primes = append(primes, i)
		}
	}
}


package main

import (
	"fmt"
	"math"
	"runtime/debug"
)

type Range struct {
	left, right int
}

var (
	isNotPrime []bool
	primes     []int
	n          int
)

func main() {
	debug.SetGCPercent(-1)

	fmt.Scanf("%d", &n)
	// n = 1e6

	calcPrimes(n)

	x1Range := getRange(n)

	x0RangeMin := x1Range.left

	for i := x1Range.left + 1; i < x1Range.right; i++ {
		x0RangeMin = min(x0RangeMin, getRange(i).left)
	}

	fmt.Println(x0RangeMin)
}

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 getRange(n int) Range {
	divider := findMaxPrimeDivider(n)

	return Range{n - divider + 1, n}
}

func findMaxPrimeDivider(x int) int {
	sqrtx := int(math.Sqrt(float64(x))) + 1

	for i := 0; i < len(primes) && primes[i] < sqrtx; i++ {
		if x%primes[i] == 0 {
			x /= primes[i]

			for isNotPrime[x] && x%primes[i] == 0 {
				x /= primes[i]
			}

			if !isNotPrime[x] {
				return x
			}
		}
	}

	return 1
}

func calcPrimes(n int) {
	isNotPrime = make([]bool, n+1)

	for i := 2; i*i <= n; i++ {
		if !isNotPrime[i] {
			for j := i * i; j <= n; j += i {
				isNotPrime[j] = true
			}
		}
	}

	primes = make([]int, 0, n/2)

	for i := 2; i <= n; i++ {
		if !isNotPrime[i] {
			primes = append(primes, i)
		}
	}
}


package main

import "fmt"
import "sort"

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

	m := make(map[int]int)
	for i := 0; i < n; i++ {
		var temp int
		fmt.Scan(&temp)
		m[temp] = 0
	}

	if len(m) > 3 {
		fmt.Println(-1)
		return
	}

	k := make([]int, len(m))
	i := 0
	for key := range m {
		k[i] = key
		i++
	}

	if len(m) == 1 {
		fmt.Println(k[0])
	}

	sort.Ints(k)
	if len(m) == 2 {
		ans := k[1] - k[0]
		if (k[1] - k[0]) % 2 == 0 {
			ans = (k[1] - k[0]) / 2
		}
		fmt.Println(ans)
		return
	}

	sum := (k[0] + k[1] + k[2])
	if sum % 3 != 0 {
		fmt.Println(-1)
		return
	}

	if sum / 3 != k[1] {
		fmt.Println(-1)
		return
	}
	ans := k[2] - k[1]
	fmt.Println(ans)
	return
}


package main

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

func solve(a []int) int {
	m := map[int]bool{}
	var nums []int

	for _, n := range a {
		m[n] = true
	}

	L := len(m)

	if L > 3 {
		return -1
	}

	if L == 1 {
		return 0
	}

	i, avg := 0, 0
	for n := range m {
		nums = append(nums, n)
		avg += n
		i++
	}

	sort.IntSlice(nums).Sort()

	if avg%L > 0 {
		if L == 2 {
			return (nums[1] - nums[0])
		}
		return -1
	}

	avg /= L
	if L == 3 {
		if avg == nums[1] {
			return nums[2] - nums[1]
		}
	}

	if L == 2 {
		if avg%2 == 0 {
			avg /= 2
		}
		return avg
	}

	return -1
}

func toInt(buf []byte) int {
	n, mul := int(0), int(1)
	for i, v := range buf {
		if i == 0 && v == '-' {
			mul = int(-1)
			continue
		}
		n = n*10 + int(v-'0')
	}

	return mul * n
}

func main() {
	var n int

	fmt.Scan(&n)

	a := make([]int, n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := range a {
		scanner.Scan()
		a[i] = toInt(scanner.Bytes())
	}

	ans := solve(a)

	fmt.Println(ans)
}


package main

import (
	"fmt"
	"sort"
)

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

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

	sort.Ints(nums)
	for i := 1; i < n; i++ {
		nums[i] -= nums[0]
	}

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


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

package main

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

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

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

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

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

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

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


package main

import (
	"fmt"
)

func main() {
	var k, l, m1, n, d, res int

	fmt.Scanln(&k)
	fmt.Scanln(&l)
	fmt.Scanln(&m1)
	fmt.Scanln(&n)
	fmt.Scanln(&d)
	m := make(map[int]bool)

	for i := 0; i < d; i++ {
		m[i] = true
	}
	for i := k; i < d; i += k {
		if m[i] {
			m[i] = false
		}
	}
	for i := l; i < d; i += l {
		if m[i] {
			m[i] = false
		}
	}
	for i := m1; i < d; i += m1 {
		if m[i] {
			m[i] = false
		}
	}
	for i := n; i < d; i += n {
		if m[i] {
			m[i] = false
		}
	}

	for _, y := range m {
		if y == false {
			res++
		}
	}
	fmt.Println(res)

}


    package main

    import "fmt"

    func main(){
    	var k,l,m,n int
    	var d int

    	fmt.Scan(k)
     	fmt.Scan(l)
    	 	fmt.Scan(m)
    	 	fmt.Scan(n)
    	 	fmt.Scan(d)

        count:=0
    	for i := 1; i <=d; i++ {
    		if i%k==0 ||i%l==0 ||i%m==0 ||i%n==0  {
    			count++

    		}

    }
    fmt.Print(count)
    }


/*
Insomnia cure
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.

However, just counting dragons was boring as well, so she entertained herself at best she could. Tonight she imagined that all dragons were here to steal her, and she was fighting them off. Every k-th dragon got punched in the face with a frying pan. Every l-th dragon got his tail shut into the balcony door. Every m-th dragon got his paws trampled with sharp heels. Finally, she threatened every n-th dragon to call her mom, and he withdrew in panic.

How many imaginary dragons suffered moral or physical damage tonight, if the princess counted a total of d dragons?

Input
Input data contains integer numbers k, l, m, n and d, each number in a separate line (1 ≤ k, l, m, n ≤ 10, 1 ≤ d ≤ 105).

Output
Output the number of damaged dragons.

Sample test(s)
input
1
2
3
4
12
output
12
input
2
3
4
5
24
output
17
Note
In the first case every first dragon got punched with a frying pan. Some of the dragons suffered from other reasons as well, but the pan alone would be enough.

In the second case dragons 1, 7, 11, 13, 17, 19 and 23 escaped unharmed.
*/
package main

import (
	"fmt"
	"sort"
)

// 最大公約数
func gcd(a, b int) int {
    if b == 0 {
        return a
    }
        return gcd(b, a % b)
}

// 最小公倍数
func lcm(a, b int) int {
    return a * b / gcd(a, b)
}

func main() {
	var k, l, m, n, d int
	fmt.Scanf("%d\n%d\n%d\n%d\n%d\n", &k, &l, &m, &n, &d)
	hurtDragon := []int{k, l, m, n}
	sort.Ints(hurtDragon)
	var count int
	for i, n := 1, len(hurtDragon); i < n; i++ {
		for j := 0; j < i; j++ {
			if hurtDragon[j] == 0 {
				continue
			}
			if hurtDragon[i] % hurtDragon[j] == 0 {
				hurtDragon[i] = 0
				count++
				break
			}
		}
	}

	sort.Ints(hurtDragon)
	hurtDragon = hurtDragon[count:]
	count = 0
	for i, v := range hurtDragon {
		count += d/v
		for j := 0; j < i; j++ {
			count -= int(d/lcm(hurtDragon[j], hurtDragon[i]))
		}
	}
	doubleCounts := make([]int, 0)
	if len(hurtDragon) == 3 {
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[0], hurtDragon[1]), hurtDragon[2]))
	}
	if len(hurtDragon) == 4 {
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[0], hurtDragon[1]), hurtDragon[2]))
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[0], hurtDragon[1]), hurtDragon[3]))
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[1], hurtDragon[2]), hurtDragon[3]))
	}
	for _, v := range doubleCounts {
		count += d/v
	}
	fmt.Println(count)
}


/*
Insomnia cure
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard output
«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.

However, just counting dragons was boring as well, so she entertained herself at best she could. Tonight she imagined that all dragons were here to steal her, and she was fighting them off. Every k-th dragon got punched in the face with a frying pan. Every l-th dragon got his tail shut into the balcony door. Every m-th dragon got his paws trampled with sharp heels. Finally, she threatened every n-th dragon to call her mom, and he withdrew in panic.

How many imaginary dragons suffered moral or physical damage tonight, if the princess counted a total of d dragons?

Input
Input data contains integer numbers k, l, m, n and d, each number in a separate line (1 ≤ k, l, m, n ≤ 10, 1 ≤ d ≤ 105).

Output
Output the number of damaged dragons.

Sample test(s)
input
1
2
3
4
12
output
12
input
2
3
4
5
24
output
17
Note
In the first case every first dragon got punched with a frying pan. Some of the dragons suffered from other reasons as well, but the pan alone would be enough.

In the second case dragons 1, 7, 11, 13, 17, 19 and 23 escaped unharmed.
*/
package main

import (
	"fmt"
	"sort"
)

// 最大公約数
func gcd(a, b int) int {
    if b == 0 {
        return a
    }
        return gcd(b, a % b)
}

// 最小公倍数
func lcm(a, b int) int {
    return a * b / gcd(a, b)
}

func main() {
	var k, l, m, n, d int
	fmt.Scanf("%d\n%d\n%d\n%d\n%d\n", &k, &l, &m, &n, &d)
	hurtDragon := []int{k, l, m, n}
	sort.Ints(hurtDragon)
	var count int
	for i, n := 1, len(hurtDragon); i < n; i++ {
		for j := 0; j < i; j++ {
			if hurtDragon[j] == 0 {
				continue
			}
			if hurtDragon[i] % hurtDragon[j] == 0 {
				hurtDragon[i] = 0
				count++
				break
			}
		}
	}

	sort.Ints(hurtDragon)
	hurtDragon = hurtDragon[count:]
	count = 0
	for i, v := range hurtDragon {
		count += d/v
		for j := 0; j <  i; j++ {
			count -= int(d/lcm(hurtDragon[j], hurtDragon[i]))
		}
	}
	doubleCounts := make([]int, 0)
	if len(hurtDragon) == 3 {
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[0], hurtDragon[1]), hurtDragon[2]))
	}
	if len(hurtDragon) == 4 {
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[0], hurtDragon[1]), hurtDragon[2]))
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[0], hurtDragon[1]), hurtDragon[3]))
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[0], hurtDragon[2]), hurtDragon[3]))
		doubleCounts = append(doubleCounts, lcm(lcm(hurtDragon[1], hurtDragon[2]), hurtDragon[3]))
		doubleCounts = append(doubleCounts, -lcm(lcm(lcm(hurtDragon[1], hurtDragon[2]), hurtDragon[3]), hurtDragon[0]))
		sort.Ints(doubleCounts)
		var countDouble int
		for i, n := 1, len(doubleCounts); i < n; i++ {
			for j := 0; j < i; j++ {
				if doubleCounts[j] == 0 {
					continue
				}
				if doubleCounts[i] % doubleCounts[j] == 0 {
					doubleCounts[i] = 0
					countDouble++
					break
				}
			}
		}
		sort.Ints(doubleCounts)
		doubleCounts = doubleCounts[countDouble:]
	}

	for _, v := range doubleCounts {
		count += d/v
	}
	fmt.Println(count)
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF148D(_r io.Reader, _w io.Writer) {
	var W, B int
	Fscan(_r, &W, &B)
	dp := make([][][2]float64, W+1)
	for i := range dp {
		dp[i] = make([][2]float64, B+1)
		for j := range dp[i] {
			dp[i][j] = [2]float64{-1, -1}
		}
	}
	var f func(w, b, who int) float64
	f = func(w, b, who int) (res float64) {
		if w == 0 {
			if who == 0 {
				return 0
			}
			return 1
		}
		if b == 0 {
			return 1
		}
		dv := &dp[w][b][who]
		if *dv != -1 {
			return *dv
		}
		defer func() { *dv = res }()
		return (float64(w) + float64(b)*(1-f(w, b-1, who^1))) / float64(w+b)
	}
	Fprintf(_w, "%.10f", f(W, B, 0))
}

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


package main

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

func Sol1152C(reader io.Reader, writer io.Writer) {
	in := bufio.NewReader(reader)
	out := bufio.NewWriter(writer)
	defer out.Flush()

	var a, b int64
	Fscan(in, &a, &b)
	if a > b {
		a, b = b, a
	}

	delta := b - a
	if delta == 0 {
		Fprintln(out, 0)
	} else {
		Fprintln(out, (delta-a%delta)%delta)
	}
}

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


package main

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

// var input, inputerr = os.Open("./input")
// var output, outputerr = os.Create("./output")
// var reader = bufio.NewReader(input)
// var writer = bufio.NewWriter(output)

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

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

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

func lcm(a, b int64) int64 {
	result := a * b / gcd(a, b)

	return result
}

func main() {
	defer writer.Flush() // STDOUT MUST BE FLUSHED MANUALLY!!!
	var a, b int64
	scan(&a, &b)

	if b < a {
		a, b = b, a
	}

	if b%a == 0 {
		print(0)
		print("\n")
		return
	}

	d := b - a
	sqrtD := math.Sqrt(float64(d))
	var divs []int64
	for i := int64(1); i <= int64(sqrtD); i++ {
		if d%i == 0 {
			nxt := d / i
			divs = append(divs, i)
			if nxt != i {
				divs = append(divs, nxt)
			}
		}
	}

	lcmMin := math.Inf(1)
	minK := math.Inf(1)

	for _, q := range divs {
		if a%q != b%q {
			continue
		}
		var val float64
		k := q
		if a%q == 0 {
			val = float64(lcm(int64(a+q), int64(b+q)))
		} else {
			k = q - (a % q)
			val = float64(lcm(int64(a+k), int64(b+k)))
		}
		if val < lcmMin {
			lcmMin = val
			minK = float64(k)
		}
	}

	print(int(minK))
	print("\n")
}


package main

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

// var input, inputerr = os.Open("./input")
// var output, outputerr = os.Create("./output")
// var reader = bufio.NewReader(input)
// var writer = bufio.NewWriter(output)

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

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

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

func lcm(a, b int64) int64 {
	result := a * b / gcd(a, b)

	return result
}

func main() {
	defer writer.Flush() // STDOUT MUST BE FLUSHED MANUALLY!!!
	var a, b int64
	scan(&a, &b)

	if b < a {
		a, b = b, a
	}

	if b%a == 0 {
		print(0)
		print("\n")
		return
	}

	d := b - a
	lcmMin := math.Inf(1)
	minK := math.Inf(1)

	for q := int64(1); q <= d; q++ {
		if d%q == 0 && (a%q == b%q) {
			var val float64
			k := q
			if a%q == 0 {
				val = float64(lcm(int64(a+q), int64(b+q)))
			} else {
				k = q - (a % q)
				val = float64(lcm(int64(a+k), int64(b+k)))
			}
			if val < lcmMin {
				lcmMin = val
				minK = float64(k)
			}
		}
	}
	print(int(minK))
	print("\n")
}


package main

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

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	k := scanInt(scanner)
	scanner.Scan()
	s := scanner.Text()
	n := len(s)
	pal := make([]uint8, n)
	for i, ch := range s {
		pal[i] = uint8(ch)
	}
	for i := (n-1)/2; i >= 0; i-- {
		j := n-1-i
		if pal[i] == pal[j] {
			continue
		}
		if pal[i] == '?' {
			pal[i] = pal[j]
		} else if pal[j] == '?' {
			pal[j] = pal[i]
		} else {
			writer.WriteString("IMPOSSIBLE\n")
			return
		}
	}
	seen := map[uint8]bool{}
	for i := 0; i < k; i++ {
		seen['a'+uint8(i)] = false
	}
	for _, ch := range pal {
		if ch != '?' {
			seen[ch] = true
		}
	}
	need := []uint8{}
	for ch, ok := range seen {
		if !ok {
			need = append(need, ch)
		}
	}
	/*
	for _, ch := range pal {
		writer.WriteString(fmt.Sprintf("%c", ch))
	}
	writer.WriteString(fmt.Sprintf(" (k = %d)\n", k))
	writer.WriteString(fmt.Sprintf("need %d:", len(need)))
	for _, ch := range need {
		writer.WriteString(fmt.Sprintf(" %c", ch))
	}
	writer.WriteString("\n")
	*/
	nix := len(need)-1
	for i := (n-1)/2; i >= 0; i-- {
		if pal[i] != '?' {
			continue
		}
		j := n-1-i
		if nix == -1 {
			pal[i] = 'a'
			pal[j] = 'a'
		} else {
			pal[i] = need[nix]
			pal[j] = need[nix]
			nix--
		}
	}
	if nix != -1 {
		writer.WriteString("IMPOSSIBLE\n")
		return
	}
	for _, ch := range pal {
		writer.WriteString(fmt.Sprintf("%c", ch))
	}
	writer.WriteString("\n")
}


package main

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

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

func transform(s string) string {
	t := strings.Split(s, "e")

	a := t[0][:1]
	d := t[0][2:]

	b, _ := strconv.Atoi(t[1])
	for len(d) < b {
		d = d + "0"
	}

	r := a + d[:b]
	if b < len(d) {
		r = r + "." + d[b:]
	}

	return r
}

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

	var s string
	fmt.Fscan(bufin, &s)
	fmt.Fprintln(bufout, transform(s))
}


package main

import (
            "fmt"
            "bytes"
            "strconv"
        )

func Trim(x string, begin, end bool) string {
    var a, b int = 0, len(x) - 1

    if begin {
        for string(x[a]) == "0" && a < b && string(x[a + 1]) != "."{
            a++
        }
    }

    if end {
        for (string(x[b]) == "0" || string(x[b]) == ".") && b > a {
            b--
        }
    }

    return x[a:b + 1]
}

type ExponentialNumber struct {
    n string
    exp string
}

func (e ExponentialNumber) String() string {
    var result string
    var s string = e.n
    var length int = len(s)
    exp, _ := strconv.Atoi(e.exp)
    exp += 1

    var buffer bytes.Buffer

    var fs int = exp
    if fs > length {
        fs = length

        buffer.WriteString(s)

        for i := 0; i < exp - length; i++ {
            buffer.WriteString("0")
        }

        result = Trim(buffer.String(), true, false)
    } else {
        buffer.WriteString(Trim(s[:fs], true, false))

        var p string = Trim(s[fs:], false, true)
        if p != "0" {
            buffer.WriteString(".")
            buffer.WriteString(p)
        }

        result = buffer.String()
    }

    return result
}

func main() {
    var input string
    fmt.Scanln(&input)
    var a_s string //= fmt.Sprint(a), fmt.Sprint(d)

    var buffer bytes.Buffer

    i := 0
    for i < len(input) {
        if string(input[i]) == "e" {
            break
        }

        if string(input[i]) != "." {
            buffer.WriteByte(input[i])
        }

        i++
    }

    a_s = buffer.String()

    e := ExponentialNumber{a_s, input[i + 1:]}

    fmt.Println(e)
}


package main
import "fmt"

func max3(x, y, z int) (int, bool){
	if (x > y) && (x > z) && ((x - y - z) <= 0){
		return x - y - z, true
	}else if (y > x) && (y > z) && ((y - x - z) <= 0){
		return y - x - z, true
	}else if (z>y)&&(z > x)&&((z-y-x) <= 0){
		return z-y-x, true
	}else{
		return 0, false
	}
}

func main() {
	sticks := make([]int, 4)
	fmt.Scan(&sticks[0], &sticks[1], &sticks[2], &sticks[3])
	ans := "IMPOSSIBLE"
	for i := 0; i < 4; i++{
		if c, ok:= max3(sticks[i%4], sticks[(i+1)%4], sticks[(i+2)%4]); (c < 0) && ok {
			ans = "TRIANGLE"
			break
		}else if (c == 0) && ok{
			ans = "SEGMENT"
		}
	}

	fmt.Print(ans)
}


package main

import (
	"fmt"
)

func main() {
	var l [4]int
	if _, err := fmt.Scanf("%d %d %d %d\n", &l[0], &l[1], &l[2], &l[3]); err != nil {
		return
	}

	segment := false

	var t [3]int
	for i := 0; i < 4; i++ {
		k := 0
		for j := 0; j < 4; j++ {
			if j != i {
				t[k] = l[j]
				k++
			}
		}
		s := traingle(t)
		if s == 1 { // Traingle
			fmt.Println("TRAINGLE")
			return
		} else if s == 2 { // Degenerate Traingle
			segment = true
		}
	}

	if segment {
		fmt.Println("SEGMENT")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}

func traingle(t [3]int) int {
	sum := 0
	max := 0
	for i := 0; i < 3; i++ {
		sum += t[i]
		if t[i] > max {
			max = t[i]
		}
	}

	if sum-max == max {
		return 2
	} else if sum-max > max {
		return 1
	} else {
		return 0
	}
}


package main

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

func main() {
	// var a string
	var n int
	// var x float64
	// var s string
	scr := bufio.NewReader(os.Stdin)
	// ocr := bufio.NewWriter(os.Stdout)

	fmt.Fscanln(scr, &n)

	if n == 1 {
		fmt.Println("0")
	} else {
		if n%2 == 0 {
			fmt.Println(math.Pow(2, float64(n/2)))
		} else {
			fmt.Println("0")
		}
	}

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

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


package main

import (
  "fmt"
)

func main() {
    var n int
    fmt.Scanf("%d", &n)
    if n<2 {
        fmt.Println(0)
        return
    }
    k := 1;
    for i:=0;i<n/2;i++{
        k*=2
    }
    if n%2==1 {
        k*= n/2+1
    }
    fmt.Printf("%d", k)
}


package main

import (
	"fmt"
)

var mod int = 1000000007

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

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

func max(arr []int) (max int) {
	max = arr[0]
	for _, val := range arr {
		if val > max {
			max = val
		}
	}
	return max
}

func power(x float64, y int) float64 {
	var temp float64
	if y == 0 {
		return 1
	}
	temp = power(x, y/2)
	if y%2 == 0 {
		return temp * temp
	} else {
		if y > 0 {
			return x * temp * temp
		}
		return (temp * temp) / x
	}
}

func main() {
	var m int
	fmt.Scan(&m)
	if m%2 == 1 {
		fmt.Println(0)
	} else {
		fmt.Println(power(float64(2), m/2))
	}
}


package main

import "fmt"

func main() {
	var input string
	var stateArray = 0
	var resetArray = func() {
		stateArray = 0
	}
	var countArray = func() int {
		return (stateArray&8)>>3 + (stateArray&4)>>2 + (stateArray&2)>>1 + (stateArray & 1)
	}

	fmt.Scanln(&input)

	for _, v := range input {
		var c = uint(0)

		switch v {
		case '.':
			c = 0
			break
		case 'A':
			c = 1
			break
		case 'B':
			c = 2
			break
		case 'C':
			c = 3
			break
		default:
			panic("should not reach here")
		}

		if c == 0 {
			resetArray()
			continue
		}

		if ((1 << c) & stateArray) > 1 {
			resetArray()

			stateArray = 1 << c
		} else {
			stateArray |= 1 << c
		}

		if countArray() == 3 {
			fmt.Println("YES")
			return
		}
	}

	fmt.Println("NO")
}


package main

import "fmt"

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

	squares := []rune(s)

	isFound := false
	for i := 0; i < len(s)-2; i++ {
		first, second, third := squares[i], squares[i+1], squares[i+2]

		if (first == 'A' && second == 'B' && third == 'C') ||
			(first == 'A' && second == 'C' && third == 'B') ||
			(first == 'B' && second == 'A' && third == 'C') ||
			(first == 'B' && second == 'C' && third == 'A') ||
			(first == 'C' && second == 'A' && third == 'B') ||
			(first == 'C' && second == 'B' && third == 'A') {
				fmt.Print("YES")
				isFound = true
		}
	}
	if !isFound {
		fmt.Print("NO")
	}
}


package main

import (
	"bufio"
	"os"
)

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

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

func printText(text string) {
	writer.WriteString(text)
}

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

	// letters := []string{"A", "B", "C"}
	str := readText()
	// printText(str)

	str_len := len(str)
	for i, _ := range str {
		if i < str_len-2 {
			l1 := str[i]
			l2 := str[i+1]
			l3 := str[i+2]

			if (l1 == 'A' && l2 == 'B' && l3 == 'C') ||
				(l1 == 'A' && l2 == 'C' && l3 == 'B') ||
				(l1 == 'B' && l2 == 'A' && l3 == 'C') ||
				(l1 == 'B' && l2 == 'C' && l3 == 'A') ||
				(l1 == 'B' && l2 == 'A' && l3 == 'B') ||
				(l1 == 'C' && l2 == 'B' && l3 == 'A') {
				printText("Yes")
				goto a1
			}
		}
	}

	printText("No")
a1:
}


package main

import (
	"bufio"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"sort"
	"strconv"
	"strings"
)

type diameter struct {
	io *IO
}

func (d *diameter) out(deleteN int) {
	d.io.Printf("%d", deleteN)
}

func main() {
	//log.SetOutput(os.Stdout)
	log.SetOutput(ioutil.Discard)

	io := NewStdIO()
	defer io.Flush()
	d := diameter{io: io}

	l1 := d.io.NextSplitLine(" ")
	n, dmax := stoi(l1[0]), stoi(l1[1])
	log.Printf("n=%d, dmax=%d", n, dmax)

	if n <= 1 {
		d.out(0)
		return
	}

	l2 := d.io.NextSplitLine(" ")
	nset := make([]int, n)
	for i, ns := range l2 {
		nset[i] = stoi(ns)
	}
	sort.Ints(nset)

	minN := 101
	for i := 0; i < n; i++ {
		cnt := 0
		for j := i; j < n; j++ {
			log.Printf("i=%d, j=%d, minN=%d", i, j, minN)
			if (nset[j] - nset[i]) > dmax {
				minN = min(minN, n-cnt)
				break
			}
			cnt++
		}
	}
	if minN == 101 {
		d.out(0)
		return
	}
	d.out(minN)
}

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

func stoi(s string) int {
	i, err := strconv.Atoi(s)
	if err != nil {
		fmt.Println(i)
		fmt.Println(err)
	}
	return i
}

// NewStdIO return standard IO instance.
func NewStdIO() *IO {
	return &IO{
		In:  bufio.NewReader(os.Stdin),
		Out: bufio.NewWriter(os.Stdout),
	}
}

// IO supports IO processing.
type IO struct {
	In  *bufio.Reader
	Out *bufio.Writer
}

// Flush outputs buffed data.
func (io *IO) Flush() {
	if err := io.Out.Flush(); err != nil {
		panic(err)
	}
}

// Printf writes string to buffer.
func (io *IO) Printf(format string, a ...interface{}) {
	if _, err := fmt.Fprintf(io.Out, format, a...); err != nil {
		panic(err)
	}
}

// NextInt reads a next line and convert it to integer
func (io *IO) NextInt() int {
	return stoi(io.Next())
}

// NextSplitLine reads a next line and return split string
func (io *IO) NextSplitLine(d string) []string {
	return strings.Split(io.Next(), d)
}

// Next reads line and return string.
func (io *IO) Next() string {
	var b []byte
	for {
		l, pre, err := io.In.ReadLine()
		if err != nil {
			panic(err)
		}
		b = append(b, l...)
		if !pre {
			break
		}
	}
	return string(b)
}


package main

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

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

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

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

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

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

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

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

			return
		}

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

	}

	fmt.Println("NO")

}


package main

import "fmt"

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


package main

import "fmt"

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


package main

import (
	"fmt"
	"os"
)

type node struct {
	value int
	count int
	prev  *node
}

func newNode(n int) *node {
	return &node{
		value: n,
	}
}

func main() {
	seen := make(map[int]bool)
	var a, b int
	fmt.Fscanf(os.Stdin, "%d %d", &a, &b)
	queue := []*node{newNode(b)}

	for len(queue) > 0 {
		curr := queue[0]
		queue = queue[1:]

		if curr.value == a {
			fmt.Println("YES")
			fmt.Println(curr.count + 1)
			for n := curr; n != nil; n = n.prev {
				fmt.Printf("%d ", n.value)
			}
			fmt.Println()
			return
		}
		if curr.value < a || seen[curr.value] {
			continue
		}
		seen[curr.value] = true

		n := newNode(curr.value >> 1)
		n.count = curr.count + 1
		n.prev = curr
		queue = append(queue, n)
		if curr.value%10 == 1 {
			n := newNode(curr.value / 10)
			n.count = curr.count + 1
			n.prev = curr
			queue = append(queue, n)
		}
	}
	fmt.Println("NO")
}


package main

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

type qu struct {
	pos, old int
}

func main() {
	var (
		recipe string
		nb, ns, nc int64
		pb, ps, pc int64
		cb, cs, cc int64
		rub int64
	)
	input = bufio.NewReader(os.Stdin)
	fmt.Fscanln(input, &recipe)
	fmt.Fscan(input, &nb, &ns, &nc)
	fmt.Fscan(input, &pb, &ps, &pc)
	fmt.Fscan(input, &rub)

	for i := 0; i < len(recipe); i++ {
		switch recipe[i] {
		case 'B': cb++
		case 'S': cs++
		case 'C': cc++
		}
	}
	l, r := int64(0), int64(1e12 + 1000)
	for l < r {
		mid := l + (r - l) / 2
		var b, s, c int64
		if cb > 0 { b = mid*cb*pb - nb*pb }
		if cs > 0 { s = mid*cs*ps - ns*ps }
		if cc > 0 { c = mid*cc*pc - nc*pc }
		cost := b + s + c
		if cost <= rub {
			l = mid + 1
		} else {
			r = mid
		}
	}

	fmt.Println(r - 1)
}


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

package main

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

const MaxBurgers = int64(1e12)

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

func p(burgers, cb, cs, cc, nb, ns, nc, pb, ps, pc int64) int64 {
	return max(0, cb*burgers-nb)*pb + max(0, cs*burgers-ns)*ps + max(0, cc*burgers-nc)*pc
}

func _Solve(left, right, cb, cs, cc, nb, ns, nc, pb, ps, pc, rubles int64) int64 {
	if !(left < right) {
		return left
	}
	m := (left + right + 1) / 2
	cost := p(m, cb, cs, cc, nb, ns, nc, pb, ps, pc)
	if cost <= rubles {
		return _Solve(m, right, cb, cs, cc, nb, ns, nc, pb, ps, pc, rubles)
	}
	return _Solve(left, m-1, cb, cs, cc, nb, ns, nc, pb, ps, pc, rubles)
}

func Solve(s string, nb, ns, nc, pb, ps, pc, r int64) int64 {
	cb := int64(strings.Count(s, "B"))
	cs := int64(strings.Count(s, "S"))
	cc := int64(strings.Count(s, "C"))
	return _Solve(0, MaxBurgers, cb, cs, cc, nb, ns, nc, pb, ps, pc, r)
}

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

	var s string
	fmt.Fscanf(reader, "%s\n", &s)
	var nb, ns, nc int64
	fmt.Fscanf(reader, "%d %d %d\n", &nb, &ns, &nc)
	var pb, ps, pc int64
	fmt.Fscanf(reader, "%d %d %d\n", &pb, &ps, &pc)
	var r int64
	fmt.Fscanf(reader, "%d\n", &r)

	fmt.Fprintf(writer, "%d\n", Solve(s, nb, ns, nc, pb, ps, pc, r))
}


package main

import (
    "fmt"
    )
func main(){
    int n,s
    fmt.Scan(&n,&s)
    flag := True
    for i := 0; i < n; i++ {
        int a
        fmt.Scan(&a)
        if s<=a {
            flag = False;
        }
    }
    if flag {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }

}


package main

import (
	"fmt"
)

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

}


package main

import (
	"fmt"
	"sort"
)

func read() int {
	var number int
	fmt.Scan(&number)
	return number
}

func main() {
	var growRateForMonth []int = make([]int, 12)

	growMin := readInt()

	for i := 0; i < 12; i++ {
		growRateForMonth[i] = readInt()
	}

	sort.Sort(sort.Reverse(sort.IntSlice(growRateForMonth)))

	totalMonths := 0

	for _, monthValue := range growRateForMonth {
		if growMin <= 0 {
			break
		}

		growMin -= monthValue
		totalMonths++
	}

	// wattt

	if totalMonths == 12 && growMin > 0 {
		fmt.Println(-1)
	} else {
		fmt.Println(totalMonths)
	}
}


package main

import (
    "fmt"
    "sort"
)

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


// 149A-Mic
package main

import (
    "fmt"
    "sort"
)

func main() {
    var k int
    x := 1
    y := 0
    cou := 1
    min := cou
    fmt.Scan(&k)
    m := make([]int, 12)
    for i := 0; i < 12; i++ {
        fmt.Scan(&m[i])
    }
    sort.Sort(sort.Reverse(sort.IntSlice(m)))
    if k == 0 {
        fmt.Println("0")
        return
    }
    k -= m[y]
    for x != 11 {
        if k > 0 {
            k -= m[x]
            cou++
        } else if k <= 0 {
            min = cou
            break
        }
    }
    fmt.Println(min)
}


package main
import (
  "fmt"
  "sort"
  )

func main(){
  var n int
  var l [12]int
  fmt.Scan(&n)
  for i:=0;i<12;i++{
    fmt.Scan(&l[i])
    }
  sort.Sort(sort.Reverse(sort.IntSlice(l)))
  if n == 0 {
    fmt.Println(0)
    } else {
     k := 0
    m := 0
    for _,i := range l {
      m += i
      if m < n {
        k++
        }
      }
    if m >= n {
      fmt.Println(k+1)
    }else{
      fmt.Println(-1)
      }
  }
}


package main

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

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

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

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

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

		if k < n {
			area1 := n * (m / (k + 1))
			area2 := n / (k + 1) * m
			if area1 > area2 {
				fmt.Println(area2)
			} else {
				fmt.Println(area1)
			}
		} else if n <= k && k < m {
			fmt.Println(n * (m / (k + 1)))
		} else if m <= k && k <= n+m-2 {
			fmt.Println((n / (k + 2 - m) * m / m))
		} else {
			fmt.Println(-1)
		}
	}
}


package main

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

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

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

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

		bestSize := -1
		for i := 0; i < n && i < k+1; i++ {
			var size_n, size_m, size_n1, size_n2, size_m1, size_m2 int

			size_n1 = n / (i + 1)
			size_n2 = n - size_n1*(i)

			if size_n1 > size_n2 && size_n2 != 0 {
				size_n = size_n2
			} else {
				size_n = size_n1
			}

			if m < k-i+1 {
				continue
			}
			size_m1 = m / (k - i + 1)
			size_m2 = m - size_m1*(k-i)
			if size_m1 > size_m2 && size_m2 != 0 {
				size_m = size_m2
			} else {
				size_m = size_m1
			}

			if size_n*size_m > bestSize {
				bestSize = size_n * size_m
			}
		}
		fmt.Println(bestSize)
	}
}