package main

import (
"fmt"
"math/big"
)

const mod = 1000000007;

func main() {
	var n, m int64

	fmt.Scan(&n, &m)

	var tmp big.Int

	var t = tmp.Exp(big.NewInt(2), big.NewInt(m), big.NewInt(mod));
	t = tmp.Sub(t, big.NewInt(1))
	t = t.Exp(t, big.NewInt(n), big.NewInt(mod))

	fmt.Print(t)
}


package main

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

func main() {
	// reader := bufio.NewReader(os.Stdin)
	// reader.ReadLine()
	// fmt.Scanf("%d", &N)
	var s string
	fmt.Scanf("%s", &s)
	res := 0
	l := len(s)
	for i := 0; i < l/2; i++ {
		if s[i] != s[l-1-i] {
			res += 1
		}
	}

	if res == 1 {
		fmt.Println("YES")
	} else if res == 0 && l%2 == 1{
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

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

	S := io.NextLine()
	N := len(S)

	misses := 0

	for i, j := 0, N - 1; i < j; i, j = i + 1, j - 1 {
		if S[i] != S[j] {
			misses++
		}
	}

	if (N % 2 == 0 && misses == 1) || (N % 2 == 1 && misses <= 1) {
		io.Printf("YES\n")
	} else {
		io.Printf("NO\n")
	}

	io.FlushOutput()
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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


package main

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

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

	S := io.NextLine()
	N := len(S)

	misses := 0

	for i, j := 0, N - 1; i < j; i, j = i + 1, j - 1 {
		if S[i] != S[j] {
			misses++
		}
	}

	if N % 2 == 0 {
		if misses == 1 {
			io.Printf("YES\n")
		} else {
			io.Printf("NO\n")
		}
	} else {
		if misses <= 1 {
			io.Printf("YES\n")
		} else {
			io.Printf("NO\n")
		}
	}

	io.FlushOutput()
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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


package main

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

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

	var n int
	var s string

	fmt.Fscanf(in, "%d\n%s", &n)
	fmt.Fscanf(in, "%s\n", &s)
	fmt.Println(betweenTheOffices(n, s))
}

func betweenTheOffices(n int, s string) string {
	var count int
	for i := 0; i < n-1; i++ {
		if s[i] == 'F' && s[i+1] == 'S' {
			count--
		} else if s[i] == 'S' && s[i+1] == 'F' {
			count++
		}
	}

	if count > 0 {
		return "YES"
	}
	return "NO"
}


package main
import (
	"fmt"
	"strings"
)

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

}


package main

import (
	"fmt"
)

func main() {
	var a int
	olChar := "abcd"
	fromStoF := 0
	fromFtoS := 0

	fmt.Scanln(&a)

	var inp string
	fmt.Scan(&inp)

	for _, char := range inp {
		charNew := string(char)
		if olChar != "abcd" {
			if charNew == "S" && charNew != olChar {
				fromFtoS++
			} else if charNew == "F" && charNew != olChar {
				fromStoF++
			}
		}
		olChar = charNew
	}

	if fromStoF > fromFtoS {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import (
	"fmt"
	"os"
)

func main() {
	luckyNum := []int{4, 7}
	s := 0
	for i := 0; i < 2; i++ {
		tp := len(luckyNum)
		for _, num := range luckyNum[s:] {
			luckyNum = append(luckyNum, num*10+4, num*10+7)
		}
		s = tp
	}
	var n int
	fmt.Scan(&n)
	for _, num := range luckyNum {
		if n%num == 0 {
			fmt.Println("YES")
			os.Exit(0)
		}
	}
	fmt.Println("NO")
}


package main

import "fmt"

func main() {
	var inp int
	var flag bool
	var lst [12]int = [12]int{4, 7, 44, 47, 74, 77, 444, 447, 477, 744, 747, 777}
	fmt.Scan(&inp)
	for i := 0; i < len(lst); i++ {
		if inp%lst[i] == 0 {
			flag = true
			break
		}
	}
	if flag {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import (
    "fmt"
)

func generateLuckyNumberList(maximum int) []int {
    nums := []int{4, 7}
    lastEnd := 0
    for nums[len(nums)-1] < maximum {
        curEnd := len(nums)
        for i := lastEnd; i < curEnd; i++ {
            nums = append(nums, nums[i]*10+4)
            nums = append(nums, nums[i]*10+7)
        }
        lastEnd = curEnd
    }
    return nums
}

func main() {
    lucky := generateLuckyNumberList(1000)

    var n int
    fmt.Scanf("%d", &n)
    for i := 0; lucky[i] <= n && i < len(lucky); i++ {
        if n%lucky[i] == 0 {
            fmt.Println("YES")
            return
        }
    }
    fmt.Println("NO")
}


package main

import "fmt"

func main() {
	var S, n int32
	fmt.Scan(&n, &S)
	result := (S + n - 1) / n
	fmt.Println(result)
}


package main

import "fmt"

func main() {
	var s, n int
	fmt.Scanf("%d%d", &n, &s)
	fmt.Printf("%d\n", (s+n-1)/n)
}


package main

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

func main(){

	buf := bufio.NewReader(os.Stdin)

	var n int
	var s int
	fmt.Fscanf(buf, "%d %d\n", &n,&s)
	var ans int = s/n
	if s%n != 0{
		ans++
	}
	fmt.Print(ans)
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var x1, y1 float64
	var x2, y2 float64
	fmt.Scanf("%f %f\n", &x1, &y1)
	fmt.Scanf("%f %f\n", &x2, &y2)

	xDiff := math.Abs(x1 - x2)
	yDiff := math.Abs(y1 - y2)

	res := int(math.Max(xDiff, yDiff))
	fmt.Println(res)
}


package main

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

var scanner = bufio.NewScanner(os.Stdin)

func init() {
	scanner.Split(bufio.ScanWords)
}

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

func scanBytes() []byte {
	scanner.Scan()
	return scanner.Bytes()
}

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

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

func scanInts(n int) []int {
	l := make([]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		l[i], _ = strconv.Atoi(scanner.Text())
	}

	return l
}

func scanInts64(n int64) []int64 {
	l := make([]int64, n)
	for i := int64(0); i < n; i++ {
		scanner.Scan()
		l[i], _ = strconv.ParseInt(scanner.Text(), 10, 64)
	}

	return l
}

func scanBool() bool {
	scanner.Scan()
	v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	return v == 1
}

func scanBools(n int64) []bool {
	l := make([]bool, n)
	for i := int64(0); i < n; i++ {
		scanner.Scan()
		v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		l[i] = v == 1
	}

	return l
}

func scanUint64() uint64 {
	scanner.Scan()
	v, _ := strconv.ParseUint(scanner.Text(), 10, 64)
	return v
}

type ByO []int

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

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

func main() {
	x1, y1 := scanInt64(), scanInt64()
	x2, y2 := scanInt64(), scanInt64()

	d := max64(abs64(x2-x1), abs64(y2-y1))
	fmt.Println(d)
}

func abs64(a int64) int64 {
	if a >= 0 {
		return a
	}

	return -a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}

	return -a
}

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

	return b
}

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

	return b
}


// Codeforces problem 620A
package main

import (
    "bufio"
    "fmt"
    "os"
    "strconv"
    "strings"
)
func Abs(x int) int {
    if x < 0 {
        return -x
    }
    return x
}
func Max(x int, y int) int {
    if x < y {
        return y
    }
    return x
}

func main() {
    reader := bufio.NewReader(os.Stdin)
    // read x1, y1
    s, _ := reader.ReadString('\n')
    ss := strings.Split(strings.TrimSpace(s), " ")
    x1,_ := strconv.Atoi(ss[0])
    y1,_ := strconv.Atoi(ss[1])
    // read x2, y2
    s, _ = reader.ReadString('\n')
    ss = strings.Split(strings.TrimSpace(s), " ")
    x2,_ := strconv.Atoi(ss[0])
    y2,_ := strconv.Atoi(ss[1])
    // calculkate dist
    dx := Abs(x2-x1)
    dy := Abs(y2-y1)
    dist := Max(dx,dy)
    fmt.Println(dist)
}


package main

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

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

func scanf(f string, a ...interface{}) {
	fmt.Fscanf(reader, f, a...)
}
func printf(f string, a ...interface{}) {
	fmt.Fprintf(writer, f, a...)
}
func scan(a ...interface{}) {
	fmt.Fscan(reader, a...)
}
func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}
func println(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	_main()
	writer.Flush()
}
// head
var n int
var s string
var m int
var valid []int
func _main() {
    scan(&n, &s)
	m = len(s)

	valid = append(valid, 0)
	for i := 1; i < n; i ++ {
		success := true
		for j := 0; j < m; j ++ {
			k := (i + j) % n
			if k < m && s[k] != s[j] {
				success = false
				break
			}
		}
		if success {
			valid = append(valid, i)
		}
	}

	//println("valid =", valid)
	dp := make([]int64, n)
	dp[0] = 1
	var ans int64
    for _, i := range valid {
    	//println("i = ", i)
		for _, j := range valid {
			k := (i + j) % n
			if k >= i {
				continue
			}
			//println("\tk = ", k)
			dp[i] -= dp[k] << uint(max(0, i - k -m))

		}
        ans += dp[i] * int64(n - i) << (uint)(max(0, n - m - i))
	}
	println(ans)
}


package main

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

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

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

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

func min(a ...int) int {
	min := -1
	for _, val := range a {
		if val < min {
			min = val
		}
	}
	return min
}

func max(a ...int) int {
	max := -1
	for _, val := range a {
		if val > max {
			max = val
		}
	}
	return max
}

func tr(n int) int {
	for n%10 == 0 {
		n = n / 10
	}
	return n
}

func main() {
	defer writer.Flush() // STDOUT MUST BE FLUSHED MANUALLY!!!
	var n int
	scan(&n)
	cnt := 0
	m := map[int]bool{}

	for {
		if m[n] == false {
			m[n] = true
			cnt++
		} else {
			break
		}
		n++
		n = tr(n)
	}
	print(cnt)
}


package main

import "fmt"

func main()  {
	var x int
	_, _ = fmt.Scanf("%d", &x)

	res := 1

	numbers := map[int]bool{x: true}

	for {
		x += 1

		for x % 10 == 0 {
			x = x / 10
		}

		if _, ok := numbers[x]; ok {
			break
		}

		numbers[x] = true
		res += 1
	}

	fmt.Println(res)
}


package main

import (
	"fmt"
)

func solve(n int) int {
	m := map[int]bool{}
	m[n] = true

	for ok := false; !ok; {

		n++

		for n > 0 && n%10 == 0 {
			n /= 10
		}

		ok = m[n]
		m[n] = true
	}

	return len(m)
}

func main() {
	var n int

	fmt.Scan(&n)

	ans := solve(n)
	fmt.Println(ans)
}


package main
import "fmt"

func main(){
	// your code goes here
	var w int
	fmt.Scan(&w)
	result := "NO"
	if w > 2 && w % 2 == 0 {
		result = "YES"
	}
	fmt.Println(result)
}


package main

import (
    "fmt"
)

func main() {

    var w int
    fmt.Scan(&w)

    for i := 1; i < w; i++ {
        other := w-i
        if other % 2 == 0 && w % 2 == 0 {
            fmt.Print("YES")
            return
        }
    }
    fmt.Print("NO")

}


package main

import "fmt"

func main() {
	var n int
	var cont int
	fmt.Scanf("%d", &n)
	for i := 1; i <= n; i++ {
		if i%2 == 0 {
			if n%i == 0 {
				cont++
			}
		}
	}
	if cont >= 2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import "fmt"

func main() {

	var n, k int
	_, _ = fmt.Scan(&n, &k)

	for i := 0; i < k; i++ {
		if n%10 == 0 {
			n /= 10
		} else {
			n--
		}
	}

	fmt.Println(n)

}


package main

import . "fmt"

func main() {
	var n, k int
	for Scan(&n, &k); k > 0; k-- {
		if n%10 > 0 {
			n--
		} else {
			n /= 10
		}
	}
	Print(n)
}


package main

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

func main() {
	var scanner *bufio.Scanner
	var line []string
	var n, k int

	scanner = bufio.NewScanner(os.Stdin)

	if scanner.Scan() {
		line = strings.Fields(scanner.Text())
		n, _ = strconv.Atoi(line[0])
		k, _ = strconv.Atoi(line[1])

		for i := 0; i < k; i++ {
			n = tanya(n)
		}

		fmt.Println(n)
	}
}

func tanya(number int) int {
	if number%10 == 0 {
		return number / 10
	}
	return number - 1
}


package main

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

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

func p(a ...interface{})                { fmt.Fprint(writer, a...) }
func pln(a ...interface{})              { fmt.Fprintln(writer, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }

func scan(a ...interface{})            { fmt.Fscan(reader, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var s string
	scan(&s)

	s = regexp.MustCompile("(WUB)+").ReplaceAllLiteralString(s, " ")
	s = strings.Trim(s, " ")
	// wub_removed := strings.ReplaceAll(s, "WUB", " ")
	// words := strings.Fields(wub_removed)
	// original_string := strings.Join(words, " ")
	pln(s)
	return
}


package main

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

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 str string
  scanf("%str\n", &str)

  str = regexp.MustCompile("(WUB)+").ReplaceAllLiteralString(str, " ")
  str = strings.Trim(str, " ")

  printf("%s\n", str)
}


package main

import s "strings"
import "fmt"

func main (){
	var x string
	fmt.Scanf("%s", &x)
	c := s.ReplaceAll(x, "WUB", " ")
	fmt.Println(s.Trim(c, " "))

}


package main

import (
    "fmt"
    )

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

    rs := 0
    cx := make([]bool, c, c)
    for i := 0; i < r; i++ {
        var line string
        fmt.Scan(&line)
        find := false
        for j := 0; j < c; j++ {
            if line[j] == 'S' {
                find = true
                cx[j] = true
            }
        }
        if find {
            rs++
        }
    }

    cs := 0
    for i := 0; i < c; i++ {
        if cx[i] {
            cs++
        }
    }

    fmt.Println(r*c - rs*cs)
}


package main

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

func main() {
	var r,c, h_hewtee, h_bosoo uint
	var s []string

	var so string
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d %d\n", &r, &c)
	for i := uint(0); i < r; i++{
		fmt.Fscanf(in, "%s\n", &so)
		s = append(s, so)
	}
	for i:=uint(0); i < r; i++{
		for j:=uint(0); j < c; j++{
			if string(s[i][j]) == "S"{
				h_hewtee++
				break
			}
		}
	}
	fmt.Println()
	for i:=uint(0); i < c; i++{
		for j:=uint(0); j < r; j++{
			if string(s[j][i]) == "S"{
				h_bosoo++
				break
			}
		}
	}
	fmt.Println(r*c - h_bosoo * h_hewtee)
}


package main

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

var sc = NewMyScanner()

func solve() int {
	r, c := sc.Int(), sc.Int()
	m := sc.Map2D(r, c)

	anyInRow, anyInCol := make([]bool, r), make([]bool, c)
	for y := range m {
		for x := range m[0] {
			if m[y][x] == byte('S') {
				anyInRow[y] = true
				anyInCol[x] = true
			}
		}
	}

	ans := 0
	for y := range m {
		for x := range m[0] {
			if !anyInRow[y] || !anyInCol[x] {
				ans++
			}
		}
	}
	return ans
}

type MyScanner struct {
	*bufio.Scanner
	justScanned bool
}

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

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

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

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

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

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

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

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


package main

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

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

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

	s := ""
	w, b := 0, 0

	for line := 0; line < 8; line++ {
		s = next()

		for i := 0; i < len(s); i++ {
			switch s[i] {
			case 'Q':
				w += 9
			case 'R':
				w += 5
			case 'B', 'N':
				w += 3
			case 'P':
				w += 1
			case 'q':
				b += 9
			case 'r':
				b += 5
			case 'b', 'n':
				b += 3
			case 'p':
				b += 1
			}
		}
	}
	// println(w, b)
	if w == b {
		println("Draw")
	} else if w > b {
		println("White")
	} else {
		println("Black")
	}
}

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 nextFloat() float64 {
	n, _ := strconv.ParseFloat(next(), 64)
	return n
}

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

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


package main

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

func main() {
	var s string
	var score int
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < 8; i++ {
		line, _ := reader.ReadString('\n')
		s = s + line
	}
	for _, i := range s {
		switch i {
		case 'q':
			score += 9
		case 'r':
			score += 5
		case 'b':
			score += 3
		case 'n':
			score += 3
		case 'p':
			score += 1
		case 'Q':
			score -= 9
		case 'R':
			score -= 5
		case 'B':
			score -= 3
		case 'N':
			score -= 3
		case 'P':
			score -= 1
		default:
			continue
		}
	}
	if score == 0 {
		fmt.Println("Draw")
	} else if score > 0 {
		fmt.Println("Black")
	} else {
		fmt.Println("White")
	}
}


package main

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

func main() {
	var s string
	var black, white int
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < 8; i++ {
		line, _ := reader.ReadString('\n')
		s = s + line
	}
	for _, i := range s {
		switch i {
		case 'q':
			black += 9
		case 'r':
			black += 5
		case 'b':
			black += 3
		case 'n':
			black += 3
		case 'p':
			black += 1
		case 'Q':
			white += 9
		case 'R':
			white += 5
		case 'B':
			white += 3
		case 'N':
			white += 3
		case 'P':
			white += 1
		default:
			continue
		}
	}
	if black == white {
		fmt.Println("Draw")
	} else if black > white {
		fmt.Println("Black")
	} else {
		fmt.Println("White")
	}
}


package main

// https://codeforces.com/problemset/problem/263/A

import "fmt"

const dimension = 5

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

func task_solution(a [][]int) int {
	for i, line := range a {
		for j, elem := range line {
			if elem == 1 {
				return abs(len(a)/2-i) + abs(len(line)/2-j)
			}
		}
	}
	panic("unexpected behavior")
}

func main() {
	a := [][]int{}
	for i := 0; i < dimension; i += 1 {
		line := []int{}
		for j := 0; j < dimension; j += 1 {
			var n int
			if _, err := fmt.Scan(&n); err != nil {
				panic(err)
			}
			line = append(line, n)
		}
		a = append(a, line)
	}

	fmt.Println(task_solution(a))
}


package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024 * 1024)
	ix, jx := 0, 0
	for i :=0; i < 5; i++ {
		out := strings.Split(readLine(reader), " ")
		for j, c := range out {
			if c == "1" {
				ix = i
				jx = j
				fmt.Println(math.Abs(float64(2-ix)) + math.Abs(float64(2-jx)))
				break
			}
		}
	}
}

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

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

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


package main

import (
	"fmt"
)

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

func main() {

	var n int
	moves := 0

	for i := 1; i <= 5; i++ {
		for j := 1; j <= 5; j++ {
			fmt.Scan(&n)
			if n == 1 {
				moves = abs(i-3) + abs(j-3)
			}
		}
	}
	fmt.Print(moves)
}


package main

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

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

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var T int
	con.Scan(&T)
next:
	for testcase := 0; testcase < T; testcase++ {
		var n int
		con.Scan(&n)
		for i := 2; i*i <= n; i++ {
			if n%i == 0 {
				a := n / i
				con.Println(a, n-a)
				continue next
			}
		}
		con.Println(1, n-1)
	}
	return nil
}


package main

import (
	"fmt"
	"math"
)

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

	for t > 0 {
		t--

		fmt.Scan(&n)

		val := 1
		for i := 2; i <= int(math.Sqrt(float64(n))); i++ {
			if n%i == 0 {
				val = i
				break
			}
		}

		if val == 1 {
			fmt.Println(1, n-1)
		} else {
			x := n / val
			fmt.Println(x, x*(val-1))
		}
	}
}


package main

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

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

func printf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, x, a...)
}

func scanf(x string, a ...interface{}) (n int, err error) {
	return fmt.Fscanf(in, x, a...)
}

type priorityQueue [][2]int

func (pq priorityQueue) Len() int {
	return len(pq)
}

func (pq priorityQueue) Less(i, j int) bool {
	return pq[i][1] > pq[j][1]
}

func (pq priorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
}

func (pq *priorityQueue) Push(x interface{}) {
	*pq = append(*pq, x.([2]int))
}

func (pq *priorityQueue) Pop() (res interface{}) {
	res = (*pq)[len(*pq)-1]
	*pq = (*pq)[:len(*pq)-1]
	return res
}

var err error

func NextInt() (n int) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return 0
		}
	}
}

func NextLong() (n int64) {
	for {
		_, err = scanf("%v", &n)
		if err == nil {
			return n
		}
		if err.Error() == "EOF" {
			return 0
		}
	}
}
func Euclid(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	gcd, s1, s2 := Euclid(b, a%b)
	return gcd, s2, s1 - s2*(a/b)
}

func main() {
	out = bufio.NewWriterSize(os.Stdout, 8192)
	defer out.Flush()
	if false {
		file, err := os.Open("in")
		if err != nil {
			log.Fatal(err)
		}
		in = bufio.NewReaderSize(file, 8192)
	} else {
		in = bufio.NewReaderSize(os.Stdin, 8192)
	}
outer:
	for cases := NextInt(); cases > 0; cases-- {
		n := NextInt()
		for i := 2; i*i <= n; i++ {
			if n%i == 0 {
				printf("%d %d\n", n/i, n-n/i)
				continue outer
			}
		}
		printf("%d %d\n", 1, n-1)
	}
}


package main

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

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

	n, m := readTwoNums(reader)
	res := solve(n, m)
	fmt.Println(res)
}

func normalize(s string) string {

	for i := len(s); i > 0; i-- {
		if s[i-1] >= 'a' && s[i-1] <= 'z' {
			return s[:i]
		}
	}
	return ""
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') && bs[x] != '-' {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

const MOD = 998244353
const MAX_N = 2021*2 + 10

var F [MAX_N]int
var I [MAX_N]int

func modAdd(a int, b int) int {
	a += b
	if a >= MOD {
		a -= MOD
	}
	return a
}

func modMul(a int, b int) int {
	res := int64(a) * int64(b)
	res %= MOD
	return int(res)
}

func pow(a, b int) int {
	r := 1
	for b > 0 {
		if b&1 == 1 {
			r = modMul(r, a)
		}
		a = modMul(a, a)
		b >>= 1
	}
	return r
}

func init() {
	F[0] = 1
	for i := 1; i < MAX_N; i++ {
		F[i] = modMul(i, F[i-1])
	}
	I[MAX_N-1] = pow(F[MAX_N-1], MOD-2)
	for i := MAX_N - 2; i >= 0; i-- {
		I[i] = modMul(i+1, I[i+1])
	}
}

func nCr(n int, r int) int {
	res := F[n]
	res = modMul(res, I[r])
	res = modMul(res, I[n-r])
	return res
}

func solve(n int, m int) int {
	// must be dp, but how?
	if n < m {
		n, m = m, n
	}
	var ans int
	for r := 1; r < n; r++ {
		var f int
		for c := m - 1; c >= 1; c-- {
			f = modAdd(f, modMul(nCr(n-r+m-c-1, n-r), nCr(c+n-r-1, n-r-1)))
			ans = modAdd(ans, modMul(nCr(r+c-1, r), modMul(nCr(m-c+r-1, r-1), f)))
		}
	}

	n, m = m, n

	for r := 1; r < n; r++ {
		var f int
		for c := m - 1; c >= 1; c-- {
			ans = modAdd(ans, modMul(nCr(r+c-1, r), modMul(nCr(m-c+r-1, r-1), f)))
			f = modAdd(f, modMul(nCr(n-r+m-c-1, n-r), nCr(c+n-r-1, n-r-1)))
		}
	}

	return modMul(ans, 2)
}


package main
import "fmt"

func main(){
	// your code goes here
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	output := (n / 2) * k
	if n % 2 > 0 {
		output += (k / 2)
	}
	fmt.Println(output)
}


//  URL: http://codeforces.com/contest/50/problem/A
//  PROBLEM RESTATEMENT
//      Given a rectangular board of M x N squares, and 2 x 1 dominoes,
//      determine the maximum number of dominoes that can be placed s.t:
//          * Each domino covers two squares.
//          * No two dominoes overlap.
//          * Each domino lies entirely inside the board.
//  APPROACH
//      (1) Color the board like a chessboard.
//      (2) Each domino covers exactly 1 black and 1 white square.
//      (3) The maximum number of dominoes that can be placed is equal to the
//          min(white, black) squares in the board.

package main

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

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


package main

import (
	"fmt"
)

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


// A. Love "A"
/*
Alice has a string 𝑠. She really likes the letter "a".
She calls a string good if strictly more than half of the characters in
that string are "a"s. For example "aaabb", "axaa" are good strings,
and "baca", "awwwa", "" (empty string) are not.

Alice can erase some characters from her string 𝑠. She would like to know
what is the longest string remaining after erasing some characters
(possibly zero) to get a good string. It is guaranteed that the string has
at least one "a" in it, so the answer always exists.

Input
The first line contains a string 𝑠(1≤|𝑠|≤50) consisting of lowercase
English letters. It is guaranteed that there is at least one "a" in 𝑠.

Output
Print a single integer, the length of the longest good string
that Alice can get after erasing some characters from 𝑠.

Examples
Input
xaxxxxa

Output
3

Input
aaabaa

Output
6

Note
In the first example, it's enough to erase any four of the "x"s.
The answer is 3 since that is the maximum number of characters that can remain.

In the second example, we don't need to erase any characters.
*/
package main

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

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

	sol1146A(strings.TrimSpace(input))
}

func sol1146A(s string) {
	total, c := len(s), 0

	for _, v := range s {
		if v == 'a' {
			c++
		}
	}

	if c > total/2 {
		fmt.Println(total)
	} else {
		fmt.Println(c*2 - 1)
	}
}


package main

import "fmt"

func main() {
	var str string
	fmt.Scan(&str)
	a, l := 0, len(str)
	for _, r := range str {if r == 'a' {a++}}
	if a > (l/2) {fmt.Println(l)} else {fmt.Println(l-(l-a-a+1))}
}


package main

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

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

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

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

	if lenA > lenS/2 {
		return lenS
	}

	return lenS - (lenS - 2*lenA + 1)
}


package main

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

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

func l(x uint64) int {
	cnt := 0
	for x != 0 {
		x /= 10
		cnt++
	}
	return cnt
}

func main() {
	defer w.Flush()
	var n int
	var x uint64
	fmt.Fscan(r, &n, &x)
	if l(x) > n {
		fmt.Fprintln(w, "-1")
		return
	} else if l(x) == n {
		fmt.Fprintln(w, "0")
		return
	}
	var dfs func(x uint64, used int) int
	ans := 100
	reme := make(map[uint64]int)
	dfs = func(x uint64, used int) int {
		cnt := 0
		hash := map[int]bool{}
		y := x
		for x != 0 {
			hash[int(x%10)] = true
			x /= 10
			cnt++
		}
		ret := 100
		if cnt >= n {
			ret = 0
		} else {
			for k := range hash {
				if k == 0 || k == 1 {
					continue
				}
				next := uint64(k)*y
				if u, ok := reme[next]; ok {
					ret = min(ret, u)
				} else {
					ret = min(ret, dfs(next, used+1))
				}
			}
			ret++
		}
		reme[y] = ret
		ans = min(ans, used + ret)
		return ret
	}
	dfs(uint64(x), 0)
	if ans == 100 {
		fmt.Fprintln(w, -1)
		return
	}
	fmt.Fprintln(w, ans)
}

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


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1681D(in io.Reader, out io.Writer) {
	var n, ans int
	q := []int64{0}
	Fscan(in, &n, &q[0])
	for ; len(q) > 0; ans++ {
		tmp := q
		q = nil
		inq := map[int64]bool{}
		for _, v := range tmp {
			cnt := 0
			for x := v; x > 0; x /= 10 {
				cnt++
				d := x % 10
				if d > 1 && !inq[v*d] {
					inq[v*d] = true
					q = append(q, v*d)
				}
			}
			if cnt == n {
				Fprint(out, ans)
				return
			}
		}
	}
	Fprint(out, -1)
}

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


package main

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

var ans int

type pair struct{ x, y int64 }

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

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

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

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

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

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

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

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

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

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

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

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


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1681D(in io.Reader, out io.Writer) {
	var n, ans int
	var x int64
	Fscan(in, &n, &x)
	q := []int64{x}
	for ; len(q) > 0; ans++ {
		tmp := q
		q = nil
		for _, v := range tmp {
			cnt := 0
			for x := v; x > 0; x /= 10 {
				cnt++
				d := x % 10
				if d > 1 {
					q = append(q, v*d)
				}
			}
			if cnt == n {
				Fprint(out, ans)
				return
			}
		}
		sort.Slice(q, func(i, j int) bool { return q[i] > q[j] })
		if len(q) > 10000 {
			q = q[:10000]
		}
	}
	Fprint(out, -1)
}

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


package main

import (
	"bufio"
	"container/heap"
	"container/list"
	. "fmt"
	"math"
	"os"
)

type Int int64

const (
	INF = 3e5 + 10
	L0  = Int(0)
	L1  = Int(1)
)

func lengthOf(x Int) int {
	res := 0

	for x > 0 {
		res++
		x /= 10
	}
	return res
}

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

	var n int
	var x Int

	Fscan(in, &n, &x)

	ma := make(map[Int]int)

	queue := list.New()

	queue.PushBack(x)

	find := false
	for queue.Len() > 0 && !find {

		nq := list.New()

		for it := queue.Front(); it != nil && !find; it = it.Next() {
			cur := it.Value.(Int)

			cnt := ma[cur]

			tmp := cur
			for tmp > 0 {
				mo := tmp % 10
				tmp /= 10
				if mo < 2 {

					continue
				}
				nCur := cur * mo
				if ma[nCur] == 0 {
					cLen := lengthOf(nCur)
					if cLen < n {
						nq.PushBack(cur * mo)
						ma[nCur] = cnt + 1
					} else {
						Fprintln(out, cnt+1)
						find = true
						break
					}
				}
			}

		}
		queue = nq
	}
	if !find {
		Fprintln(out, -1)
	}

}

func MakeGrid(h, w int) [][]Int {
	index := make([][]Int, h)
	data := make([]Int, h*w)
	for i := 0; i < h; i++ {
		index[i] = data[i*w : (i+1)*w]
	}
	return index
}

func Abs(x Int) Int {
	if x > 0 {
		return x
	}
	return -x
}

func Min(nums ...Int) Int {
	return nums[MinIdx(nums...)]
}

func MinIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num < nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

func Max(nums ...Int) Int {
	return nums[MaxIdx(nums...)]
}

func MaxIdx(nums ...Int) Int {
	maxNumIdx := L0
	for i, num := range nums {
		if num > nums[maxNumIdx] {
			maxNumIdx = Int(i)
		}
	}
	return maxNumIdx
}

var (
	mod  Int
	fmod func(Int) Int = doNothing
)

// SetMod sets the mod. It must be called first.
func SetMod(newMod Int) {
	mod = newMod
	fmod = dynamicMod
}

func dynamicMod(m Int) Int {
	m %= mod
	if m < 0 {
		return m + mod
	}
	return m
}

func doNothing(m Int) Int {
	return m
}

// Mod returns m % mod.
func (m Int) Mod() Int {
	return fmod(m)
}

// Inv returns modular multiplicative inverse
func (m Int) Inv() Int {
	return m.Pow(Int(0).Sub(2))
}

// Pow returns m^n
func (m Int) Pow(n Int) Int {
	p := Int(1)
	for n > 0 {
		if n&1 == 1 {
			p.MulAs(m)
		}
		m.MulAs(m)
		n >>= 1
	}
	return p
}

// Add returns m+x
func (m Int) Add(x Int) Int {
	return (m + x).Mod()
}

// Sub returns m-x
func (m Int) Sub(x Int) Int {
	return (m - x).Mod()
}

// Mul returns m*x
func (m Int) Mul(x Int) Int {
	return (m * x).Mod()
}

// Div returns m/x
func (m Int) Div(x Int) Int {
	return m.Mul(x.Inv())
}

// AddAs assigns *m + x to *m and returns m
func (m *Int) AddAs(x Int) *Int {
	*m = m.Add(x)
	return m
}

// SubAs assigns *m - x to *m and returns m
func (m *Int) SubAs(x Int) *Int {
	*m = m.Sub(x)
	return m
}

// MulAs assigns *m * x to *m and returns m
func (m *Int) MulAs(x Int) *Int {
	*m = m.Mul(x)
	return m
}

// DivAs assigns *m / x to *m and returns m
func (m *Int) DivAs(x Int) *Int {
	*m = m.Div(x)
	return m
}

func (m *Int) MaxAs(x ...Int) *Int {
	*m = Max(append(x, *m)...)
	return m
}

func (m *Int) MinAs(x ...Int) *Int {
	*m = Min(append(x, *m)...)
	return m
}

type Void struct{}

var void Void

type HashSet struct {
	ma map[Int]Void
}

func NewHashSet() *HashSet {
	return &HashSet{
		ma: make(map[Int]Void),
	}
}

func (s *HashSet) add(x Int) bool {
	_, exists := s.ma[x]
	if !exists {
		s.ma[x] = void
		return true
	} else {
		return false
	}
}

func (s *HashSet) del(x Int) {
	delete(s.ma, x)
}

func (s *HashSet) exist(x Int) bool {
	_, exists := s.ma[x]
	return exists
}

// An Item is something we manage in a priority queue.
type Item struct {
	value    Int // The value of the item; arbitrary.
	priority Int // The priority of the item in the queue.
	indices  Int
	// The index is needed by update and is maintained by the heap.Interface methods.
	index int // The index of the item in the heap.
}

// A PriorityQueue implements heap.Interface and holds Items.
type PriorityQueue []*Item

func NewItem(value, priority Int) *Item {
	return &Item{
		value:    value,
		priority: priority,
		index:    -1,
	}

}

func (pq PriorityQueue) Len() int { return len(pq) }

func (pq PriorityQueue) Less(i, j int) bool {
	// We want Pop to give us the highest, not lowest, priority so we use greater than here.
	return pq[i].priority < pq[j].priority
}

func (pq PriorityQueue) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PriorityQueue) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PriorityQueue) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

// update modifies the priority and value of an Item in the queue.
func (pq *PriorityQueue) update(item *Item, value Int, priority Int) {
	item.value = value
	item.priority = priority
	heap.Fix(pq, item.index)
}

type SegTree struct {
	st []Segment
}

type Segment struct {
	l, r, val, add, minIndex Int
}

func newSegTree(n Int) SegTree {
	segTree := SegTree{make([]Segment, n<<2)}
	segTree.Build(1, 1, n)
	return segTree
}

func (segTree SegTree) Build(x, l, r Int) {
	segTree.st[x].l = l
	segTree.st[x].r = r
	if l == r {
		segTree.st[x].minIndex = l
		return
	}
	mid := (l + r) >> 1
	segTree.Build(x<<1, l, mid)
	segTree.Build(x<<1|1, mid+1, r)
}

func (segTree SegTree) push(x Int) {
	if segTree.st[x].add != 0 {
		segTree.modifyOne(x<<1, segTree.st[x].add)
		segTree.modifyOne(x<<1|1, segTree.st[x].add)
		segTree.st[x].add = 0
	}
}

func (segTree SegTree) update(x Int) {
	if segTree.st[x<<1].val < segTree.st[x<<1|1].val {
		segTree.st[x].val = segTree.st[x<<1].val
		segTree.st[x].minIndex = segTree.st[x<<1].minIndex
	} else {
		segTree.st[x].val = segTree.st[x<<1|1].val
		segTree.st[x].minIndex = segTree.st[x<<1|1].minIndex
	}
}

func (segTree SegTree) modifyOne(x, add Int) {
	segTree.st[x].val += add
	if segTree.st[x].l != segTree.st[x].r {
		segTree.st[x].add += add
	}
}

func (segTree SegTree) Modify(x, l, r, add Int) {
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		segTree.modifyOne(x, add)
		return
	}
	segTree.push(x)
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		segTree.Modify(x<<1, l, r, add)
	}
	if mid < r {
		segTree.Modify(x<<1|1, l, r, add)
	}
	segTree.update(x)
}

func updateRes(cRes, cIndex, res, index Int) (Int, Int) {
	if cRes > res {
		return res, index
	}
	return cRes, cIndex
}

func (segTree SegTree) Query(x, l, r Int) (Int, Int) {
	res := Int(math.MaxInt64)
	resInd := -L1
	if segTree.st[x].l >= l && segTree.st[x].r <= r {
		res, resInd = updateRes(res, resInd, segTree.st[x].val, segTree.st[x].minIndex)
		return res, resInd
	}
	mid := (segTree.st[x].l + segTree.st[x].r) >> 1
	if mid >= l {
		sonRes, sonInd := segTree.Query(x<<1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	if mid < r {
		sonRes, sonInd := segTree.Query(x<<1|1, l, r)
		res, resInd = updateRes(res, resInd, sonRes, sonInd)
	}
	return res, resInd
}

type Graph struct {
	nodeSize Int
	edges    []Edge
	head     []Int
	dis      []Int
	vis      []bool
	nCnt     Int
	ans      []Int
}

type Edge struct {
	u, v, c, indices, next Int
}

func NewGraph(nodeSize Int) *Graph {
	return &Graph{
		nodeSize: nodeSize,
		edges:    make([]Edge, (2e5+10)<<2),
		head:     make([]Int, nodeSize+100),
		dis:      make([]Int, nodeSize+100),
		vis:      make([]bool, nodeSize+100),
		nCnt:     L1,
		ans:      make([]Int, nodeSize),
	}
}

func (g *Graph) addEdge(u Int, v Int, cost Int, indices Int) {
	g.nCnt++
	g.edges[g.nCnt] = Edge{u, v, cost, indices, g.head[u]}
	g.head[u] = g.nCnt
}

func (g *Graph) Dijkstra(begin Int) {
	for i := L1; i <= g.nodeSize; i++ {
		g.dis[i] = math.MaxInt64
	}
	pq := make(PriorityQueue, 0)
	heap.Init(&pq)

	g.dis[begin] = 0
	heap.Push(&pq, &Item{begin, 0, -1, -1})

	id := L0

	for len(pq) > 0 {
		it := heap.Pop(&pq).(*Item)
		u := it.value
		if g.vis[u] {
			continue
		}
		g.vis[u] = true

		if it.indices != -1 && id < g.nodeSize-1 {
			g.ans[id] = it.indices
			id++
		}

		for i := g.head[u]; i != 0; i = g.edges[i].next {
			v := g.edges[i].v
			if g.dis[v] > g.dis[u]+g.edges[i].c {
				g.dis[v] = g.dis[u] + g.edges[i].c

				heap.Push(&pq, &Item{v, g.dis[v], g.edges[i].indices, -1})
			}
		}
	}
}


package main

import (
	"fmt"
)

var output map[int]string = map[int]string{
	0: "O-|-OOOO",
	1: "O-|O-OOO",
	2: "O-|OO-OO",
	3: "O-|OOO-O",
	4: "O-|OOOO-",
	5: "-O|-OOOO",
	6: "-O|O-OOO",
	7: "-O|OO-OO",
	8: "-O|OOO-O",
	9: "-O|OOOO-",
}

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

	switch n {
	case 0:
		fmt.Println(output[0])
	default:
		for n > 0 {
			fmt.Println(output[n%10])
			n /= 10
		}
	}
}


// 363A-mic
package main

import (
    "fmt"
)

func main() {
    var str string
    fmt.Scan(&str)
    var i int64
    for i = int64(len(str) - 1); i >= 0; i-- {
        switch str[i] {
        case '0':
            fmt.Printf("O-|-OOOO\n")
        case '1':
            fmt.Printf("O-|O-OOO\n")
        case '2':
            fmt.Printf("O-|OO-OO\n")
        case '3':
            fmt.Printf("O-|OOO-O\n")
        case '4':
            fmt.Printf("O-|OOOO-\n")
        case '5':
            fmt.Printf("-O|-OOOO\n")
        case '6':
            fmt.Printf("-O|O-OOO\n")
        case '7':
            fmt.Printf("-O|OO-OO\n")
        case '8':
            fmt.Printf("-O|OOO-O\n")
        case '9':
            fmt.Printf("-O|OOOO-\n")
        }
    }
}


package main

import (
  "fmt"
)

func main() {

  var high = [2]string{"O-|", "-O|"}
  var low  = [5]string{"-OOOO", "O-OOO", "OO-OO", "OOO-O", "OOOO-"}
  var num int
  fmt.Scan(&num)
  if num == 0 {
    fmt.Printf(high[0] + low[0])
  } else {
    for num != 0 {
      var div int = num % 10
      fmt.Printf("%s%s\n", high[div / 5], low[div % 5])
      num /= 10
    }
  }
}


package main

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

func GetScanner() func(a ...*int) {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)

    ScanInts := func(a ...*int) {
        for i := 0; i < len(a); i++ {
            scanner.Scan()
            *(a[i]), _ = strconv.Atoi(scanner.Text())
        }
    }
    return ScanInts
}

func main() {
    scan := GetScanner()
    var n int
    var arr [10][10]int

    for i := 0; i < 10; i++ {
        arr[0][i] = 1
        arr[i][0] = 1
    }
    for i := 1; i < 10; i++ {
        for j := 1; j < 10; j++ {
            arr[i][j] = arr[i-1][j] + arr[i][j-1]
        }
    }
    ans := 1
    scan(&n)
    for i := 0; i < n; i++ {
        for j := 0; j < n; j++ {
            if arr[i][j] > ans {
                ans = arr[i][j]
            }
        }
    }
    fmt.Println(ans)
}


package main

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

var scanner *bufio.Scanner

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

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

  n := getI()-1
  m := 2*n
  result := 1
  for i := m; i != n; i-- {
    result *= i
    result /= m+1-i
  }
  writer.WriteString(fmt.Sprintf("%d\n", result))
}


package main

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

func f(n int64) int64 {
	return (n - 1) * n / 2
}

func min_pairs(n, m int64) int64 {
	q := n / m
	mod := n % m
	return f(q)*(m-mod) + f(q+1)*mod
}

func max_pairs(n, m int64) int64 {
	return f(n - (m - 1))
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var n, m int64
	fmt.Fscanf(reader, "%d %d", &n, &m)
	fmt.Fprintf(writer, "%d %d\n", min_pairs(n, m), max_pairs(n, m))
}


package main

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

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

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

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

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

func main() {
    defer writer.Flush()
    scanner.Split(bufio.ScanWords)
    n := ReadInt64()
    m := ReadInt64()
    free := n - m

    max := (free + 1) * free / 2
    x := n / m
    y := n % m

    min := y*(x+1)*x/2 + (m-y)*x*(x-1)/2
    writer.WriteString(strconv.FormatInt(min, 10) + " " + strconv.FormatInt(max, 10) + "\n")
}


package main

import (
	"fmt"
)

func pair(x int64) int64 {
	return x * (x - 1) / 2
}

func main() {
	var n, m, min, max int64
	fmt.Scan(&n, &m)
	max = pair(n - m + 1)
	min = pair(n/m+1)*(n%m) + pair(n/m)*(m-n%m)
	fmt.Println(min, max)
}


package main

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

var (
	A = 1
	B = 3
	C = 2
	D = 0
)
func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	text := scanner.Text()
	num, _ := strconv.Atoi(text)
	switch num % 4 {
	case A:
		fmt.Println("0 A")
	case B:
		fmt.Println("2 A")
	case C:
		fmt.Println("1 B")
	case D:
		fmt.Println("1 A")
	default:
		fmt.Println("0 A")
	}
}


package main

import "fmt"

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

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

func main(){
	var n int
	fmt.Scanln(&n)
	switch n%4{
	case 1:
		fmt.Println("0 A")
	case 2:
		fmt.Println("1 B")
	case 3:
		fmt.Println("2 A")
	case 0:
		fmt.Println("1 A")
	}
}


 package main

 import (
 	"fmt"
 	"math"
 )

 func main() {
 	var x,y,z,t float64
 	fmt.Scan(&x,&y,&z)
 	t= math.Sqrt(x*y*z)
 	t= t/x+t/y+t/z
 	t*=4
 		fmt.Println(t)
 }


package main

import (
    "fmt"
    "math"
)

func main() {
    var a,b,c int
    fmt.Scan(&a,&b,&c)
    y := int(math.Sqrt(float64((a*c)/b)))
    x := (y*b)/c
    z := b/x
    fmt.Println(4*(x+y+z))
}


package main

import (
	"fmt"
	"math"
)

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

	a := math.Sqrt(float64(x * z / y))
	b := math.Sqrt(float64(x * y / z))
	c := math.Sqrt(float64(y * z / x))

	fmt.Println(4 * int32(a+b+c))
}


package main

import (
    "fmt"
    "math"
)

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

    ok := func(t int) bool {
        d := t*b
        for i := 0; i < c; i++ {
            d += b
            if d < a { return false }
            d -= a
        }
        return true
    }

    l, r := 0, int(math.Ceil(float64(a*c)/float64(b)))
    for l != r {
        m := (l+r)/2
        if ok(m) {
            r = m
        } else {
            l = m+1
        }
    }
    fmt.Println(r)
}


package main

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

func main() {
	var scanner = bufio.NewScanner(os.Stdin)
	var dataPerSec int
	var downloadPerSec int
	var videoLengthInSec int

	dataPerSec, downloadPerSec, videoLengthInSec = takeInput(scanner)
	totalDownloadTime := calcTotalDownloadTime(
		calcTotalData(dataPerSec, videoLengthInSec),
		downloadPerSec)
	fmt.Println(int(totalDownloadTime) - videoLengthInSec)
}

func takeInput(scanner *bufio.Scanner) (int, int, int) {
	var inputParameters []int

	scanner.Scan()
	input := strings.Split(scanner.Text(), " ")
	for _, param := range input {
		convertedParam, _ := strconv.Atoi(param)
		inputParameters = append(inputParameters, convertedParam)
	}
	return inputParameters[0], inputParameters[1], inputParameters[2]
}

func calcTotalData(dataPerSec int, videoLength int) int {
	return videoLength * dataPerSec
}

func calcTotalDownloadTime(totalData int, downloadPerSec int) float64 {
	return math.Ceil(float64(totalData) / float64(downloadPerSec))
}


// 195A-mic
package main

import (
	"fmt"
)

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

	for i := 1; ; i++ {
		p := true
		sum := i * b
		for j := 0; j < c; j++ {
			sum += b
			sum -= a

			if sum < 0 {
				p = false
				break
			}
		}

		if p {
			fmt.Println(i)
			return
		}
	}

}


package main

import (
	. "fmt"
	"io"
	"math/big"
	"os"
)

// github.com/EndlessCheng/codeforces-go
func run(_r io.Reader, _w io.Writer) {
	p := func(n int) bool { return big.NewInt(int64(n)).ProbablyPrime(0) }
	var n int
	if Fscan(_r, &n); p(n) {
		Fprint(_w, 1)
	} else if n%2 == 0 || p(n-2) {
		Fprint(_w, 2)
	} else {
		Fprint(_w, 3)
	}
}

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


package main

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

func isPrime(n int) bool {
    sq := int(math.Sqrt(float64(n))+3)
    for i := 2; i < sq && i < n; i++ {
        if n%i == 0 {
            return false
        }
    }
    return true
}

func tax(n int) int {
    if isPrime(n) {
        return 1
    } else if isPrime(n-2) || n%2 == 0 {
        return 2
    }
    return 3
}

func solve() {
    n := readInt()
    fmt.Println(tax(n))
}

// Helpers

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

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

// Math

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

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

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

// IO

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

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

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

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

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

// Sort

type Ints64 []int64

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

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


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

package main

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

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

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

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

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

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

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

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

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

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

var (
	n int64
)

func main() {
	n = ReadInt64()

	if IsPrime(n) {
		fmt.Println(1)
		return
	}

	if n%2 == 0 {
		fmt.Println(2)
		return
	}

	if IsPrime(n - 2) {
		fmt.Println(2)
		return
	}

	fmt.Println(3)
}

// func main() {
// 	n = readInt64()

// 	// ans := 0
// 	A := []int64{}
// 	for {
// 		// ans++
// 		if IsPrime(n) {
// 			A = append(A, n)
// 			break
// 		}

// 		p := sub(n - 2)
// 		n -= p
// 		A = append(A, p)
// 	}
// 	// fmt.Println(ans)
// 	fmt.Println(len(A))
// }

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

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

	if n == 1 {
		return false
	}

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

	return true
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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


package main

import "fmt"

func main() {

	var n int
	fmt.Scan(&n)
	var cnt [3]int
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		cnt[i%3] += x
	}
	if cnt[0] > cnt[1] && cnt[0] > cnt[2] {
		fmt.Println("chest")
	} else if cnt[1] > cnt[0] && cnt[1] > cnt[2] {
		fmt.Println("biceps")
	} else {
		fmt.Println("back")
	}
}


package main

import "fmt"

func main() {
    var n,a,ans int
    var cnt [3]int
    fmt.Scan(&n)
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        cnt[i%3] += a
        if cnt[ans] < cnt[i%3] { ans = i%3 }
    }
    if ans == 0 {
        fmt.Println("chest")
    } else if ans == 1 {
        fmt.Println("biceps")
    } else {
        fmt.Println("back")
    }
}


// cf255a project main.go
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	z := make([]int, 3)
	for i := 0; i < n; i++ {
		var r int
		fmt.Scan(&r)
		z[i%3] += r
	}
	if z[0] >= z[1] && z[0] >= z[2] {
		fmt.Println("chest")
	} else if z[1] >= z[0] && z[1] >= z[2] {
		fmt.Println("biceps")
	} else {
		fmt.Println("back")
	}
}


package main

import "fmt"

func main() {
	s := ""
	fmt.Scanln(&s)
	w := []rune{'h', 'e', 'l', 'l', 'o'}
	lenw := len(w)
	next := 0
	for _, c := range s {
		if next >= lenw {
			break
		}
		if c == w[next] {
			next++
		}
	}
	if next >= lenw {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}


package main

import (
	"fmt"
	"strings"
)

func find(wanted, word string) bool {
	var first string
	for len(wanted) > 0 && len(word) > 0 {
		first, wanted = string(wanted[0]), wanted[1:]
		index := strings.Index(word, first)
		if index == -1 {
			return false
		}
		word = word[index+1:]
	}
	return len(wanted) == 0
}

func main() {
	var word string

	wanted := "hello"

	fmt.Scan(&word)
	if find(wanted, word) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


package main

import (
	"fmt"
	"regexp"
)

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

	var hello = regexp.MustCompile(`h.*e.*l.*l.*o`)

	if hello.MatchString(s) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


package main
import (
	"fmt"
	"sort"
)

func main() {
	var n,m,d int
	fmt.Scan(&n,&m)
	num := make([]int,m)

	for  i:=0;i<m;i++{
		fmt.Scan(&num[i])
	}
	sort.Ints(num)
	output:=10001
	for k:=0; k<=(m-n);k++ {
	z:= k+n-1
	d = num[z]-num[k]
	if d < output {
		output=d
	}
	}
	fmt.Println(output)
}


package main

import (
    "fmt"
    "sort"
    )

func main() {
    var n, m int
    var f[50] int

    fmt.Scanf("%d%d\n", &n, &m)
    for i := 0; i < m; i++ {
        //if i != m-1 {
        fmt.Scanf("%d", &f[i])
        //} else {
            //fmt.Scanf("%d\n", &f[i])
        //}
    }

    sort.Ints(f[:m])
    result := 1000
    for i := 0; i <= m-n; i++ {
        if result > f[i+n-1] - f[i] {
            result = f[i+n-1] - f[i]
        }
    }

    fmt.Println(result)
}


// 337A-mic
package main

import (
    "fmt"
    "sort"
)

func main() {
    var n, m, dif, min int
    fmt.Scan(&n, &m)
    a := make([]int, m)
    for i := range a {
        fmt.Scan(&a[i])
    }
    sort.Sort(sort.IntSlice(a))
    //fmt.Println(a)
    min = a[m-1] - a[0]
    //fmt.Println(min)
    for b := 0; b <= m-n; b++ {
        dif = a[b+n-1] - a[b]
        if dif < min {
            min = dif
        }
    }
    fmt.Println(min)
}


package main

import(
    "fmt"
)

type i64 int64

func main(){
    var(
        n i64
    )
    fmt.Scan(&n)
    if n%2==0{
        fmt.Println(n/2)
    }else{
        fmt.Println(-1*(n+1)/2)
    }
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var n float64

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

	fmt.Printf("%.0f\n", math.Pow(-1, n)*(math.Ceil(n/2)))
}


package main

import (
	"fmt"
)

func main() {
	var n int64
	fmt.Scanf("%d\n", &n)
	if n&1 == 0 {
		fmt.Println(n >> 1)
	}else{
		fmt.Println(-(n + 1) >> 1)
	}

}


package main

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

func solve() {
	n := readInt64()
	m := readInt64()
	if m == 0 {
		fmt.Println(n, n)
		return
	}
	maxAns := int64(0)
	for i := int64(2); i < 1000000; i++ {
		t := i * (i - 1) / 2
		if t >= m {
			maxAns = n - i
			break
		}
	}
	if 2 * m < n {
		fmt.Println(n - (2 * m), maxAns)
	} else {
		fmt.Println(0, maxAns)
	}
}

var scanner *bufio.Scanner

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

// IO

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

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

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


package main

import (
	"fmt"
	"math"
)

func main() {
	var m, n int64
	fmt.Scan(&n, &m)
	min := math.Max(float64(n-2*m), 0.0)

	connectedCount := int64(0)
	usedEdges := int64(0)
	for i := int64(1); i < n; i++ {
		if usedEdges >= m {
			break
		}
		usedEdges += i
		// The first edge connects two vertices, otherwise, every new vertex can use i edges.
		if connectedCount == 0 {
			connectedCount = 2
		} else {
			connectedCount++
		}
	}
	fmt.Println(min, n-connectedCount)
}


// Codeforces 1065 B Vasya and Isolated Vertices
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 int
var m int64
var minV,maxV int

// custom read with int64
func readNM() {
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	n, err = strconv.Atoi(ss[0])
	if err != nil {
		fmt.Println("n atoi failure", err)
		panic(err)
	}
	m, err = strconv.ParseInt(ss[1], 10, 64)
	if err != nil {
		fmt.Println("m ParseInt failure", err)
		panic(err)
	}
}

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n, m
	readNM()
}

func solve() {
	// min izolated - when all connected in one line
	if (m*2 >= int64(n)) {
		minV = 0
	} else {
		minV = int(int64(n) - 2*m)
	}
	// max izo - when part is fully connected
	n6 := int64(0)
	for ; n6 <= int64(n); n6++ {
		ee := n6*(n6-1)/2
		if m == ee {
			maxV = n - int(n6)
			break
		} else if m > ee {
			maxV = n - (int(n6) + 1)
		} else {
			break
		}
	}
}

func printRes() {
	fmt.Printf("%v %v\n", minV, maxV)
}

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


package main

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

func solve() {
	s := readString()

	res := 0
	for i := 0; i < len(s)-2; i++ {
		if s[i] == 'Q' {
			for j := i + 1; j < len(s)-1; j++ {
				if s[j] == 'A' {
					for k := j + 1; k < len(s); k++ {
						if s[k] == 'Q' {
							res++
						}
					}
				}
			}
		}
	}
	fmt.Println(res)
}

var scanner *bufio.Scanner

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

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

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

// IO

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

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

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

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

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


package main

import "fmt"

func main() {
	var S string
	fmt.Scan(&S)
	n := len(S)
	ans := 0
	for i := 0; i < n; i++ {
		if S[i] == 'Q' {
			for j := i + 1; j < n; j++ {
				if S[j] == 'A' {
					for k := j + 1; k < n; k++ {
						if S[k] == 'Q' {
							ans++
						}
					}
				}
			}
		}
	}
	fmt.Println(ans)
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	str, _ := reader.ReadString('\n')
	var a, b, c [200]int64
	var l = len([]rune(str))
	for i := l - 1; i >= 0; i-- {
		a[i] = a[i+1]
		if str[i] == 'Q' {
			a[i] += 1
		}
	}

	for i := l - 1; i >= 0; i-- {
		b[i] = b[i+1]
		if str[i] == 'A' {
			b[i] += a[i]
		}
	}
	var last = l
	for i := l - 1; i >= 0; i-- {
		c[i] = c[i+1]
		if str[i] == 'Q' {
			c[i] += b[i]
			last = i
		}
	}

	fmt.Print(c[last], "\n")

}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var (
		n, d, m int
		prs     []int
	)
	fmt.Scan(&n, &d)
	for i := 0; i < n; i++ {
		var pr int
		fmt.Scan(&pr)

		prs = append(prs, pr)
	}
	fmt.Scan(&m)
	var cnt int
	if m > n {
		cnt -= (m - n) * d
	}
	sort.Ints(prs)
	for i := 0; i < m; i++ {
		cnt += prs[i]
		if i+1 == n {
			break
		}
	}

	fmt.Print(cnt)
}


package main

import (
    "fmt"
    "sort"
)

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


package main

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

func findAnswer(n int) int {
	if n == 2 {return 2} else {return 1}
}

func main() {
	z := bufio.NewScanner(os.Stdin)
	z.Split(bufio.ScanWords)
	z.Scan()
	m, _ :=strconv.Atoi(z.Text())
	fmt.Println(findAnswer(m))
}


package main

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

func main() {
	r := bufio.NewReaderSize(os.Stdin, 100*1024*1024)
	num := readInt(r)

	if num > 2 {
		fmt.Print(1)
	} else {
		fmt.Print(num)
	}
}

func readInt(reader *bufio.Reader) int {
	tmpInt, err := strconv.ParseInt(readLine(reader), 10, 64)
	checkError(err)
	return int(tmpInt)
}

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

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

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


package main

import "fmt"

func main() {
	var input int
	fmt.Scanf("%d", &input)
	if input == 2 {
		fmt.Println("2")
		return
	}
	fmt.Println("1")
}


package main

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

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

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

func main() {
	defer writer.Flush()
	var n, m int64

	scanf("%d %d", &n, &m)

	if m == 1 {
		fmt.Println(n * n)
		return
	}

	mp := make(map[int64]int64)

	r := n / m
	c := n % m

	for i := int64(1); i <= m; i++ {
		mp[(i*i)%m] += r
	}

	for i := int64(1); i <= c; i++ {
		mp[(i*i)%m]++
	}
	ans := int64(0)
	for k, v := range mp {
		if k == 0 {
			ans += v * v
		} else {
			ans += v * mp[m-k]
		}

	}

	//ans += mp[int64(0)]

	fmt.Println(ans)

}


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

package main

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

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

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

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

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

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

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

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

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

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

var (
	n, m int

	M, MM [1000 + 50]int
)

func main() {
	n, m = ReadInt2()

	q := n / m
	for i := 0; i < m; i++ {
		M[i] = q
	}
	for i := 1; i <= n%m; i++ {
		M[i]++
	}

	for i := 0; i < m; i++ {
		to := (i * i) % m
		MM[to] += M[i]
	}

	ans := int64(0)
	ans += int64(MM[0]) * int64(MM[0])
	for i := 1; i < m; i++ {
		ans += int64(MM[i]) * int64(MM[m-i])
	}
	fmt.Println(ans)
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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


package main

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

var reader *bufio.Reader = bufio.NewReader(os.Stdin)

func main() {
    var n, m uint64
    fmt.Fscan(reader, &n)
    fmt.Fscan(reader, &m)
    var i, j, lim, nrow, ncolumn, total uint64
    if n<m { lim=n } else { lim=m }
    for i=1;i<=lim;i++ {
        for j=1;j<=lim;j++ {
            if (i*i+j*j)%m == 0 {
                nrow = (n-j)/m
                ncolumn = (n-i)/m
                total+= (1 + ncolumn)*(1 + nrow)
            }
        }
    }
    fmt.Println(total)
}


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 nextInt32() int32 {
	v, _ := strconv.ParseInt(nextToken(), 10, 32)
	return int32(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 [1000][1000]int

func main() {
	n = nextInt32()
	s = nextToken()
	x, y := 500, 500
	a[x][y] = 1
	ans := int(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"
	"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 int
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 "fmt"

func zero(s string) bool {
	x := 0
	y := 0
	for _, r := range s {
		switch r {
		case 'U':
			y++
		case 'D':
			y--
		case 'R':
			x++
		case 'L':
			x--
		default:
			panic(r)
		}
	}
	return x == 0 && y == 0
}

func main() {
	var n int
	fmt.Scan(&n)
	var s string
	fmt.Scan(&s)
	res := 0
	for i := 0; i < n; i++ {
		for j := i + 1; j <= n; j++ {
			if zero(s[i:j]) {
				res++
			}
		}
	}
	fmt.Println(res)
}


package main

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

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

	var n int
	Fscan(in, &n)

	ans := int64(0)
	cnts := [9]int64{}
	for i := 1; i <= n; i++ {
		cnts[i%9]++
		ans -= int64(n / i)
	}
	for i := 0; i < 9; i++ {
		for j := 0; j < 9; j++ {
			ans += cnts[i] * cnts[j] * cnts[i*j%9]
		}
	}
	Fprint(out, ans)
}

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


package main

import "fmt"

func main() {
    var n, ans int64
    var a [10]int64
    fmt.Scan(&n)

    for i := 0; i < 9; i++ {
        a[i] = n / 9
        if i != 0 && n % 9 >= int64(i) {
            a[i] += 1
        }
    }

    for i := 0; i < 9; i++ {
        for j := 0; j < 9; j++ {
            ans += a[i] * a[j] * a[i * j % 9]
        }
    }

    for i := 1; int64(i) <= n; i++ {
        ans -= n / int64(i)
    }
    fmt.Println(ans)

    return
}


package main
import (
	"fmt"
)
func main() {
	var n,d,t int
	a:=0
	fmt.Scan(&n,&d)
	for i:=1;i<=n;i++ {
		fmt.Scan(&t)
		a+=t
	}
	a+=(n-1)*10
	if a>d {
		fmt.Println("-1")
	} else {
		a=d-a
		a=n*2 -2+a/5
		fmt.Println(a)
	}
}


package main

import (
	"fmt"
)

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

	var ti int
	fmt.Scan(&ti)

	ans := 0
	sum := ti
	for i := 1; i < n; i++ {
		fmt.Scan(&ti)
		sum += (10 + ti)

		if sum > d {
			ans = -1
			break
		}
		ans += 2
	}
	if ans == -1 || sum > d {
		fmt.Println(-1)
	} else {
		ans += ((d - sum) / 5)
		fmt.Println(ans)
	}
}


package main

import "fmt"

func main() {
	var n, d, v, jokes int
	fmt.Scan(&n, &d)

	cost := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&v)
		cost += v
	}

	cost += (n - 1) * 10
	jokes = (n - 1) * 2
	delta := d - cost
	if delta < 0 {
		fmt.Println(-1)
		return
	}
	jokes += delta / 5

	fmt.Println(jokes)
}


package main

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

/*********** DP sub-functions ***********/

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

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

// NthBit returns nth bit value of an argument.
// n starts from 0.
func NthBit(num, nth int) int {
	return num >> uint(nth) & 1
}

// OnBit returns the integer that has nth ON bit.
// If an argument has nth ON bit, OnBit returns the argument.
func OnBit(num, nth int) int {
	return num | (1 << uint(nth))
}

// OffBit returns the integer that has nth OFF bit.
// If an argument has nth OFF bit, OffBit returns the argument.
func OffBit(num, nth int) int {
	return num & ^(1 << uint(nth))
}

// PopCount returns the number of ON bit of an argument.
func PopCount(num int) int {
	res := 0

	for i := 0; i < 70; i++ {
		if ((num >> uint(i)) & 1) == 1 {
			res++
		}
	}

	return res
}

/*********** Arithmetic ***********/

// Max returns the max integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Max(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m < integer {
			m = integer
		}
	}
	return m
}

// Min returns the min integer among input set.
// This function needs at least 1 argument (no argument causes panic).
func Min(integers ...int) int {
	m := integers[0]
	for i, integer := range integers {
		if i == 0 {
			continue
		}
		if m > integer {
			m = integer
		}
	}
	return m
}

// Sum returns multiple integers sum.
func Sum(integers ...int) int {
	s := 0

	for _, i := range integers {
		s += i
	}

	return s
}

// PowInt is integer version of math.Pow
// PowInt calculate a power by Binary Power (二分累乗法(O(log e))).
func PowInt(a, e int) int {
	if a < 0 || e < 0 {
		panic(errors.New("[argument error]: PowInt does not accept negative integers"))
	}

	if e == 0 {
		return 1
	}

	if e%2 == 0 {
		halfE := e / 2
		half := PowInt(a, halfE)
		return half * half
	}

	return a * PowInt(a, e-1)
}

// AbsInt is integer version of math.Abs
func AbsInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// Gcd returns the Greatest Common Divisor of two natural numbers.
// Gcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Gcd uses the Euclidean Algorithm.
func Gcd(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}
	if a < b {
		a, b = b, a
	}

	// Euclidean Algorithm
	for b > 0 {
		div := a % b
		a, b = b, div
	}

	return a
}

// Lcm returns the Least Common Multiple of two natural numbers.
// Lcd only accepts two natural numbers (a, b >= 1).
// 0 or negative number causes panic.
// Lcd uses the Euclidean Algorithm indirectly.
func Lcm(a, b int) int {
	if a <= 0 || b <= 0 {
		panic(errors.New("[argument error]: Gcd only accepts two NATURAL numbers"))
	}

	// a = a'*gcd, b = b'*gcd, a*b = a'*b'*gcd^2
	// a' and b' are relatively prime numbers
	// gcd consists of prime numbers, that are included in a and b
	gcd := Gcd(a, b)

	// not (a * b / gcd), because of reducing a probability of overflow
	return (a / gcd) * b
}

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

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

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

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

	return string(res)
}

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

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

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

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

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

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

const MOD = 1000000000 + 7
const ALPHABET_NUM = 26
const INF_INT64 = math.MaxInt64
const INF_BIT60 = 1 << 60

var n, m int64
var dp [100000 + 5]int64

func main() {
	n, m = ReadInt64_2()

	dp[0], dp[1] = 1, 2
	for i := 2; i <= 100000+3; i++ {
		dp[i] = dp[i-1] + dp[i-2]
		dp[i] %= MOD
	}

	var ans int64
	ans = dp[m-1] - 1
	ans += dp[n-1]
	ans %= MOD
	ans *= 2
	ans %= MOD

	fmt.Println(ans)
}

// MODはとったか？
// 遷移だけじゃなくて最後の最後でちゃんと取れよ？

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


package main

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

const mod = 1000000000 + 7
const N = 100100
var dp[N] int
var n, m int

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

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	fmt.Fscanf(reader,"%d %d\n", &n, &m)
	dp[1] = 2
	dp[2] = 4
	for i := 3; i <= max(n, m); i++ {
		dp[i] = (dp[i - 1] + dp[i - 2]) % mod
	}

	var ret = (dp[n] + dp[m] - 2) % mod
	if ret < 0 {
		ret += mod
	}
	fmt.Fprintf(writer, "%d", ret)
}


package main

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

const div int64 = 1000000007

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

	if n == 2 {
		return b
	}

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

	return b
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n, m int
	fmt.Fscanf(reader, "%d %d\n", &n, &m)
	fmt.Printf("%d\n", (cucl(n)+cucl(m)+div-2)%div)
}


package main

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

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

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

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

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

type Int int64

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

func solve(n Int) {
	var s string
	I(&s)
	var ans Int
	for i := range s {
		ans++
		if s[i] != '1' {
			break
		}
	}
	O(ans, "\n")
}


package main

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

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

	var changed_bits int = 0
	reader := bufio.NewReader(os.Stdin)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		for i := 0; i < n; i++ {
			if s[i] == '0' {
				changed_bits += 1
				break
			}
			changed_bits += 1
		}
	}

	fmt.Println(changed_bits)
}


package main

import ("fmt")

func calculate(s string, carry int, t int) int {

	carry = 1
	count := 0
	for i:=0;i<t;i++{
		if carry==1 && s[i]=='1'{
			count++
			carry = 1
		}
		if carry==1 && s[i]=='0'{
			count++
			carry =0
		}
	}
	return count
}

func main(){
	var t int
	fmt.Scanln(&t)
	var s string
	fmt.Scanln(&s)
	var carry int = 1
	fmt.Println(calculate(s,carry,t))
}


package main

import (
	"fmt"
)

func sort(rr, gg, bb int64) (int64, int64, int64) {
	if rr >= gg {
		if gg >= bb {
			return rr, gg, bb
		} else if rr >= bb {
			return rr, bb, gg
		}
		return bb, rr, gg
	}
	if rr >= bb {
		return gg, rr, bb
	} else if gg >= bb {
		return gg, bb, rr
	}
	return bb, gg, rr
}

func f(r, g, b int64) int64 {
	x := r - b
	y := g - b
	if y > 0 {
		if x >= 2 * y {
			return y + f(r - 2 * y, b, b)
		}
		k := (2 * x - y) / 3
		if (2 * x - y) % 3 != 0 {
			k++
		}
		return x - k + f(b + y - 2 * x + 3 * k, b, b)
	}
	if r >= 4 * b {
		return 2 * b
	}
	t := (4 * b - r) / 3
	if (4 * b - r) % 3 != 0 {
		t++
	}
	return 2 * b - t
}

func main() {
	var rr, gg, bb int64
	fmt.Scanf("%d %d %d", &rr, &gg, &bb)
	r, g, b := sort(rr, gg, bb)
	fmt.Println(f(r, g, b))
}


package main

import "fmt"

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

func main() {
    var r, g, b int64
    fmt.Scan( &r, &g, &b )
    r = min( r, 2 * (g + b) )
    g = min( g, 2 * (b + r) )
    b = min( b, 2 * (r + g) )
    fmt.Println( (r + g + b)/3 )
}


package main

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

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

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

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

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

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

func main() {
    defer writer.Flush()
    scanner.Split(bufio.ScanWords)
    a := make([]int, 3)
    a[0] = ReadInt32()
    a[1] = ReadInt32()
    a[2] = ReadInt32()
    sort.Ints(a)
    r := int64(a[0]) // min
    g := int64(a[1])
    b := int64(a[2]) // max
    ans := min((r+g+b)/3, r+g)
    writer.WriteString(strconv.FormatInt(ans, 10) + "\n")
}


package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	min := n
	if n > m {
		min = m
	}
	if min%2 == 0 {
		fmt.Print("Malvika")
		return
	}

	fmt.Print("Akshat")
}


package main

import (
	"fmt"
)

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

func main() {
	var n, m int
	fmt.Scan(&n)
	fmt.Scan(&m)
	var winner string
	if min(n, m)%2 == 0 {
		winner = "Malvika"
	} else {
		winner = "Akshat"
	}
	fmt.Println(winner)
}


package main
import (
	"fmt"
)

// 每选择一个交叉点，去点交叉点的两根木棍
// 即可用的木棍是n，m中较小的一个
func main(){
	var (
		n, m, num int
	)
	fmt.Scanf("%d %d\n", &n, &m)
	if n <= m {
		num = n
	}else {
		num = m
	}
	if num%2 == 0 {
		fmt.Println("Malvika")
	} else {
		fmt.Printf("Akshat")
	}
}


package main

import (
	"fmt"
)

func main() {
	arr := []int{1, 5, 10, 20, 100}
	var num int

	fmt.Scan(&num)
	count := 0
	startIndex := 4
	for num > 0 {
		if num < arr[startIndex] {
			startIndex--
			continue
		}
		count = count + (num / arr[startIndex])
		num = num % arr[startIndex]
		startIndex--
	}

	fmt.Println(count)
}


package main

import (
	"fmt"
)

func main() {
	var n, num int
	num = 0
	fmt.Scan(&n)
	for n != 0 {
		if n >= 100 {
			n -= 100
			num++
		} else if n >= 20 {
			n -= 20
			num++
		} else if n >= 10 {
			n -= 10
			num++
		} else if n >= 5 {
			n -= 5
			num++
		} else if n >= 1 {
			n -= 1
			num++
		}
	}
	fmt.Println(num)
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var k int
	fmt.Scan(&k)
	if k == 0 {
		fmt.Println(0)
		return
	}
	a := make([]int, 12)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	for i := 11; i >= 0; i-- {
		if k <= a[i] {
			fmt.Println(12 - i)
			return
		}
		k -= a[i]
	}
	fmt.Println(-1)
}


package main

import (
	"fmt"
	"sort"
)

var month [12]int

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

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

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

	sort.Ints(month[:])
	i := 11
	for ; i >= 0; i-- {
		k -= month[i]
		if k <= 0 {
			break
		}
	}

	if i < 0 {
		fmt.Println(-1)
	} else {
		fmt.Println(12 - i)
	}
}


package main
import (
    "fmt"
    "sort"
)

func main() {
    var t int
    num := make([]int, 12)
    total:=0

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

    for  i:=0;i<12;i++{
        fmt.Scan(&num[i])
        total += num[i]
    }

    if total<t {
        fmt.Println("-1")
    } else {
        sort.Sort(sort.Reverse(sort.IntSlice(num)))
        sum,m := 0,0
        for ;sum<t;m++ {
            sum += num[m]
        }
        fmt.Println(m)
    }
}


package main

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

func I(t interface{}, delim string) {
	fmt.Fscanf(r, "%v"+delim, t)
}

func O(o interface{}, delim string) {
	fmt.Fprintf(w, "%v"+delim, o)
}

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

var months []int
var days []string

func getDayByMonth(month, start int) string {
	d := start
	for i := 0; i < month; i++ {
		d += months[i]
	}
	day := days[d%7]
	return day
}

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

	months = []int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	days = []string{"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}

	var first, second string
	I(&first, "\n")
	I(&second, "\n")
	for m := 0; m < 11; m++ {
		for d := 0; d < 7; d++ {
			if getDayByMonth(m, d) == first && getDayByMonth(m+1, d) == second {
				O("YES", "\n")
				return
			}
		}
	}
	O("NO", "\n")
}