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

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

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

func main() {

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

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

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

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

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

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

	fmt.Print("OK")
}


package main

import "fmt"

type crushes []int

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

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

func lcmm(a ...int) int64 {
	l := int64(a[0])
	for _, v := range a {
		l = lcm(l, int64(v))
	}
	return l
}

func (cr crushes) CountStepsToReturn(start int) int {
	cnt := 1
	cur := start
	for cnt <= len(cr) {
		cur = cr[cur]
		if cur == start {
			break
		}
		cnt++
	}
	if cnt > len(cr) {
		return -1
	}
	return cnt
}

func main() {
	var n int
	fmt.Scan(&n)
	var cr crushes = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&cr[i])
		cr[i]--
	}
	min := make([]int, n)
	var ans int
	for i := 0; i < n; i++ {
		m := cr.CountStepsToReturn(i)
		if m == -1 {
			ans = -1
			break
		} else if m%2 == 0 {
			m = m / 2
		}
		min[i] = m
	}
	if ans != -1 {
		ans = lcmm(min...)
	}
	fmt.Println(ans)
}


#include <iostream>
using namespace std;

int main() {
  int n, index;
  cin >> n >> index;
  index--;

      bool c[n];
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    c[i] = num == 1;
  }

  int total = c[index] ? 1 : 0;
  for (int i = 1; i < 100; i++) {
    int l = index - i, r = index + i;
    if ((l >= 0) && (r < n) && c[l] && c[r])
      total += 2;

    if ((l >= 0) && (r >= n) && c[l])
      total++;

    if ((l < 0) && (r < n) && c[r])
      total++;
  }

  cout << total << endl;
}


package main

import "fmt"

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


package main

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

func main() {
	var n, k int
	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &n, &k)
	ans := 11111111111
	for i := 0; i < n; i++ {
		var val int
		fmt.Scanf("%d", &val)
		if k%val == 0 {
			if ans > k/val {
				ans = k / val
			}
		}
	}
	fmt.Println(ans)
}


package main

import (
	"fmt"
	"os"
	)

const INF = 0x3f3f3f3f

var n, m, tot int

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

func main() {
	// fd, _ := os.Open("in.txt")
	// os.Stdin = fd
	var T int = 1
	// fmt.Scanf("%d", &T)
	for ci:=1; ci<=T; ci++ {
		fmt.Scanf("%d %d", &n, &m)
		// fmt.Printf("Case #%d: ", ci)
		var ans int = 0
		for i:=1; i<=n; i++ {
			var x int
			fmt.Scanf("%d", &x)
			if m%x==0 {
				ans = m/x
			}
		}
		fmt.Printf("%d\n", ans)
	}
}


package main

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

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

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

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

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


package main

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

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

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

const N int = 100

func main() {
	io := NewIO()

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

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

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


package main

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

func solve() {
	n := readInt()
	k := readInt()
	if k == 0 {
		fmt.Println(0, 0)
		return
	}
	a := 0
	if k < n {
		a = 1
	}
	b := min(n-k, k*2)
	fmt.Println(a, b)
}

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

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

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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


import "fmt"

func main() {
	var (
		n int
		k int
	)
	fmt.Scan(&n, &k)
	min, max := Calculate854B(n, k)
	fmt.Print(min, max)
}

func Calculate854B(n int, k int) (int, int) {
	var min = 1
	var max = n - k
	if k <= n/3 {
		max = k * 2
	}
	if n == k || k == 0 {
		min = 0
		max = 0
	}
	return min, max
}


package main

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

func solve() {
	n := readInt()
	k := readInt()
	if k == 0 {
		fmt.Println(0, 0)
		return
	}
	minAns := 0
	maxAns := 0
	if k < n {
		minAns = 1
	}
	maxAns = min((n - k), k+1)
	fmt.Println(minAns, maxAns)
}

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

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

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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


package main

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

func main (){
    var n, k int
    var s string
    reader := bufio.NewReader(os.Stdin)
    fmt.Scan(&n, &k )

    entrada, _ := reader.ReadString('\r')
    s = strings.TrimRight(entrada, "\n")
    arrs := strings.Field()

    var t2[] int
    dic:= map[int] bool {}

    for pos, i := range arrs {
      j, _ := strconv.Atoi(i)
      _, ok := dic[j]
      if !ok {
        dic[j] = true
        t2 = append(t2, pos+1)
      }

    }

    if len(dic) < k {
      fmt.Println("NO")
    } else {
      sort.Ints(t2)
      fmt.Println("YES")
      fmt.Println(strings.Trim(fmt.Sprint(t2), "[]"))
    }

}


// Codeforces 988 A Diverse Team train
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
	"sort"
)
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,k int
var a []int
var team []int
var tidx []int
var canForm bool

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n, k
	n, k, _, _, _ = readFive()
	// reading a
	a = readLineNumbs(n)
}

func solve() {
	sort.Ints(a)
	tlast = -1
	team = make([]int,k)
	it := 0
	for i:=0; i<n && it<k; i++ {
		if it==0 || a[i] != tlast {
			team[it] = i
			tlast = a[i]
			it++
			if it>=k {
				break
			}
		}
	}
	canForm = (it == k)
}

func printRes() {
	if canForm {
		fmt.Println("YES")
		for i:=0; i<k; i++ {
			fmt.Print(strconv.Itoa(team[i]) + " ")
		}
		fmt.Println()
	} else {
		fmt.Println("NO")
	}
}

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


package main

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

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

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

	keys := []string{
		"qwertyuiop",
		"asdfghjkl;",
		"zxcvbnm, ./",
	}

	dx := 1
	if next() == "R" {
		dx = -1
	}

	for _, k := range next() {
		for _, s := range keys {
			if strings.IndexRune(s, k) > -1 {
				fmt.Print(string(s[strings.IndexRune(s, k) + dx]))
			}
		}
	}

}

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


package main

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

var reader io.Reader
var scanner *bufio.Scanner

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

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

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

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

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

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

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

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

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

func reverseInts(a []int) {
	for l, r := 0, len(a)-1; l < r; l, r = l+1, r-1 {
		a[l], a[r] = a[r], a[l]
	}
}

func unique(a []int) int {
	newLen := 0
	n := len(a)
	for i := 0; i < n; i++ {
		if newLen == 0 || a[i] != a[newLen-1] {
			a[newLen] = a[i]
			newLen++
		}
	}
	return newLen
}

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 main() {
	inf := os.Stdin
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	// inf, err := os.Open("a.in")
	// if err != nil {
	// 	die(err)
	// }
	// out, err := os.Create("a.out")
	// if err != nil {
	// 	die(err)
	// }
	// defer out.Close()
	Init(inf, 1000010)

	u := NextInt64()
	v := NextInt64()
	MAXP := 63
	MAXC := 4
	a := make([]int, MAXP)
	b := make([]int, MAXP)

	for i := 0; i < MAXP; i++ {
		a[i] = int(u & 1)
		b[i] = int(v & 1)
		u >>= 1
		v >>= 1
	}

	dp := make([][]int, MAXP)
	p := make([][][3]int, MAXP)
	for i := 0; i < MAXP; i++ {
		dp[i] = make([]int, MAXC)
		p[i] = make([][3]int, MAXC)
		for j := 0; j < MAXC; j++ {
			dp[i][j] = -1
		}
	}

	MAXINT := 1000000000

	var f func(i, carry int) int
	f = func(i, carry int) int {

		if i == -1 {
			if carry == 0 {
				return 0
			} else {
				return MAXINT
			}
		}

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

		res := MAXINT
		resk1, resc := -1, -1

		for k1 := 0; k1 < MAXP*2; k1++ {
			if (k1 >> 1) > carry {
				break
			}
			if (k1 & 1) != a[i] {
				continue
			}
			for ncarry := 0; ncarry < MAXC; ncarry++ {
				if ((k1 + ncarry) >> 1) > carry {
					break
				}
				if ((k1+ncarry)>>1) == carry && ((k1+ncarry)&1) == b[i] {
					t := max(k1, f(i-1, ncarry))
					if t < res {
						res = t
						resk1 = k1
						resc = ncarry
					}
				}
			}
		}
		dp[i][carry] = res
		p[i][carry][1] = resk1
		p[i][carry][2] = resc
		return res
	}

	res := f(MAXP-1, 0)
	if res == MAXINT {
		fmt.Fprintln(out, -1)
		return
	}

	fmt.Fprintln(out, res)

	ans := make([]int, res)

	for i, carry, j := MAXP-1, 0, 0; i >= 0; i-- {
		ncarry := p[i][carry][2]
		k1 := p[i][carry][1]
		for k1 > 0 {
			ans[j] |= (1 << i)
			j++
			if j == res {
				j = 0
			}
			k1--
		}
		carry = ncarry
	}

	for i := 0; i < res; i++ {
		fmt.Fprint(out, ans[i], " ")
	}
}


package main

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

func main(){
	var s,v1,v2,t1,t2 int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&s,&v1,&v2,&t1,&t2)
	a1 := 2*t1+s*v1
	a2 := 2*t2+s*v2
	if a1<a2{
		fmt.Println("First")
	}else if{
		fmt.Println("Second")
	}else{
		fmt.Println("Friendship")
	}
}


```package main

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

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

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

func main() {
	defer writer.Flush()
	var d int
	scanf("%d\n", &d)
	var s string
	scanf("%s\n", &s)
	sa := []byte(s)
	cur := 0
	for _, c := range sa {
		if c == '-' {
			cur--
		} else {
			cur++
		}
		if cur < 0 {
			cur = 0
		}
	}

	printf("%d", cur)
}


#include <bits/stdc++.h>
#define tr(v,it) for(auto it=v.begin(); it!=v.end(); it++)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define F first
#define S second
#define endl "\n"
#define MOD 1000000007
#define pie 3.141592653589793
#define INF 1e18
using namespace std;

int main()
{
        //freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);

        ios::sync_with_stdio(0); cin.tie(0);

        long long n;
        cin>>n;
        double value=0;
        long long x,y;
        for(int i=1; i<=n; i++)
        {
                for(int j=i; j<=n; j++)
                {
                        long long a=i;
                        long long b=j;
                        if(a+b==n)
                        {
                                long long k=__gcd(i,j);
                                if(k==1)
                                {
                                        double tempv=(a*1.0/b);
                                        if(tempv>value)
                                        {
                                                x=i;
                                                y=j;
                                        }
                                }
                        }

                }
        }
        cout<<x<<" "<<y<<endl;

        return 0;
}


package main

import "testing"

func Test_1(t *testing.T) {
	tests := []struct {
		s int
		want int
	}{
		{
			s: 20,
			want: 389,
		},
		{
			s: 8,
			want: 8,
		},
		{
			s: 45,
			want: 123456789,
		},
		{
			s: 10,
			want: 19,
		},
	}
	for i, tt := range tests {
		if got := solve(tt.s); tt.want != got {
			t.Errorf("wrong answer on line %d - want: %d, got: %d", i+1, tt.want, got)
		}
	}
}


package main

import (
	"fmt"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
)

func run(s1, s2 string) int {
	s1 = strings.ToLower(s1)
	s2 = strings.ToLower(s2)
	if s1 < s2 {
		return -1
	} else if s1 > s2 {
		return 1
	}
	return 0
}

func Test(t *testing.T) {
	assert.Equal(t, run("aaaa", "aaaA"), 0)
	assert.Equal(t, run("abs", "Abz"), -1)
	assert.Equal(t, run("abcdefg", "AbCdEfF"), 1)
}

func main() {
	var s1, s2 string
	fmt.Scan(&s1, &s2)
	fmt.Println(run(s1, s2))
}


package main

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

type vallen struct {
	len, val int
}

var orders [10]vallen = [...]vallen{
	{1000000000, 512},
	{100000000, 256},
	{10000000, 128},
	{1000000, 64},
	{100000, 32},
	{10000, 16},
	{1000, 8},
	{100, 4},
	{10, 2},
	{1, 1},
}

func solve() {
	n := readString()
	s := make([]byte, len(n))

	rest := false
	for i, c := range n {
		if rest {
			s[i] = '1'
			continue
		}
		if c >= '2' {
			rest = true
			s[i] = '1'
			continue
		}
		s[i] = n[i]
	}
	var r int
	fmt.Sscanf(string(s), "%b", &r)
	fmt.Println(r)
}

func solve2() {
	n := readInt()
	r := 0

	b := 1 << 31
	for ; b > 0; b >>= 1 {
		r |= b
		if r > n {
			r &= ^b
		}
	}
	fmt.Sscanf(fmt.Sprintf("%d", r), "%b", &r)
	fmt.Println(r)
}

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

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

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

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


package main

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

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

	input, _, _ := reader.ReadLine()
	value, _ := strconv.Atoi(string(input))

	resultNumber := 0

	for i := 01;true; i++ {
		if value < math.Pow(10, i) {
			break
		} else {
			resultNumber++
		}
	}

	fmt.Println(resultNumber)
}


package main

import "fmt"

func main() {
	var a int
        var b int
        var c int
	fmt.Scan(&a, &b, &c)
	if b >=a and c >= a  {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

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

func main() {
    in := bufio.NewReader(os.Stdin)
    out := bufio.NewWriter(os.Stdout)
    defer out.Flush()
    tot := 0
    fmt.Fscan(in, &tot)
    times := tot/3
    if tot % 3 > 0 {times++}
    fmt.Fprint(times, "\n")
}


package main

import "fmt"

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


package main

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

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


func checkWord (word string) string{
isLower :=0
	isUpper :=0
	//s.Count(word,lower)
	for _,char := range word {
	if	unicode.IsLower(char){
		isLower++;
	}else{
		isUpper++;
	}
	}

	if isUpper > isLower{
		return s.ToUpper(word)
	}else{
		return s.ToLower(word)
	}
}


package main
import (
	s "strings"
	"unicode"
	"fmt"
	"bufio"
	"os"
	"strconv"
)
func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	fmt.Print(checkWord(text));
}

func checkWord (word string) string{
	isLower :=0
	isUpper :=0
	for _,char := range word {
	if	unicode.IsLower(char){
		isLower++;
	}else if unicode.IsUpper(char){
		isUpper++;
	}
	}
	if isUpper > isLower{
		return s.ToUpper(word)
	}else{
		return s.ToLower(word)
	}
}


package main

import (
	"fmt"
	"strings"
	"unicode"
)

func main() {
	var s strings
	fmt.Scan(&s)
	u, l := 0, 0
	for _, r := range s {
		if unicode.IsLower(r) {
			l++
		} else if unicode.IsUpper(r) {
			u++
		}
	}
	if u > l {
		fmt.Println(strings.ToUpper(s))
	} else {
		fmt.Println(strings.ToLower(s))
	}
}


# ░░░░░░░░░░░░░░░░░░░░░░░
# ░░░░░▄▀▀▀▄░░░░░░░░░░░░░
# ▄███▀░◐░░░▌░░░░░░░░░░░
# ░░░░▌░░░░░▐░░░░░░░░░░░░
# ░░░░▐░░░░░▐░░░░░░░░░░░░
# ░░░░▌░░░░░▐▄▄░░░░░░░░░░
# ░░░░▌░░░░▄▀▒▒▀▀▀▀▄░░░░░
# ░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄░░░
# ░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄░
# ░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
# ░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
# ░░░░░░░░░░░▌▌░▌▌░░░░░░░
# ░░░░░░░░░░░▌▌░▌▌░░░░░░░
# ░░░░░░░░░▄▄▌▌▄▌▌░░░░░░░
# ░░░░░░PAWANG ULAR░░░░░░
# ███████████████████████

s = input()
x = 0
for c in s:
    if c.isupper() :
        x += 1

if x > len(s) - x:
    print(s.upper())
else :
    print(s.lower())


package main

import "fmt"

func main() {
    var n, ans int
    ans = 0

    fmt.Scan(&n)
    ans += n/100
    n %= 100
    ans += n/50
    n %= 50
    ans += n/20
    n %= 20
    ans += n/5
    n %= 20
    ans + n

    fmt.Println(ans)
}


package main
import (
 "fmt"
)
func main() {
  var n,k int
  fmt.Scan(&n)
  for _,i := range([]int{100,20,10,5,1}){
    k += n/i
    n %= i
  }
  fmt.Println(k)


package main

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

func main() {
	var n int
	bil := []int{100, 20, 10, 5}
	in := bufio.NewReader(os.Stdin)
	ans := 0
	for _, v := range bil {
		ans = ans + n/v
		n = n % v
	}
	ans = ans + n
	fmt.Println(ans)
}


//A. Выиграть в лотерею
package main

import (
	"fmt"
)

func main() {
	var n uint32
	fmt.Scan(&n)
	minKol(n)
}

func minKol(sum uint32) uint32 {
	bills := [...]uint32{1, 5, 10, 20, 100}
	var uint32 mode = sum
	var uint32 rez
	var int i = 4

	for mode != 0 {
		rez = rez + mode/bills[i]
		mode = sum % bills[i]
		mode = mode % bills[i]
		i--
	}
	return rez
}


package main
import "fmt"

func main() {
      var n, m, k int32;
      fmt.Scan(&n, &m);

      for n > 0 {
            k++;
            if !(k % m) {
                  k++;
            }
            n--;
      }

      fmt.Print(k);
}


package main
import "fmt"

func main() {
      var n, m, k int32;
      fmt.Scan(&n, &m);

      while n > 0 {
            k++;
            if !(k % m) {
                  k++;
            }
            n--;
      }

      fmt.Print(k);
}


package main
import "fmt"

func main() {
      var n, m, k int32;
      fmt.Scan(&n, &m);

      while (n > 0) {
            k++;
            if (!(k % m)) k++;
            n--;
      }

      fmt.Print(k);
}


package main
import "fmt"

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

      while n > 0 {
            k++;
            if !(k % m) {
                  k++
            }
            n--
      }

      fmt.Print(k)
}


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


<?php

$input = file_get_contents("php://stdin");
$inputNum = explode(" ", $input);
$start = (int)$inputNum[0];
$stop = (int)$inputNum[1];

//$digits = [
//    6,
//    2,
//    5,
//    5,
//    4,
//    5,
//    6,
//    3,
//    7,
//    6,
//];

$digits = new SplFixedArray();
$digits[0] = 6;
$digits[1] = 2;
$digits[2] = 5;
$digits[3] = 5;
$digits[4] = 4;
$digits[5] = 5;
$digits[6] = 6;
$digits[7] = 3;
$digits[8] = 7;
$digits[9] = 6;

$sum = 0;
for ($i = $start; $i <= $stop; $i++) {
    $d = $i;
    while ($d != 0) {;
        $sum += $digits[$d % 10];
        $d = intdiv($d, 10);
    }
}

echo $sum;


package main

import(
	"fmt"
	"strings"
)

func main(){
	var s string
	fmt.Scan(&s)
	res:="";
	res+=ToUpper(string(s[0]))
	fmt.Println(res)
}


package main

import "fmt"

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

	wordBytes := []byte(word)
	wordBytes[0] &= ^0x20

	fmt.Print(string(wordBytes))
}


package main

import(
	"fmt"
	"strings"
)

func main(){
	var s string
	fmt.Scan(&s)
	res:="";
	res+=ToUpperer(string(s[0]))
	fmt.Println(res)
}


package main

import(
	"fmt"
	"strings"
)

func main(){
	var s string
	fmt.Scan(&s)
	res:="";
	res+=strings.ToUpper(string(s[0]))
	for i:=1; i<len(s); i++ {
		res+=s[i];
	}
	fmt.Println(res)
}


package main

import(
	"fmt"

	"strconv"
)

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

}

func main(){
	var n = map[string]int{"a": 1, "b":2, "c":3,"d":4, "e":5,"f":6,"g":7, "h":8}
	var sstart, sfin string
	fmt.Scan(&sstart, &sfin)
	xstart := n[sstart[:1]]
	ystart, _ := strconv.Atoi(sstart[1:])

	xfin := n[sfin[:1]]
	yfin, _ := strconv.Atoi(sfin[1:])

	crossx := xstart - xfin
	crossy := ystart - yfin
	acrossx := abs(crossx)
	acrossy := abs(crossy)
	fmt.Printf("acrossx = %d\n acrossy = %d\n", acrossx, acrossy)
	var m int
	if acrossx  <= acrossy {
		m = acrossy

	}else{
		m = acrossx
	}
	fmt.Printf("m = %d", m)
	ans := make([]string, m)
	cm := ""
	smx, smy:= "", ""
	if crossx > 0 {
		cm += "L"
		smx = "L"
	}else if crossx == 0{
		cm+= ""
	}else{
		cm +="R"
		smx =  "R"
	}
	if crossy > 0 {
			cm += "D"
			smy = "D"
	}else if crossy == 0{
		cm += ""
	}else{
			cm += "U"
			smy = "U"
	}

	fmt.Printf("cm = %s\n", cm)
	if (acrossx <= acrossy) && crossx != 0{
		for i := 0; i < acrossx; i ++{
			fmt.Printf("%s\n", cm)
		}
		for i := 0; i < acrossy - acrossx; i++ {
			fmt.Printf("%s\n", smy)
		}
	}else{
		for i := 0; i < acrossy; i ++{
			fmt.Printf("%s\n", cm)
		}
		for i := 0; i < acrossx - acrossy; i++ {
			fmt.Printf("%s\n", smx)
		}
	}

}


package main
import (
 "fmt"
)
func main(){
  var n,l int
  var s string
  fmt.Scan(&n,&s)
  for i:=1;i<n;i++ {
    if s[i-1] == 'S' && s[i] == 'F' {
      l++
    } else if s[i-1] == 'F' && s[i] == 'S' {
      l--
    }
  }
  O := "YES"
  if l < 0 {
    o = "NO"
  }
  fmt.Println(o)
}


package main
import (
 "fmt"
)
func main(){
  var n,l int
  var s string
  fmt.Scan(&n,&s)
  for i:=1;i<n;i++ {
    if s[i-1] == 'S' && s[i] == 'F' {
      l++
    } else if s[i-1] == 'F' && s[i] == 'S' {
      l--
    }
  O := "YES"
  if l < 0 {
    o = "NO"
  }
  fmt.Println(o)
}


package main
import (
	"fmt"
	"strings"
)

func main(){
	var len int
	var way string
	fmt.Scan(&len)
	fmt.Scan(&way)
	S := Count(way,"SF")
	SF := Count(way,"FS")
	if S > SF{
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


package main

import (
    "fmt"
    "strings"
)
 func main() {
    var l int
    var str string
    fmt.Scan(&l, &str)
    fs := s.Count(str, "FS")
    sf := s.Count(str, "SF")
    if sf > fs {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}


package main

import "fmt"

func main() {
    var a int
    scanf("%d\n", &a)
	fmt.Println(Problem617A(a))
}

func Problem617A(position int) (steps int) {
	steps = 0
	for curr := 5; curr > 0; curr-- {
		for position >= curr {
			steps++
			position-=curr
		}
	}
	return
}


package main

import (
	"fmt"
)

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

	fmt.Scanln(&q)

	if q <= 5 {
		fmt.Println("1")
	} else {
		n = q % 5
		q = q / 5

		if n != 0 {
			fmt.Println(q + 1)
		} else {
			fmt.Println(q)
		}
	}

}


package main

import (
    "fmt"
    "os"
)

func main() {
    var a int
    scanf("%d\n", &a)
	printf(Problem617A(a))
}

func Problem617A(position int) (steps int) {
	steps = 0
	for curr := 5; curr > 0; curr-- {
		for position >= curr {
			steps++
			position-=curr
		}
	}
	return
}

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

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


package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	c := n / 2 + n % 2
	step := n / 5
	if n % 5 > 0 {
	    step++
	}
	fmt.Print(step)
}


package main

import (
    "fmt"
    "os"
)

func main() {
    var a int
    scanf("%d\n", &a)
    steps := Problem617A(a)
	printf(steps)
}

func Problem617A(position int) (steps int) {
	steps = 0
	for curr := 5; curr > 0; curr-- {
		for position >= curr {
			steps++
			position-=curr
		}
	}
	return
}

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

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


package main

import "fmt"

func main() {
  var n, m uint64
  fmt.Scanf("%d %d", &n, &m)
  res1 := [5]uint64{}
  res2 := [5]uint64{}
  for i := range(res1) {
    res1[i] = n / 5
  }
  for i := range(res2) {
    res2[i] = m / 5
  }
  if temp := n % 5; temp != 0 {
    for i := uint64(1); i <= temp; i++ {
      res1[i]++
    }
  }
  if temp := m % 5; temp != 0 {
    for i := uint64(1); i <= temp; i++ {
      res2[i]++
    }
  }
  result := uint64(0)
  for i := 0; i < 5; i++ {
    result += res1[i] * res2[(5 - i) % 5]
  }
  fmt.Println(result)
}


package main

import "fmt"

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

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


package main

import "fmt"
import "strconv"

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

func main() {
	var p, l int
	var s int64
	fmt.Scan(&p)
	fmt.Scan(&l)
	for i := 1; i < p+1; i++ {
		r, k := strconv.Itoa(i), strconv.Itoa(i)
		r = reverse(r)
		m, _ := strconv.Atoi(k + r)
		s += m
	}
	s = s % l
	fmt.Println(s)
}


package main

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

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

func main() {
	defer writer.Flush()
	scanner.Split(bufio.ScanWords)
	n := nextInt()
	res := 0
	nFact := factorial(n)
	for i := 1; i <= n; i++ {
		down := factorial(i) * factorial(n-i)
		res += nFact / down
	}
	println(res)

}
func factorial(x int) int {
	if x == 0 {
		return 1
	}

	return x * factorial(x-1)
}

func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}

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

func nextInt() int {
	n, _ := strconv.Atoi(next())
	return n
}

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


package main

import (
	"bufio"
	"golang.org/x/tools/go/ssa/interp/testdata/src/fmt"
	"os"
	"strings"
)

func main() {
	var s []rune
	var t []rune
	var r []rune
	line := 1
	scanner := bufio.NewScanner(os.Stdin)

	for scanner.Scan() {

		if line == 1 {
			s = []rune(scanner.Text())
			line += 1

		} else if line == 2 {
			t = []rune(scanner.Text())
			break
		}
	}

	stringLen := len(s)
	r = s

	for i := stringLen - 1; i >= 0; i++ {
		//rAscii := []byte(r[i])[0]
		for r[i] < 'z' {
			r[i]++
			if strings.Compare(string(r), string(t)) == -1 {
				fmt.Println(string(r))
				os.Exit(0)
			}
		}
		if r[i] == 'z' {
			r[i] = 'a'
		}
	}
	fmt.Println("No such string")
	os.Exit(0)
}


package main

import (
	"fmt"
)

const SIDES int64 = 6

func main() {
	var n, total int64

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

	for i := 0; i < n; i++ {
		total += (i + 1) * SIDES
	}
	fmt.Println(total + 1)
}


package main

import (
	"fmt"
	"strings"
)

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

	for _, v := range []string{"144", "14", "1"} {
		num = strings.Replace(num, v, "", -1)
	}

	if len(num) > 0 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}


package main

import (
	"bufio"
	"fmt"
	//	"gonum.org/v1/plot"
	//	"gonum.org/v1/plot/plotter"
	//	"gonum.org/v1/plot/plotutil"
	//	"gonum.org/v1/plot/vg"
	//	"image/color"
	"math"
	"os"
	"strconv"
)

var debug bool = debug

type line struct {
	x1, x2, y1, y2, m float64
	horizontal        bool
}

func solve() {
	x1 := readFloat()
	y1 := readFloat()
	x2 := readFloat()
	y2 := readFloat()
	x3 := readFloat()
	y3 := readFloat()

	//	maxz := maxInt([...]float64{x1, x2, x3, y1, y2, y3})
	//	minz := minInt([...]float64{x1, x2, x3, y1, y2, y3})

	l12 := makeLine(x1, x2, y1, y2)
	l13 := makeLine(x1, x3, y1, y3)
	l23 := makeLine(x2, x3, y2, y3)

	p12 := makePerp(l12)
	p13 := makePerp(l13)
	p23 := makePerp(l23)

	if debug {
		fmt.Println("M12", l12.m, p12.m)
		fmt.Println("M13", l13.m, p13.m)
		fmt.Println("M23", l23.m, p23.m)
	}

	// find intercept
	ix, iy := intercept(p12, p23)

	a0 := math.Atan2(y1-iy, x1-ix)
	a := make([]float64, 2, 2)
	a[0] = math.Atan2(y2-iy, x2-ix)
	a[1] = math.Atan2(y3-iy, x3-ix)

	if debug {
		fmt.Println("A", (a[0]-a0)*(180.0/math.Pi), (a[1]-a0)*(180.0/math.Pi))
	}

	b := make([]float64, 2, 2)
	i := 3
	b[0] = math.Abs(math.Sin(float64(i) * (a[0] - a0)))
	b[1] = math.Abs(math.Sin(float64(i) * (a[1] - a0)))
	b[0] += math.Abs(1.0 - math.Cos(float64(i)*(a[1]-a0)))
	b[1] += math.Abs(1.0 - math.Cos(float64(i)*(a[1]-a0)))
	if debug {
		fmt.Println("err", i, b[0], b[1], "area",
			area(float64(i), ix, iy, x1, y1))
	}

	found := false
	N := i
	Nerr := b[0] + b[1]
	for i = 3; i <= 100; i++ {
		b[0] = math.Abs(math.Sin(float64(i) * (a[0] - a0)))
		b[1] = math.Abs(math.Sin(float64(i) * (a[1] - a0)))
		b[0] += math.Abs(1.0 - math.Cos(float64(i)*(a[0]-a0)))
		b[1] += math.Abs(1.0 - math.Cos(float64(i)*(a[1]-a0)))
		if debug {
			fmt.Println("err", i, b[0], b[1], "area",
				area(float64(i), ix, iy, x1, y1))
		}

		e := b[0] + b[1]
		if !found && e < 0.00001 {
			found = true
			N = i
			Nerr = e
		}
	}
	if debug {
		fmt.Println("N", N, "err", Nerr)
	}
	fmt.Printf("%0.6f\n", area(float64(N),
		ix, iy,
		x1, y1))

	// plt, err := plot.New()
	// if err != nil {
	// 	panic(err)
	// }
	// pts := make(plotter.XYs, 3)
	// pts[0].X = x1
	// pts[0].Y = y1
	// pts[1].X = x2
	// pts[1].Y = y2
	// pts[2].X = x3
	// pts[2].Y = y3
	// s, err := plotter.NewScatter(pts)
	// if err != nil {
	// 	panic(err)
	// }
	// s.GlyphStyle.Color = color.RGBA{R: 255, G: 0, B: 255, A: 255}
	// plt.Add(s)

	// pts[0].X = p12.x1
	// pts[0].Y = p12.y1
	// pts[1].X = p13.x1
	// pts[1].Y = p13.y1
	// pts[2].X = p23.x1
	// pts[2].Y = p23.y1
	// s, err = plotter.NewScatter(pts)
	// if err != nil {
	// 	panic(err)
	// }
	// s.GlyphStyle.Color = color.RGBA{R: 0, G: 0, B: 255, A: 255}
	// plt.Add(s)

	// addLine(plt, p12.x1, p12.y1, ix, iy)
	// addLine(plt, p23.x1, p23.y1, ix, iy)
	// addLine(plt, p13.x1, p13.y1, ix, iy)

	// plt.X.Min = minz
	// plt.X.Max = maxz
	// plt.Y.Min = minz
	// plt.X.Max = maxz

	// if err := plt.Save(4*vg.Inch, 4*vg.Inch, "hello.png"); err != nil {
	// 	panic(err)
	// }

}

// func addLine(p *plot.Plot, x1, y1, x2, y2 float64) {
// 	pts := make(plotter.XYs, 2)
// 	pts[0].X = x1
// 	pts[0].Y = y1
// 	pts[1].X = x2
// 	pts[1].Y = y2

// 	err := plotutil.AddLinePoints(p, "a", pts)
// 	if err != nil {
// 		panic(err)
// 	}
// }

func area(n, p1x, p1y, p2x, p2y float64) float64 {
	t := (2.0 * math.Pi) / n

	x := p1x - p2x
	x *= x
	y := p1y - p2y
	y *= y
	r := math.Sqrt(x + y)

	s := math.Sin(t)
	c := math.Cos(t)
	d := r * math.Sqrt(s*s+c*c-2.0*c+1.0)

	x = r * r
	y = 0.25 * d * d
	z := math.Sqrt(x - y)

	return (n * d * z) / 2.0
}

func intercept(l1, l2 line) (x, y float64) {
	if l1.m == 0.0 {
		if l1.horizontal {
			y = l1.y1
			x = solveX(y, l2)
		} else {
			x = l1.x1
			y = solveY(x, l2)
		}
		return
	}

	if l2.m == 0.0 {
		if l2.horizontal {
			y = l2.y1
			x = solveX(y, l1)
		} else {
			x = l2.x1
			y = solveY(x, l1)
		}
		return
	}

	x = (l1.m*l1.x1 - l2.m*l2.x1 - l1.y1 + l2.y1) / (l1.m - l2.m)
	y = l2.m*(x-l2.x1) + l2.y1

	x = l1.x1 + (y-l1.y1)/l1.m
	if debug {
		fmt.Println("old", x, y)
		fmt.Println("L1", l1.x1, l1.y1, l1.m)
		fmt.Println("L2", l2.x1, l2.y1, l2.m)
	}
	return
}

func solveY(x float64, l line) float64 {
	if l.m == 0 {
		return l.y1
	}
	return l.m*(x-l.x1) + l.y1
}

func solveX(y float64, l line) float64 {
	if l.m == 0 {
		return l.x1
	}
	return l.x1 + (y-l.y1)/l.m
}

func makeLine(x1, x2, y1, y2 float64) line {
	m := 0.0
	h := true
	if x1 == x2 {
		h = false
		m = 0.0
	} else {
		m = (y2 - y1) / (x2 - x1)
	}

	return line{x1, x2, y1, y2, m, h}
}

func makePerp(l line) line {
	m := l
	if m.m == 0 {
		m.horizontal = !l.horizontal
	} else {
		m.m = -1.0 / l.m
	}
	m.x1 = (l.x1 + l.x2) / 2.0
	m.y1 = (l.y1 + l.y2) / 2.0
	return m
}

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 readFloat() float64 {
	val, _ := strconv.ParseFloat(readString(), 64)
	return val
}

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

func maxInt(a [6]float64) (m float64) {
	m = a[0]
	for _, k := range a {
		if k > m {
			m = k
		}
	}
	return
}

func minInt(a [6]float64) (m float64) {
	m = a[0]
	for _, k := range a {
		if k < m {
			m = k
		}
	}
	return
}


package main

import "fmt"

func main() {
	n := 0

	t1 := 0
	t2 := 0

	fmt.Scan(&n)

	for i := 0; i < n; i++ {
		fmt.Scan(&t2)
		if t2 - t1 > 15 {
			fmt.Print(t1 + 15)
			return
		}
		t1 = t2

	}
	if t2 <= 15 {
		fmt.Print(t2 + 15)
		return
	}
	if t2 < 75 {
		fmt.Print(15)
		return
	}
	fmt.Print(90)
}


package main

import (
	"container/list"
	"fmt"
)

type Item struct {
	value int
	depth int
}

type Queue struct {
	data *list.List
}

func NewQueue() *Queue {
	q := new(Queue)
	q.data = list.New()
	return q
}

func (q *Queue) Enqueue(v interface{}) {
	q.data.PushBack(v)
}

func (q *Queue) Dequeue() interface{} {
	iter := q.data.Front()
	v := iter.Value
	q.data.Remove(iter)
	return v
}

func (q *Queue) Dump() {
	for iter := q.data.Front(); iter != nil; iter = iter.Next() {
		fmt.Println("item:", iter.Value)
	}
}

func (q *Queue) Empty() bool {
	return q.data.Len() == 0
}

func solve(n, m int) int {
	if n >= m {
		return n - m
	}

	len := m*2 + 1
	graph := make([][]int, len, len)
	for i := 0; i < m*2+1; i++ {
		graph[i] = make([]int, 2, 2)
	}

	for i := 1; i < len; i++ {
		graph[i][0] = i - 1
		graph[i][1] = i * 2
	}

	ans := 0
	visit := make([]bool, len, len)
	q := NewQueue()
	q.Enqueue(Item{value: n, depth: 0})
	for !q.Empty() {
		v := q.Dequeue().(Item)
		if v.value == m {
			ans = v.depth
			break
		}

		visit[v.value] = true
		val := v.value
		if val > 0 && val < len {
			if graph[val][0] > 0 && graph[val][0] < len && !visit[graph[val][0]] {
				it := Item{value: graph[val][0], depth: v.depth + 1}
				q.Enqueue(it)
			}

			if graph[val][1] > 0 && graph[val][1] < len && !visit[graph[val][0]] {
				it := Item{value: graph[val][1], depth: v.depth + 1}
				q.Enqueue(it)
			}
		}
	}

	return ans
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	fmt.Println(solve(n, m))
}


package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scanf("%d %d\n", &n, &m)
	ans := 0

	for m > n {
		if m % 2 != 0 {
			m++
			ans++
		} else {
			m /= 2
			ans++
		}
	}

	fmt.Println(ans + (n - m))


package main

import “fmt”

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

func main() {
    var a, b, c int
    fmt.Scan(&a, &b, &c)
    b /= 2
    c /= 4
    r := min(a, b)
    r = min(r, c)
    fmt.Print(r*7)
}


package main

import "fmt"

func main() {
    var kitten int
    var f int
    var q int
    var t int
    fmt.Scanf("%d", &f)
    fmt.Scanf("%d", &q)
    fmt.Scanf("%d", &t)
    var love[100] int
    var c int
    var gg int
    for i := 0; i < f; i++ {
        for j := 0; j < q; gg++ {
            fmt.Scanf("%c", &c)
            if c == 'Y' {
                love[j]++
                j++
            }
            if c == 'N' {
                j++
            }
        }
    }
    var lq  int
    lq = gg
    lq = 0
    for i := 0; i < q; i++ {
        if (love[i] >= t) {
            lq++
        }
    }
    fmt.Println(lq)
}


package main

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

func main() {
    in := bufio.NewReader(os.Stdin)
    out := bufio.NewWriter(os.Stdout)
    defer out.Flush()
    var n int
    var s string
     fmt.Fscan(*in, &n, &s)

     fmt.Fprintln(*out, n + 1)
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s string

	fmt.Scan(&n)
	fmt.Scan(&s)

	fmt.Println(n + 1)
}


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


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


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


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


package R593_Div2_B

import (
	"fmt"
	"math/big"
)

func main() {
	var n, m int64

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

	var tmp big.Int

	var t1 = tmp.Exp(big.NewInt(2), big.NewInt(m), nil);
	var t2 = tmp.Sub(t1, big.NewInt(1))
	var t3 = tmp.Exp(t2, big.NewInt(n), big.NewInt(1000000007))

	fmt.Print(t3)
}


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

const (
	cha = 2
)

type Joystick struct {
	Charge   int
	Charging bool
}

func main() {

	min := 0

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	input := scanner.Text()
	charges := strings.Split(input, " ")

	v, _ := strconv.Atoi(charges[0])
	j1 := Joystick{v, false}
	v, _ = strconv.Atoi(charges[1])
	j2 := Joystick{v, false}

	if j1.Charge < j2.Charge {
		j1.Charging = true
	} else {
		j2.Charging = true
	}

	// fmt.Println(j1, j2)

	if j1.Charge == 1 && j2.Chrage == 1 {
		fmt.Println(0)
		return
	}
	for {
		if j1.Charge <= 0 || j2.Charge <= 0 {
			break
		}
		min++
		if j1.Charging == true {
			j1.Charge++
			j2.Charge -= 2
		} else {
			j2.Charge++
			j1.Charge -= 2
		}
		if j1.Charge < j2.Charge {
			j1.Charging = true
			j2.Charging = false
		} else {
			j2.Charging = true
			j1.Charging = false
		}

	}
	fmt.Println(min)

}


package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	if n%2 == 1 {
		fmt.Println(0)
		return
	}
	fmt.Println(1 << (n / 2))
}


package main

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

func main() {
	var s string
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &s)
	countLetter := make(map[string]int)
	for _, v := range s {
		countLetter[v]++
	}
	fmt.Fscan(in, &s)
	for _, v := range s {
		countLetter[v]++
	}
	fmt.Fscan(in, &s)
	for _, v := range s {
		countLetter[v]--
	}
	count := 0
	for _, v := range countLetter {
		if v > 0 {
			count++
		}
	}
	if count > 0 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}


package main

import "fmt"

func main() {
    var a, b, steps int
    t := make([]int, 0)
    fmt.Scanf("%d %d", &a, &b)
    fmt.Println(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"

func main() {
    var a, b, steps int
    t := make([]int, 0)
    fmt.Scanf("%d %d", &a, &b)
    fmt.Println(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, val := range t {
            if idx == len(range) - 1 {
                fmt.Printf("%d\n", val)
            } else {
                fmt.Printf("%d ", val)
            }
        }
    } 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"
	"strings"
)

func main() {
	a131()
}

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


package main

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

func main() {

	buf := new(bytes.Buffer)

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanLines)

	str := ""

	for sc.Scan() {
		str = sc.Text()
		break
	}
	lower := "qwertyuiopasdfghjklzxcvbnm"
	rd := strings.NewReader(str)
	sc = bufio.NewScanner(rd)
	sc.Split(bufio.ScanRunes)
	i := 0
	for sc.Scan() {
		i ++
		if i == 1 {
			{
				buf.WriteString(strings.ToUpper(sc.Text()))

			}
			buf.WriteString(strings.ToLower(sc.Text()))
		}

	}
	io.Copy(os.Stdout, buf)
}


package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	a131()
}

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


package main

import (
	"fmt"
	"math"
)

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

}


package main

import (
	"fmt"
)

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

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


package main

import (
	"fmt"
)

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

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


package main

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

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

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

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

	var lo, hi int64 = 0, 1000000000
	var m, x, rem int64
	var bad bool
	for hi - lo > 1 {

		m = lo + (hi - lo) / 2
		x = b * m
		rem = a * c - x
		bad = false

		for rem > 0 {
			x += b
			x -= a
			if x < 0 {
				bad = true
				break
			}
			rem -= b
		}

		if bad {
			lo = m
		}else {
			hi = m
		}
	}

	fmt.Println(hi)
}

func next() string {
	if !in.Scan() {
		panic("Scan error")
	}

	return in.Text()
}

func nextInt() int {
	ret, _ := strconv.Atoi(next())
	return ret
}


import (
	"fmt"
)

func main() {
	var n,x,y int
	fmt.Scan(&n,&x,&y)
	if n==2{
		fmt.Println("NO")
	}else
	{if x == n/2 || x == (n/2)+1 && y == n/2 || y == (n/2)+1{
		fmt.Println("NO")
	}else
	{fmt.Println("YES")}
	}

}


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

const lineDelim = '\n'

func readInts(r *bufio.Reader) []int64 {
	str, _ := r.ReadString(lineDelim)
	str = str[:len(str)-1]
	numbersRaw := strings.Split(str, " ")
	var numbers []int64
	for _, i := range numbersRaw {
		n, _ := strconv.Atoi(i)
		numbers = append(numbers, int64(n))
	}

	return numbers
}

func readInt(r *bufio.Reader) int64 {
	str, _ := r.ReadString(lineDelim)
	str = str[:len(str)-1]
	n, _ := strconv.Atoi(str)

	return int64(n)
}

func readString(r *bufio.Reader) string {
	str, _ := r.ReadString(lineDelim)
	str = str[:len(str)-1]

	return str
}

func debug(s string, mask int) {
	fmt.Printf("%s: %#v\n", s, strconv.FormatInt(int64(mask), 2))
}

func decbin(dec int) string {
	return strconv.FormatInt(int64(dec), 2)
}

func check(mask, target int) bool {
	return mask&target == target
}

func takeBlueOut(mask int) int {
	return mask
}

func makeRed(mask, i int) int {
	return (mask | (1 << i))
}

func isRed(mask, i int) bool {
	return (mask & (1 << i)) == (1 << i)
}

func isBlue(mask, i int) bool {
	return !isRed(mask, i)
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	n := int(readInt(reader))
	mask := 0
	target := 0
	for i := 0; i < n; i++ {
		b, _ := reader.ReadByte()
		mask ^= (int(b) % 3) << i
		target ^= 1 << i
		// debug("mask", mask)
		// debug("target", target)
	}

	j := 0
	for {
		blueFill := 0
		for i := 0; i < n; i++ {
			if check(mask, target) {
				fmt.Println(j)
				return
			}
			shift := (1 << i)
			// fmt.Printf("i: %d | j: %d | 1 << %d: %d | isRed: %t | blueFill: %s | mask: %s\n", i, j, i, shift, isRed(mask, i), decbin(blueFill), decbin(mask))
			if isBlue(mask, i) {
				j++
				mask = makeRed(mask, i)
				mask ^= blueFill
				blueFill ^= blueFill
				break
			} else {
				blueFill ^= shift
			}
			// fmt.Printf("i: %d | j: %d | 1 << %d: %d | isRed: %t | blueFill: %s | mask: %s\n", i, j, i, shift, isRed(mask, i), decbin(blueFill), decbin(mask))
			// time.Sleep(2 * time.Second)
		}
	}
}


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for(int i = 0; i < n-1; i++) {
    int x = min(a[i], a[i+1]), y = max(a[i], a[i+1]);
    for(int j = 0; j < n-1; j++) {
      int u = min(a[j], a[j+1]), v = max(a[j], a[j+1]);
      if((x < u and y > u and y < v) or (x > u and x < v and y > v)) {
	printf("yes\n", i, j);
	return 0;
      }
    }
  }
  printf("no\n");
}


package main

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

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

	var browse []int
	var e, s int

	for i := 0; i < n; i++ {
		var each int
		fmt.Scan(&each)

		if each > 0 {
			e ++
		} else {
			s ++
		}

		browse = append(browse, each)
	}

	max := math.MinInt64

	for i := 0; i < k; i++ {
		var e1, s1 int
		var j int = i

		for j < n {
			if browse[j] > 0 {
				e1 ++
			} else {
				s1 ++
			}

			j += k
		}

		result := ((e - e1) - (s - s1))
		if result < 0 {
			result = -result
		}

		max = int(math.Max(float64(max), float64(result)))
	}

	fmt.Println(max)
}


package main

import "fmt"

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

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

	fmt.Print( x-1, y)


package main

import "fmt"

func main() {
	var n, cnt0, cnt1 int32
	var str string

	for _, c := range(str) {
		if c == '0' {
			cnt0 ++
		} else {
			cnt1 ++
		}
	}
	if (cnt0 != cnt1) {
		fmt.Println(1)
		fmt.Println(str)
	} else {
		fmt.Println(2)
		fmt.Println(str[0:1], str[1:])
	}
}


n := 0
fmt.Scanf("%d", &n)
for i := 0; i <= 1e5; i++ {
    tmp := i
    c := 0
    for {
        if tmp % 5 {
            break
        }
        tmp /= 5
        c ++
    }
    if c < n {
        continue
    }
    if c == n {
        fmt.Println("5")
        for j := i; j < i + 5; j++ {
            fmt.Print(j, " ")
        }
    }
    if c > n {
        break
    }
}


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

    return
}


package main

import "fmt"

func main() {

}


package main
import (
    "fmt"
    "math"
)

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

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


package main

import "fmt"
import "math"

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


package main

import "fmt"
var k, n int64
func main() {
	fmt.Scan(&n, &k)
	if k == 1 {
		fmt.Print(n)
	} else {
		var i uint = 1
		var  s int64
		for s = 1; (s << 1) <= n; i++ {
			s <<= 1;
		}
		if(i == 64){
			fmt.Print(9223372036854775807)
		}else{
			fmt.Print((1 << i) - 1)
		}
	}
}


package main
import (
    "fmt"
    "math"
)

func main() {
    var n, k uint64
    fmt.Scanln(&n, &k)
    if k == 1 || n == 1 {
        fmt.Println(n)
    } else {
        var degree_2 uint64 = uint(math.Log2(float64(n)))
        result := (1 << (degree_2 + 1)) - 1
        fmt.Println(result)
    }
}


hezhao@localhost assignment1 $ vi assignment1.py
package main

import (
    "fmt"
)

func gcd(x, y int) int {
    if y == 0 {
        return x
    }
    return gcd(y, x%y)
}

func main() {
    var a, b, x, y int
    fmt.Scanf("%d%d%d%d", &a, &b, &x, &y)
    c := a*b/gcd(a, b)
    fmt.Println(y/c-(x-1)/c)
}


import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;

class Main {

    public static void main(String args[]) {

        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        stdIn.nextLine();
        String s = stdIn.nextLine();
        LinkedList<Character> queue = new LinkedList<Character>();
        for (char c : s.toCharArray()) {
            queue.add(c);
        }
        int D = 0;
        int R = 0;
        char last = ' ';
        while (queue.size() > 1) {
            int len = queue.size();
            for (Iterator<Character> iter = queue.iterator(); iter.hasNext(); ) {
                char c = iter.next();
                last = c;
                if (c == 'D') {
                    if (D > 0) {
                        iter.remove();
                        D--;
                    } else {
                        R++;
                    }
                } else {
                    if (R > 0) {
                        iter.remove();
                        R--;
                    } else {
                        D++;
                    }
                }
            }
            if (len == queue.size()) {
                break;
            }

        }
        System.out.println(queue.get(0));

    }
}


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 (
	"fmt"
	"github.com/go-redis/redis"

	"net/http"
	"log"
)

func saveStat(redisClient *redis.Client) func (w http.ResponseWriter, r *http.Request) {
	return func (w http.ResponseWriter, r *http.Request) {
		err := redisClient.Set("key", "value", 0).Err()
		if err != nil {
			panic(err)
		}
		fmt.Fprintf(w, "{\"status\": \"ok\"}")
		fmt.Println(r.URL.Query()["param"])
		fmt.Println(r.URL.Query()["value"])
	}
}

func main() {

	client := redis.NewClient(&redis.Options{
		Addr:     "127.0.0.1:6379",
		Password: "",
		DB:       0,
	})

	http.HandleFunc("/set", saveStat(client)) // set router
	err := http.ListenAndServe(":9090", nil) // set listen port
	if err != nil {
		log.Fatal("ListenAndServe: ", err)
	}

}


package main

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

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

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

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

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

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


package main

import "fmt"

func is_perfect_like_mikey(i int) bool{
    s := 0
    for i > 0 {
        s+=(i%10)
        i=i/10
    }
    return(s==10)
}
func main() {
    mike_is_my_daddy := 0
    fmt.Scan(&mike_is_my_daddy)
    cnt := 0
    for i := 0; ; i++ {
        if(is_perfect_like_mikey(i)) {
            cnt++
        }
        if cnt == mike_is_daddy {
            fmt.Println(i)
            break
        }
    }
}


package main

import "fmt"

func is_perfect_like_mikey(i int) bool{
    s := 0
    for i > 0 {
        s+=(i%10)
        i/10
    }
    return(s==10)
}
func main() {
    mike_is_my_daddy := 0
    fmt.Scan(&mike_is_my_daddy)
    cnt := 0
    for i := 0; ; i++ {
        if(is_perfect_like_mikey(i)) {
            cnt++
        }
        if cnt == k {
            fmt.Println(i)
            break
        }
    }
}


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

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
}


import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	a := make([]int, n)
	var k int
	fmt.Scanf("%d", &k)
	b := make([]int, k)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}
	for i := 0; i < k; i++ {
		fmt.Scanf("%d", &b[i])
	}
	sort.Ints(b)
	index := len(b)-1
	for i := 0; i < n; i++ {
		if a[i] == 0 {
			a[i] = b[index]
			index--
		}
	}
	if isNotInc(a) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func isNotInc(a []int) bool {
	for i := 1; i < len(a); i++ {
		if a[i] < a[i-1] {
			return true
		}
	}
	return false
}


package main

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

func main() {
    var s string
    fmt.Scan(&s)
    input:= bufio.NewScanner(os.Stdin)
    var c rune
    input.Scan()
    s=input.Text()
    c = rune(s[len(s)-2])
    //c = unicode.ToLower(c)
    //fmt.Println(s)
    fmt.Println(string(c))
    if (c == 'a' || c == 'e' || c == 'i' || c == 'u' || c == 'o' || c == 'y') {
    	fmt.Println("YES")
    	return
    }
    fmt.Println("NO")
}


package main

import (
	"fmt"
)

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


package main
import (
	"fmt"
	//"unicode/utf8"
	//"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	if n<3 {
		fmt.Println("-1")
	} else {
		for i=n;i>=1;i-- {
			fmt.Print(i," ")
		}
	}
}


package main

import "fmt"

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


package main

import (
        "fmt"
)

var n int64
var k int64

func main() {
        fmt.Scanf("%d %d", &n, &k)
        cnt2 := 0
        cnt5 := 0
        res := n
        for {
                if cnt5 >= k || res%5 != 0 {
                        break
                }
                res = res / 5
                cnt5++
        }
        for {
                if cnt2 >= k || res%2 != 0 {
                        break
                }
                res = res / 2
                cnt2++
        }
        for i := 0; i < k; i++ {
                res = res * 10
        }
        fmt.Println(res)
}


package main

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

func solve() {
	n := readInt()
	v := make([]int, 101)
	for i := 0; i < n; i++ {
		v[readInt()]++
	}
	pos := 0
	cnt2 := 0
	cnt1 := 0
	total1 := 0
	total2 := 0
	res := make([]int, 0)
	for i := 0; i < len(v); i++ {
		if v[i] != 0 {
			res = append(res, i)
			if pos%2 == 0 {
				cnt1++
				total1 += v[i]
			} else {
				total2 += v[i]
				cnt2++
			}
			pos++
		}
	}
	if cnt1 == cnt2 && total1 == total2 {
		fmt.Println("YES")
		for i := 0; i < len(res); i++ {
			if i > 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[i])
		}
		fmt.Println()
	} else {
		fmt.Println("NO")
	}
}

var scanner *bufio.Scanner

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

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

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

// IO

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

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

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

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

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


package main

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

func solve() {
	n := readInt()
	v := make([]int, 101)
	for i := 0; i < n; i++ {
		v[readInt()]++
	}
	pos := 0
	cnt1 := 0
	cnt2 := 0
	total1 := 0
	total2 := 0
	res := make([]int, 0)
	for i := 0; i < len(v); i++ {
		if v[i] != 0 {
			res = append(res, i)
			if pos%2 == 0 {
				cnt1++
				total1 += v[i]
			} else {
				total2 += v[i]
				cnt2++
			}
			pos++
		}
	}
	if cnt1 == cnt2 && total1 == total2 {
		fmt.Println("YES")
		for i := 0; i < len(res); i++ {
			if i > 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[i])
		}
		fmt.Println()
	} else {
		fmt.Println("NO")
	}
}

var scanner *bufio.Scanner

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

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

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

// IO

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

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

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

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

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


package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	fmt.Scan(&inp)
	bySum := func(x int) int { return x / 11 }
	possBySum := bySum(n)
	byReqSymb := func(x string) int { return strings.Count(x, "8") }
	possByReqSymb := byReqSymb(inp)
	if possBySum >= possByReqSymb {
		fmt.Println(possByReqSymb)
	} else {
		fmt.Println(possBySum)
	}
}


package main

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

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

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer = bufio.NewWriter(os.Stdout)
}

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

func nextInt() int {
	v, _ := strconv.Atoi(nextToken())
	return v
}

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

func nextFloat() float64 {
	v, _ := strconv.ParseFloat(nextToken(), 64)
	return v
}

func printInt(x int) {
	writer.WriteString(strconv.Itoa(x))
}

var n int32
var s string
var a [500][500]int

func main() {
	n = nextInt()
	s = nextToken()
	x, y := 250, 250
	a[x][y] = 1
	ans := 0
	for _, c := range s {
		switch c {
		case 'U':
			y++
		case 'D':
			y--
		case 'L':
			x--
		case 'R':
			x++
		}
		ans += a[x][y]
		a[x][y]++
	}
	printInt(ans)
	writer.Flush()
}


package main

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

var in *bufio.Scanner
var out *bufio.Writer

func dp(n int, x int64, y int64) int64 {
	f := make([]int64, n+1)

	f[0] = 0
	for i := 1; i <= n; i++ {
		if i%2 == 0 {
			f[i] = min(f[i-1]+x, f[i/2]+y)
		} else {
			f[i] = min(f[i-1]+x, f[(i+1)/2]+y+x)
		}
	}

	return f[n]
}

func main() {
	in = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

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

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

	in.Scan()
	x, _ := strconv.Atoi(in.Text())

	in.Scan()
	y, _ := strconv.Atoi(in.Text())

	res := dp(n, int64(x), int64(y))

	out.WriteString(strconv.FormatInt(res, 10))
	out.WriteByte('\n')
}


package main

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

var in *bufio.Scanner
var out *bufio.Writer

func dp(n int, x int64, y int64) int64 {
	f := make([]int64, n+1)

	f[0] = 0
	for i := 1; i <= n; i++ {
		if i%2 == 0 {
			f[i] = min(f[i-1]+x, f[i/2]+y)
		} else {
			f[i] = min(f[i-1]+x, f[(i+1)/2]+y+x)
		}
	}

	return f[n]
}

func main() {
	in = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)

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

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

	in.Scan()
	x, _ := strconv.Atoi(in.Text())

	in.Scan()
	y, _ := strconv.Atoi(in.Text())

	res := dp(n, int64(x), int64(y))

	out.WriteString(strconv.FormatInt(res, 10))
	out.WriteByte('\n')
}


package main

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

func main() {
	var s string = ""
	reader := bufio.NewReader(os.Stdin)
	s, _ := reader.ReadString('\n')
	var result string = ""
	for i := 0; i < len(s); i++ {
		if s[i:i+1] == "." {
			result += "0"
		} else if s[i:i+1] == "-" {
			if s[i+1:i+2] == "." {
				result += "1"
				i++
			} else if s[i+1:i+2] == "-" {
				result += "2"
				i++
			}
		}

	}
	fmt.Println(result)
}


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 = uint(1)<<cnt
	for i := 1; i < mask; i++ {
		for j, mm := 0, 1; j < cnt; j, mm = j+1, mm<<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]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 = 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 = 1<<cnt
	for i := 1; i < mask; i++ {
		for j, mm := 0, 1; j < cnt; j, mm = j+1, mm<<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"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	exp := map[int]string{
		1:  "one",
		2:  "two",
		3:  "three",
		4:  "four",
		5:  "five",
		6:  "six",
		7:  "seven",
		8:  "eight",
		9:  "nine",
		10: "ten",
		11: "eleven",
		12: "twelve",
		13: "thirteen",
		15: "fifteen"
		18: "eighteen",
		20: "twenty",
		30: "thirty",
		40: "forty",
		50: "fifty",
		80: "eighty",
	}

	var scr int
	fmt.Fscan(reader, &scr)
	if _, exst := exp[scr]; exst {
		fmt.Println(exp[scr])
		return
	}

	if scr/10 == 1 {
		fmt.Printf("%s%s", exp[scr%10], "teen")
	} else {
		if _, exst := exp[(scr/10)*10]; exst {
			fmt.Print(exp[(scr/10)*10])
		} else {
			fmt.Printf("%s%s", exp[scr/10], "ty")
		}

		fmt.Printf("-%s", exp[scr%10])
	}
}


// 203A-mic_rizal
package main

import (
	"fmt"
)

func main() {
	var x, t, a, b, y, k int

	fmt.Scan(&x, &t, &a, &b, &y, &k)

	ret := false

	if x == 0 {
		ret = true
	}
	for i := 0; i < t; i++ {
		if x == a-i*y {
			ret = true
		}
	}
	for i := 0; i < t; i++ {
		if x == b-i*k {
			ret = true
		}
	}
	for i := 0; i < t; i++ {
		for r := 0; r < t; r++ {
			if x == a-i*y+b-r*k {
				ret = true
			}
		}
	}
	if ret {
		fmt.Println("YES")
	} else {4
		fmt.Println("NO")
	}
}


// 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 "bufio"
import "os"
import "fmt"
import "math"

func Read(s *bufio.Reader) string {
    line, _ := s.ReadString('\n')
    return line
}

func Write(s *bufio.Writer, a ...interface{}) {
    fmt.Fprintln(s, a...)
    s.Flush()
}

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

    var n int
    fmt.Sscanln(Read(reader), &n)

    a := make([]int, 0)

    if n == 1 {
        a = append(a, 1)
    }

    //end := int(math.Pow(float64(n), 0.5)) + 1
    for int(math.Mod(float64(n), 2)) == 0 {
        n = n / 2
        a = append(a, 2)
    }

    for i := 3; i <= n; i++ {
        for int(math.Mod(float64(n), float64(i))) == 0 {
            n = n / i
            a = append(a, i)
        }
    }

    var result int = a[0]
    for i := 1; i < len(a); i++ {
        if a[i] != a[i - 1] {
            result *= a[i]
        }
    }

    writer := bufio.NewWriter(os.Stdout)
    Write(writer, result)
}


package main

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

func Read(s *bufio.Reader) string {
    line, _ := s.ReadString('\n')
    return line
}

func Write(s *bufio.Writer, a ...interface{}) {
    fmt.Fprintln(s, a...)
    s.Flush()
}

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

    var n int
    fmt.Sscanln(Read(reader), &n)

    a := make([]int, 0)

    if n == 1 {
        a = append(a, 1)
    }

    for int(math.Mod(float64(n), 2)) == 0 {
        n = n / 2
        a = append(a, 2)
    }

    for i := 3; i <= n; i++ {
        for int(math.Mod(float64(n), float64(i))) == 0 {
            n = n / i
            a = append(a, i)
        }
    }

    var result int = a[0]
    for i := 1; i < len(a); i++ {
        if a[i] != a[i - 1] {
            result *= a[i]
        }
    }

    writer := bufio.NewWriter(os.Stdout)
    Write(writer, result)
}


package main

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

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

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

	return
}

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

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

	// solve()
}


package main

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

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

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

	return
}

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

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

	// solve()
}

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

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

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

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

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


package main

import "fmt"

func main() {
	var a1,a2,a3,a4 int
	fmt.Scanf("%d%d%d%d", &a1,&a2,&a3,&a4)

	sum := a1 + a2 + a3 + a4
	if sum % 2 != 0 {
		fmt.Printf("NO")
	} else {
		if a1 + a2 == sum / 2 || a1 + a3 == sum / 2 || a1 + a4 == sum / 2
		|| a1 == sum / 2 || a2 == sum / 2 || a3 == sum / 2 || a4 == sum / 2 {
			fmt.Printf("YES")
		} else {
			fmt.Printf("NO")
		}
	}
}


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

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

	if m < 2 {
		return n - 1
	}

	return n * (m - 1)
}

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

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

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

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


package main

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

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

	if m < 2 {
		return n - 1
	}

	return n * (m - 1)
}

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

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

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

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


package main

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

func countDominoes(n, m int) (res int) {
	return n * (m - 1)
}

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

	fmt.Println(line, isPrefix)
}


package main

import (
    "bufio"
    "fmt"
)

func main(){
    bufReader := bufio.NewReader(os.Stdin)
    line, err := bufReader.ReadLine()

    if err != nil {
        fmt.Fatalin(err, "\n", line)
    }
    fmt.Println(line)
}


package main

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

func getNumFromOneLine(ir *bufio.Reader) int {
	stream, _ := ir.ReadString('\n')
	// Trims the stream and then splits
	trimmedStream := strings.TrimSpace(stream)
	num, _ := strconv.Atoi(trimmedStream)
	return num
}

func getNumsFromOneLine(ir *bufio.Reader) []int {
	stream, _ := ir.ReadString('\n')
	// Trims the stream and then splits
	trimmedStream := strings.TrimSpace(stream)
	splitArr := strings.Split(trimmedStream, " ")
	// convert strings to integers and store them in a slice
	nums := make([]int, len(splitArr))
	for index, val := range splitArr {
		nums[index], _ = strconv.Atoi(val)
	}
	return nums
}

func main() {
	ir := bufio.NewReader(os.Stdin)
	_ := getNumFromOneLine(ir)
	nums := getNumsFromOneLine(ir)

	pos, neg := 0, 0
	for _, num := range nums {
		if num > 0 {
			pos += 1
		} else if num < 0 {
			neg += 1
		}
	}

	if neg >= (len(nums)+1)/2 {
		fmt.Println(-1)
	} else if pos >= (len(nums)+1)/2 {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}


package main

import (
    "fmt"
    "math"
)

func main() {
    var n int64
    fmt.Scan(&n)
    if n == 1 {
        fmt.Printf("1\n0")
        return
    }

    if min_factor(n) == 1 {
        fmt.Printf("1\n0")
        return
    }

    sq := int(math.Sqrt(float64(n)))
    for i := 2; i <= sq; i++ {
        if n % int64(i) == 0 {
            if min_factor(n / int64(i)) != 1 {
                fmt.Printf("1\n%v", int64(i) * min_factor(n / int64(i)))
                break
            } else {
                fmt.Printf("2")
                break
            }
        }
    }

    return
}

func min_factor(x int64) int64 {
    sq := int64(math.Sqrt(float64(n)))
    for i := int64(2); i <= sq; i++ {
        if x % i == 0 {
            return i
        }
    }

    return 1
}


package main

import (
    "fmt"
    "math"
)

func main() {
    var n int64
    fmt.Scan(&n)
    if n == 1 {
        fmt.Printf("1\n0")
        return
    }

    if min_factor(n) == 1 {
        fmt.Printf("1\n0")
        return
    }

    sq := int(math.Sqrt(float64(n)))
    for i := 2; i <= sq; i++ {
        if n % int64(i) == 0 {
            if min_factor(n / (int64)i) != 1 {
                fmt.Printf("1\n%v", int64(i) * min_factor(n / (int64)i))
                break
            } else {
                fmt.Printf("2")
                break
            }
        }
    }

    return
}

func min_factor(x int64) int64 {
    sq := int64(math.Sqrt(float64(n)))
    for i := int64(2); i <= sq; i++ {
        if x % i == 0 {
            return i
        }
    }

    return 1
}


package main

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

const maxSide = (1 << 12) - 1

var (
	hilbert [maxSide][maxSide]bool
	level   [maxSide][maxSide]float64
)

func build(row, col int, level uint) {
	if level == 1 {
		return
	}
	side := (1 << level) - 1
	midr, midc := row+side/2, col+side/2

	build(midr+1, col, level-1)

	for r := 0; r < side/2; r++ {
		for c := 0; c < side/2; c++ {
			hilbert[midr+r+1][midc+c+1] = hilbert[midr+r+1][col+c]
			hilbert[row+c][midc+1+side/2-1-r] = !hilbert[midr+r+1][col+c]
			hilbert[row+side/2-c-1][col+r] = !hilbert[midr+r+1][col+c]
		}
	}

	// stitching
	for c := col; c < col+side; c++ {
		hilbert[midr][c] = false
	}
	for r := row; r < row+side; r++ {
		hilbert[r][midc] = r > midr
	}
}

const eps = 1e-7

// var cosa, tana2 float64 // cache

func area(distance, a float64) float64 {
	if distance < 0 {
		panic("Negative distance")
	}
	if a < 0 || a > math.Pi/2 {
		panic("Angle out of bounds")
	}

	cosa, tana := math.Cos(a), math.Tan(a)
	left := distance / cosa
	// Special case when angle is next to zero.
	if a < eps {
		if left > 1 {
			return 1
		}
		return left
	}
	right := left - tana
	fmt.Printf("distance %f, angle %f, left %f, right %f\n", distance, a, left, right)
	if left < 1 {
		// No side above the brim.
		return (left + right) / 2
	}
	if right > 1 {
		// Both sides above the brim.
		return 1
	}
	// Left side is above, right is not.
	return 1 - (1-right)*(1-right)/(2*tana)
}

func main() {
	fmt.Println(area(1 / (8 * math.Sqrt(float64(1)/2)), math.Pi/4))
	return

	/**/
	input := os.Stdin
	output := os.Stdout
	/*/
	input, err := os.Open("important.in")
	if err != nil {
		panic(err)
	}
	output, err := os.Create("important.out")
	if err != nil {
		panic(err)
	}
	/**/
	var n, a int
	fmt.Fscanf(input, "%d %d", &n, &a)
	fmt.Fprintf(output, "%d %d\n", n, a)

	build(0, 0, uint(n))
	side := (1 << uint(n)) - 1
	var queue []int
	arad := float64(a) * math.Pi / 180
	cosa := math.Cos(arad)
	for c := 0; c < side; c++ {
		if !hilbert[0][c] {
			queue = append(queue, 0)
			queue = append(queue, c)
			level[0][c] = cosa
		}
	}
	for ; len(queue) != 0; queue = queue[2:] {
		row, col := queue[0], queue[1]
		fmt.Println(row, col)
	}
	fmt.Println(cosa)
	/*
		for i := 0; i < (1<<uint(n))-1; i++ {
			for j := 0; j < (1<<uint(n))-1; j++ {
				print := ' '
				if hilbert[i][j] {
					print = '#'
				}
				fmt.Fprintf(output, "%c", print)
			}
			fmt.Fprintln(output)
		}
	*/
}


package main

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

func main() {
	n := ReadInt64()
	a := ReadInt64s(3)
	b := ReadInt64s(3)
	min, max := solve(n, a, b)
	fmt.Printf("%d %d\n", min, max)
}

func solve(n int64, a, b []int64) (int64, int64) {
	max := int64(0)
	Min = Min(a[0], b[1]) + Min(a[1], b[2]) + Min(a[2], b[0])

	cnt := int64(0)
	cnt += Min(a[0], b[1]+b[2]) + Min(a[1], b[2]+b[0]) + Min(a[2], b[0]+b[1])
	min := n - cnt

	return min, max
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadString() (s string) { Scan(&s); return }
func ReadInt() (i int)       { Scan(&i); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
func ReadInt64() (i int64) { Scan(&i); return }
func ReadInt64s(n int) []int64 {
	v := make([]int64, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


// 388A
package main

import (
	"fmt"
	"sort"
)

func main() {
	var x [100]int
	var n, rnt int
	for fmt.Scan(n) {
		for i := 0; i < n; i++ {
			fmt.Scan(x[i])
		}
		sort.Ints(x[:])
		for rnt = 1; rnt <= n; rnt++ {
			for j := 0; j < n; j++ {
				if x[j]-j/rnt < 0 {
					break
				}
				if j == n {
					break
				}
			}
		}
	}
	fmt.Println(rnt)
}


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


import (
    "fmt"
)

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


import (
	"fmt"
)

func min(n1 int, n2 int) int {
	if n1 < n2 {
		return n1
	} else {
		return n2
	}
}

func main() {
	var y, b, r int
	fmt.Scanf("%d %d %d", &y, &b, &r)
	yNum := min(y, min(b-1, r-2))
	fmt.Println(yNum*3 + 3)
}


package main

import (
    "fmt"
)

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


package main

import (
    "fmt"
)

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


package main

import (
    "fmt"
    )
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")
    }

}


fun main()
{
    val s = readLine()!!.toBigInteger(2).dec()
    val a = (s.bitLength() + 1) / 2
    println(a)
}


package main

import "fmt"
//2N+1 people, then N food is enough
//2N people, then N food is enough
func main(){
	var n int
	fmt.Scanf("%d", &n)
	if n & 1 == 1{
		fmt.Printf("%d\n", n >> 1)
	}else{ // n & 1 == 0
		var maxpoweroftwo int
		maxpoweroftwo = 1
		while maxpoweroftwo <= n {
			maxpoweroftwo <<= 1
		}
		fmt.Printf("%d\n", (n - maxpoweroftwo) >> 1)
	}
}


package main

import (
	"fmt"
	"math"
)

func scanInput() (int64, int64, int64) {
	var x, y, m int64
	fmt.Scanf("%d %d %d\n", &x, &y, &m)
	return x, y, m
}

func fibo(x, y, m int64) int64 {
	var n int64
	if n = 0; x < m && y < m && (x+y) <= y && (x+y) <= x {
		n = -1
		return n
	} else if math.Signbit(float64(x)) != math.Signbit(float64(y)) {
		if x > y {
			x, y = y, x
		}
		n = (-x) / y
		x = -((-x) % y)
	}

	for x < m && y < m {
		t := x + y
		if x < y {
			x = t
		} else {
			y = t
		}
		n++
	}
	return n
}


# define _CRT_SECURE_NO_DEPRECATE
# include <fstream>
# include <iostream>
# include <stdlib.h>
# include <queue>
# include <string>
# include <cstdio>
# include <stdio.h>
# include <math.h>
# include <algorithm>
# include <vector>
# include <unordered_map>
# include <set>
# include <map>
# include <iomanip>
# include <math.h>
# include <stack>
# include <functional>
# define inf 9223372036854775807
# define mp make_pair
# define pb push_back
# define FOR(k,a,z) for (int   k=a;k<z;k++)
# define pi 3.14159265359
# define maxlong long 2147483647
# define ll long long

#include <cstdio>
#include <cstring>
#define LSOne(S) (S & (-S))
#define MAXLOG 50
#include <sstream>
#include <utility>

#define P 1000000007
#define INF 1000000000

using namespace std;

unordered_map<int,int> a;
int n;

int  main() {
   // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

    cin>>n;
    int j = n-1;
    int la = 1;
    int s=0;

    while (j>=la) {

        if (j>la) {
            s+=2;

            int sad = n-2*la;
            if (sad>la&&sad%la==0) s+=1;

            sad=n-2*j;
            if (sad>j&&sad%j==0) s+=1;

        } else if(j==la){
            s+=1;
            break;
        } else break;

        j--;
        la++;
    }

    cout<<n*(n+1)/2-s;

    return 0;
}


package main

import (
    "strconv"
    "bufio"
    "os"
    "fmt"
)
// var file, _ = os.Open("input.txt")
// var outfile, _ = os.Create("output.txt")
// var in = bufio.NewScanner(file)
// var out = bufio.NewWriter(outfile)
var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

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

func nextInt() int {
    ret, _ := strconv.Atoi(next())
    return ret
}

func nextFloat() float64 {
    ret, _ := strconv.ParseFloat(next(), 64)
    return ret
}

func main() {
    defer out.Flush()
    in.Split(bufio.ScanWords)
    n1 := nextInt()
    n2 := nextInt()
    k1 := nextInt()
    k2 := nextInt()
    if n1 > n2 {
        fmt.Fprintln(out, "First");
    } else {
        fmt.Fprintln(out, "Second");
    }
}