package main

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

func main() {
	sc := NewScanner()
	N, M := sc.NextInt64(), sc.NextInt64()

	for {
		if N == 0 || M == 0 {
			break
		}
		if N/M >= 2 {
			N -= N / M * M
		} else if 2 <= M/N {
			M -= M / N * N
		} else {
			break
		}
	}
	fmt.Println(N, M)

}

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

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

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

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

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

	return mp
}

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


package main

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

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

func power(n, mod int64) int64 {
	if n == 0 {
		return int64(1)
	}
	if n % 2 == 0 {
		x := power(n/2, mod)
		return (x*x) % mod
	} else {
		x := power(n/2, mod)
		return (2*x*x) % mod
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	scanner.Scan()
	mod := int64(1000)
	mod = mod*mod*mod + 7
	n, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	a := power(n-1, mod)
	b := (2*a+1) % mod
	x := (a * b) % mod
	writer.WriteString(fmt.Sprintf("%d\n", x))
}


package main

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

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

	var a, b, c int
	var tA, tB, tC int

	fmt.Fscanf(stdin, "%d%d%d\n", &a, &b, &c)
	fmt.Fscanf(stdin, "%d%d%d\n", &tA, &tB, &tC)

	a = a - tA
	b = b - tB
	c = c - tC

	// fmt.Println(a, b, c)

	if a < 0 {
		a = a * 2
	}
	if b < 0 {
		b = b * 2
	}
	if c < 0 {
		c = c * 2
	}

	if a + b + c >= 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

import (
	"fmt"
	"math/big"
)

const maxP int64 = 140

var (
	nProd  [maxP]*big.Int
	fact   [maxP]*big.Int
	bigNcr [maxP]*big.Int
	ncr    [maxP]int64
)

func main() {
	var n, p, q int64
	var md *big.Int = big.NewInt(int64((int64(1) << 32) - 1))
	var imd int64 = int64((int64(1) << 32) - 1)
	fmt.Scanf("%d%d%d", &n, &p, &q)
	fmt.Println(n, p, q)
	for i := int64(0); i < maxP; i++ {
		bigNcr[i] = big.NewInt(1)
		fact[i] = big.NewInt(1)
		nProd[i] = big.NewInt(1)
	}
	for i := int64(1); i < maxP; i++ {
		nProd[i].Mul(nProd[i-1], big.NewInt(int64(n-i+1)))
		fact[i].Mul(fact[i-1], big.NewInt(int64(i)))
	}
	for i := int64(0); i < maxP; i++ {
		bigNcr[i].Div(nProd[i], fact[i])
		bigNcr[i].And(bigNcr[i], md)
		ncr[i] = bigNcr[i].Int64()
	}
	var x, m int64
	x = 0
	if p < (n - 1) {
		m = p
	} else {
		m = n - 1
	}
	for i := int64(1); i <= q; i++ {
		var s, pw int64
		s = 0
		pw = 1
		for j := int64(0); j <= m; j++ {
			s += ncr[j] * pw
			s &= imd
			pw = (pw * i) & imd
		}
		x ^= (i * s) & imd
	}
	fmt.Println(x)
}


package main

import "fmt"

func main(){
	var n int;
	fmt.Scan (&n);
	a := make([]int, n);
	b := make([]int, n);
	counta := make([]int, 6);
	countb := make([]int, 6);
	for i := 0; i < n; i++{
		fmt.Scan(&a[i]);
		counta[a[i]]++;
	}
	for i:= 0; i < n; i++{
		fmt.Scan(&b[i]);
		countb[b[i]]++;
	}
	flag1 := 0;
	flag2 := 0;

	for i:= 1; i <=5; i++ {
		if counta[i] == countb[i] {
			continue;
		} else if counta[i] < countb[i] {
			flag1 += countb[i] - counta[i]
		} else {
			flag2 += counta[i] - countb[i]
		}
	}
	if flag2 == flag1 && flag2 % 2 != 1{
		fmt.Printf("%d\n", flag1/2);
	}else{
		fmt.Printf("-1\n");
	}
}


package main

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

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

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

	a1, b1, a2, b2, a3, b3 := nextInt(), nextInt(), nextInt(), nextInt(), nextInt(), nextInt()

	ok := false

	switch {
	case a1 >= max(a2, a3) && b1 >= b2+b3:
		ok = true
	case a1 >= max(a2, b3) && b1 >= b2+a3:
		ok = true
	case a1 >= max(b2, a3) && b1 >= a2+b3:
		ok = true
	case a1 >= max(b2, b3) && b1 >= a2+a3:
		ok = true

	case b1 >= max(a2, a3) && a1 >= b2+b3:
		ok = true
	case b1 >= max(a2, b3) && a1 >= b2+a3:
		ok = true
	case b1 >= max(b2, a3) && a1 >= a2+b3:
		ok = true
	case b1 >= max(b2, b3) && a1 >= b2+a3:
		ok = true
	}

	if ok {
		println("YES")
	} else {
		println("NO")
	}
}

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

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

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

func nextInt64() int64 {
	n, _ := strconv.ParseInt(next(), 0, 64)
	return n
}

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 print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }


package main

import (
	"fmt"
	"os"
)

func main(){
	var c string
	var ct [5]string
	fmt.Scan(&c)
	for i:=0; i<5; i++{
		fmt.Scan(&ct[i])
			if(c[0] == ct[i][0] || c[1] == ct[i][1]){
				fmt.Println("YES")
				os.Exit(0)
			}
		}
	}
	fmt.Println("NO")
}


package main
import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"strings"
)

func main(){
	resp, err := http.Get("https://malshare.com/daily/")
	if err != nil{
		log.Fatalln(err)
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil{
		log.Fatalln(err)
	}

	body_str := string(body)
	for{
		i := strings.Index(body_str, "alt=\"[DIR]\">		<a href=\""
		fmt.Println(body_str[i+len(magic_str) : i+len(magic_str)+10])
		body_str = body_str[i+len(magic_str)+10 : len(body_str)]
		if body_str[i+len(magic_str) : i+len(magic_str)+10] == "_disabled/"{
			break
		}
	}
}


package main

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

var first = []string{"D", "C", "S", "H"}
var seccond = []string{"2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"}

func CheckInput(table string) bool {
	check := 0
	for _, val := range first {
		if val == string(table[1]) {
			check++
		}
	}
	for _, val := range seccond {
		if val == string(table[0]) {
			check++
		}
	}

	if check > 0 {
		return true
	}
	return false
}

func Converster(a byte) int {
	switch {
	case int(a) < 58:
		return int(a) - 48
	case int(a) == 84: //T
		return 10
	case int(a) == 74: //J
		return 11
	case int(a) == 81: //Q
		return 12
	case int(a) == 75: //K
		return 13
	case int(a) == 65: //A
		return 14
	}
	return 0
}

func Check(table string, hand []string) bool {
	for _, val := range hand {
		if table[1] == val[1] {
			if Converster(val[0]) > Converster(table[0]) {
				return true
			}
		}
	}
	if Converster(table[0]) == 14 {
		for _, val := range hand {
			if Converster(val[0]) == 14 {
				return true
			}
		}
	}
	return false
}

func main() {
	var table string
	var hande string
	for {
		reader := bufio.NewReader(os.Stdin)
		table, _ = reader.ReadString('\n')

		checked := CheckInput(table)
		if len(table) == 2 {
			if checked {
				break
			}
		}
	}
	hand := []string{}
	for i := 0; i < 5; i++ {
		for {
			reader := bufio.NewReader(os.Stdin)
			hande, _ = reader.ReadString('\n')
			if len(hande) == 2 {
				if CheckInput(hande) {
					break
				}
			}
		}
		hand = append(hand, hande)
	}
	if Check(table, hand) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import "fmt"

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

	var list_input [5]string
	for i:=0; i<5; i++{
		fmt.Scan(&list_input[i])
	}

	for j:=0; j<5; j++{
		if string(input[0]) ==string(list_input[j][0]) || string(input[1]) == string(list_input[j][1]){
			fmt.Println("YES")
			break
		}
	}
	fmt.Println("NO")

}


package main

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

func main() {
	var n, t, k, d int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &n)
	fmt.Fscan(reader, &t)
	fmt.Fscan(reader, &k)
	fmt.Fscan(reader, &d)
	if n < k {
		fmt.Println("NO")
	} else if n/k*t <= t+d {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}


package main

import (
    "fmt"
)

func main()  {
	var noOfNeededCakes int
	fmt.Scan(&noOfNeededCakes)
	var timeNeedForCakes int
	fmt.Scan(&timeNeedForCakes)
	var noOfCakesAtSameTime int
	fmt.Scan(&noOfCakesAtSameTime)
	var timeToBuildOven int
	fmt.Scan(&timeToBuildOven)

	timePerOneCake := float64(timeNeedForCakes) /  float64(noOfCakesAtSameTime)
	timePerAllNeededCakesWithCurrentOven := timePerOneCake * float64(noOfNeededCakes)

	timeWithSecondOven := timePerAllNeededCakesWithCurrentOven / 2
	timeWithSecondOven  = timeWithSecondOven + float64(timeToBuildOven)

	if (noOfCakesAtSameTime >=  noOfNeededCakes || timePerAllNeededCakesWithCurrentOven <= timeWithSecondOven) {
		fmt.Print("NO")
	} else {
		fmt.Print("Yes")
	}

}


package main

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

func main() {
	var n, a int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	coins := make(map[int]int, 0)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a)
		coins[a]++
	}
	max := 0
	for i := 0; i < len(coins); i++ {
		if max < coins[i] {
			max = coins[i]
		}
	}
	fmt.Println(max)
}


package main

import (
	"fmt"
)

func MaxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func main() {
	var n int
	fmt.Scanf("%d", &n)
	var arr [101]int
	var brr [101]int
	for i := 0; i < n; i++ {
		fmt.Scan(arr[i])
		brr[arr[i]]++
	}
	res := 0
	for _, v := range brr {
		res = MaxInt(res, v)
	}
	fmt.Println(res)

}


// test.go
/*package main

import (
	"fmt"
	"strconv"
)

func changemap(mp map[int]string) {
	(mp)[1] = "did hello"

}

func main() {

	b := 6
	fmt.Println(strconv.Itoa(b)) // translate int to 'int'
	//	a := "abcd"
	mp := map[int]string{1: "hello", 2: "world"}
	//mp[1] = "hello"
	//mp[2] = "world"

	fmt.Println(mp)
	changemap(mp)
	fmt.Println(mp)

	/*list := []byte(a)
	fmt.Println(list)
	list[0] = 34
	fmt.Println(list)
	fmt.Println(a)

	fmt.Printf("%d %c %d\n", a[0], a[1], a[2])
	fmt.Println(byte(10), byte('a'), string(byte('0')))
}
*/
package main

import (
	"fmt"
)

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func main() {
	var n, a int
	fmt.Scanf("%d", &n)
	var cnt [200]int
	ans := 1
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a)
		cnt


package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var m [100]int
	for i:=0;i<n;i++{
		var j int
		fmt.Scan(&j)
		m[j]++
	}
	l :=0
	for _,i := range(m){
		if i > l {
			l = i
		}
	}
	fmt.Println(l)
}


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, t := next(), next()
	pos1, pos2 := 0, 0
	cntMark := 0
	cntEqual := 0

	for i := range s {
		if s[i] == '+' {
			pos1++
		} else {
			pos1--
		}
	}

	for i := range t {
		switch t[i] {
		case '+':
			pos2++
		case '-':
			pos2--
		case '?':
			cntMark++
		}
	}
	// println(pos1, pos2, cntMark, t)
	permutation := 1 << uint64(cntMark)
	for k := 0; k < permutation; k++ {
		cnt := 0

		for i := 0; i < cntMark; i++ {
			if i&k > 0 {
				cnt++
			}
		}

		if pos2+cnt == pos1 {
			cntEqual++
		}
	}
	// println(cntEqual, permutation)
	println(float64(cntEqual)/float64(permutation))
}

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

func pow(x, n int) int {
	result := 1
	for i := 0; i < n; i++ {
		result *= x
	}
	return result
}

func main() {
	var s1, s2 string
	var ask, finish, current int
	fmt.Scan(&s1, &s2)
	for i := 0; i < len(s1); i++ {
		if s1[i] == '+' {
			finish += 1
		} else {
			finish -= 1
		}

		switch s2[i] {
		case '+':
			current += 1
		case '-':
			current -= 1
		case '?':
			ask += 1
		}
	}
	if ask == 0 {
		if finish == current {
			fmt.Println(1)
			return
		} else {
			fmt.Println(0)
			return
		}
	}
	power := pow(2, ask)
	res := 0
	for i := 0; i < power; i ++ {
		sum := 0
		for j := 0; j < ask; j++ {
			if i&pow(2, j) > 0 {
				sum += 1
			} else {
				sum -= 1
			}
		}
		if finish == current+sum {
			res += 1
		}
	}
	fmt.Println(float32(res) / float32(power))
}


package main

import (
	"fmt"
)

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

	ships := 0
	for a > 0 && b > 0 {
		if a < b {
			ships += b / a
			b = b % a
		} else {
			ships += a / b
			a = a % b
		}
	}
	fmt.Printf("%d\n", ships)
}


package main

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

const mod =  998244353
var n, m, L, R int

func pw(a int, b int) int {
	if a == 0 {
		if b == 0 {
			return 1
		}
		return 0
	}
	var ret = 1
	for b > 0 {
		if (b & 1) == 1 {
			ret = int(int64(ret) * int64(a) % mod)
			b--
		} else {
			a = int(int64(a) * int64(a) % mod)
			b /= 2
		}
	}
	return ret
}

func main()  {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	fmt.Fscanf(reader, "%d %d %d %d", &n, &m, &L, &R)

	var diff = R - L + 1
	var odd = diff / 2
	var evn = diff / 2

	if diff % 2 != 0 {
		if L % 2 == 0 {
			evn++
		} else {
			odd++
		}
	}

	var T = int(int64(n) * int64(m) % (mod - 1))
	var ret = pw(evn + odd, T)
	ret = (ret + pw(evn - odd, T)) % mod

	if ret < 0 {
		ret += mod
	}

	ret = int(int64(ret) * int64(pw(2, mod - 2)) % mod)
	fmt.Fprintf(writer, "%d", ret)
}


package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	c = a/2*b + a%2*b/2
	b = b/2*a + b%2*a/2
	if c < b {
		c = b
	}
	fmt.Print(c)
}


package main

import (
    "fmt"
)

func main() {
    var n uint16
    fmt.Scan(&n)
    ans := "NO"
    arr := [14]int{4,7,44,47,74,77,444,447,474,477,744,747,774,777}
    for _,v := range arr{
        if n%v==0{
            ans = "YES"
            break
        }
    }
    fmt.Println(ans)
}


package main

import (
	"fmt"
)

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

	n := len(s1)
	for i := 0; i < n; i++ {
		c1 := s1[i]
		c2 := s2[i]
		if c1 > 90 {
			c1 -= 32
		}
		if c2 > 90 {
			c2 -= 32
		}
		if c1 == c2 {
			continue
		}

		if c1 > c2 {
			fmt.Print(1)
		} else {
			fmt.Print(-1)
		}
		return
	}

	fmt.Print(0)
}


package main

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

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

func main() {
	n := getInput()
	number, _ := strconv.Atoi(n)
	if number%4 == 0 || number%7 == 0 {
		fmt.Println("YES")
	} else {
		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 main() {
	var n int
	fmt.Scan(&n)
	var luckynum = [...]int{4, 7, 44, 47, 74, 77, 444, 447, 477, 747, 774, 777}

	i := 0
	lucky := false
	for luckynum[i] <= n {
		if n%luckynum[i] == 0 {
			lucky = true
			break
		}
		i++
	}
	if lucky {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


import (
        "fmt"
)

var lucky = []int{4, 7, 44, 77, 47, 74, 444, 777, 477, 747, 774, 744, 474, 447}

func main() {
        var num int
        fmt.Scanf("%d\n", &num)
        var a = num
        var fuck = true
        for {
                if a == 0 {
                        break
                }
                if a%10 == 4 || a%10 == 7 {
                        fuck = true
                        a = a / 10
                } else {
                        fuck = false
                        break
                }
        }
        if !fuck {
                for _, i := range lucky {
                        if num%i == 0 {
                                fuck = true
                                break
                        }
                }
        }
        if fuck {
                fmt.Println("YES")
        } else {
                fmt.Println("NO")
        }
}


package main

import (
        "fmt"
)

var (
        ax int64
        ay int64
        bx int64
        by int64
        cx int64
        cy int64
)

func main() {
        fmt.Scanf("%d %d %d %d %d %d\n", &ax, &ay, &bx, &by, &cx, &cy)
        if ((ax-bx)*(ax-bx)+(ay-by)*(ay-by)) == ((bx-cx)*(bx-cx)+(by-cy)*(by-cy)) && (bx-ax)*(cy-ay) != (by-ay)*(cx-bx) {
                fmt.Println("YES")
        } else {
                fmt.Println("NO")
        }


package main

import (
        "fmt"
)

var (
        ax int64
        ay int64
        bx int64
        by int64
        cx int64
        cy int64
)

func main() {
        fmt.Scanf("%d %d %d %d %d %d\n", &ax, &ay, &bx, &by, &cx, &cy)
        if ((ax-bx)*(ax-bx)+(ay-by)*(ay-by)) == ((bx-cx)*(bx-cx)+(by-cy)*(by-cy)) && (bx-ax)*(cy-ay) != (by-ay)*(cx-bx) {
                fmt.Printf("YES\n")
        } else {
                fmt.Printf("NO\n")
        }
}


package main

import "fmt"

func main() {
	var ax, ay, bx, by, cx, cy int64
	fmt.Scan(&ax, &ay, &bx, &by, &cx, &cy)
	cx -= bx
	cy -= by
	bx -= ax
	by -= ay
	if bx*bx+by*by == cx*cx+cy*cy && bx != cx {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

import "fmt"

var success, k1, k2 int

func lineUp(n1 int, n2 int, k3 int, k4 int, debug int) {
  if n1 == 0 && n2 == 0 && k3 >= 0 && k4 >= 0 {
    success++
    return
  } else if n1 < 0 || n2 < 0 || k3 < 0 || k4 < 0{
    return
  }

  if debug == 1 || debug == 0 {
    lineUp(n1-1, n2, k3-1, k2, 1)
  } else {
    lineUp(n1-1, n2, k1-1, k4, 1)
  }

  if debug == 2 || debug == 0 {
    lineUp(n1, n2-1, k1, k4-1, 2)
  } else {
    lineUp(n1, n2-1, k3, k2-1, 2)
  }
}

func main() {
  var n1, n2 int
  fmt.Scanf("%d %d %d %d", &n1, &n2, &k1, &k2)
  lineUp(n1, n2, k1, k2, 0)

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


package main

import "fmt"
import "strconv"

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

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


package main

import (
	"fmt"
)

func checkEven(n int) (b bool) {
	i := 0
	for n > 9 {
		n /= 10
		i++
	}

	// even
	if i % 2 == 1 {
		b = true
		return
	} else {
		return false
	}
}

func checkPalindrome(n int) bool {
	n2 := n
	m := 0
	for n2 > 0 {
		m = 10 * m + n2 % 10
		n2 /= 10
	}

	return m == n
}

func main() {
	var k, p int
	fmt.Scan(&k, &p)
	nSum := 0
	nK := 0
	for i := 1; ; i++ {
		if checkEven(i) && checkPalindrome(i) {
			nSum += i
			nK++
			if nK >= k {
				break
			}
		}
	}

	nResult := nSum % p
	fmt.Println(nResult)
}


package main

import (
	"fmt"
	"math"
)

func palindrome(val int) int {
	res, count, n := 0, 0, val
	for n > 0 {
		x := n % 10
		res += res*10 + x
		count++
		n /= 10
	}
	res += val * int(math.Pow(10, float64(count)))
	return res
}

func main() {
	var k, p int
	fmt.Scan(&k, &p)
	sum := 0
	for i := 1; i <= k; i++ {
		sum = (sum%p + palindrome(i)%p) % p
	}
	fmt.Println(sum)
}


package main

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

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

	a := make([]int, 2*n)

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(s, "")
		for i := 0; i < 2*n; i++ {
			a[i] = int(s[i] - '0')
		}
	}

	merge_sort(a, 0, n-1)
	merge_sort(a, n, 2*n-1)

	pos := 0
	neg := 0
	for i := 0; i < n; i++ {
		if a[i] > a[n] {
			pos++
		} else {
			neg++
		}
	}

	if pos == n || neg == n {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func merge(buffer []int, start, middle, end int) {
	sorted := make([]int, end-start+1)

	i := start
	j := middle + 1
	k := 0
	for i <= middle && j <= end {
		if buffer[i] <= buffer[j] {
			sorted[k] = buffer[i]
			i++
		} else {
			sorted[k] = buffer[j]
			j++
		}
		k++
	}
	for i <= middle {
		sorted[k] = buffer[i]
		k++
		i++
	}
	for j <= end {
		sorted[k] = buffer[j]
		k++
		j++
	}

	i = start
	k = 0
	for i <= end {
		buffer[i] = sorted[k]
		i++
		k++
	}
}

func merge_sort(buffer []int, start, end int) {
	if end > start {
		middle := (end + start) / 2
		merge_sort(buffer, start, middle)
		merge_sort(buffer, middle+1, end)
		merge(buffer, start, middle, end)
	}
}


package main

import (
    "fmt"
    "sort"
)

func main() {
    var n int
    var s string
    fmt.Scan(&n)
    fmt.Scan(&s)
    left := make([]int,n)
    for i := 0; i < n; i++ {
        left[i] = int(s[i])
    }
    sort.Ints(left)
    right := make([]int,n)
    for i := n; i < (2*n); i++ {
        right[i-n] = int(s[i])
    }
    sort.Ints(right)
    ans := true
    for i := 1; i < n; i++ {
        if ((left[i] >= right[i]) && (left[i-1] <= right[i-1])) || ((left[i] <= right[i]) && (left[i-1] >= right[i-1])) {
            ans = false
            break
        }
    }
    if ans { fmt.Println("YES") } else { fmt.Println("NO") }
}


// 160B-mic
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var str string
	f := false
	fmt.Scan(&n, &str)
	a := make([]int, n)
	b := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = int(str[i])
	}
	for i := 0; i < n; i++ {
		b[i] = int(str[i+n])
	}
	sort.Sort(sort.IntSlice(a))
	sort.Sort(sort.IntSlice(b))
	//fmt.Println(a)
	//fmt.Println(b)
	if n == 1 {
	fmt.Println("YES")
	return
	}
	for i := 0; i < n-1; i++ {
		if a[i] > b[i] && a[i+1] > b[i+1] {
			f = true
		} else if a[i] < b[i] && a[i+1] < b[i+1] {
			f = true
		} else {
			f = false
			break
		}
	}
	if f {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	if a > b {
		fmt.Print(b + 1)
	} else {
		fmt.Print(n - a)
	}
}


package main
import ("fmt"
)
func main(){
    var n,a,b int
  fmt.Scanf("%d%d%d",&n,&a,&b);
  fmt.Println(n-b+1)
}


// 124A-mic
package main

import (
    "fmt"
)

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


package main

import "fmt"

type point struct {
	total int
	next  int
	eat   int
	step  int
}

func main() {
	var (
		actions int
		total   int
	)
	if _, err := fmt.Scanln(&actions, &total); err != nil {

	}
	queue := make([]point, 1000000000)
	queue[0] = point{
		total: 1,
		next:  2,
		eat:   0,
		step:  1,
	}
	for i, e := 0, 1; i < e; i += 1 {
		p := queue[i]
		if p.step == actions && p.total == total {
			fmt.Println(p.eat)
			return
		}

		if p.step >= actions {
			continue
		}

		//fmt.Println(i, e, p)

		// eat
		if p.total >= 1 {
			queue[e] = point{
				total: p.total - 1,
				next:  p.next,
				eat:   p.eat + 1,
				step:  p.step + 1,
			}
			e += 1
		}

		// add
		queue[e] = point{
			total: p.total + p.next,
			next:  p.next + 1,
			eat:   p.eat,
			step:  p.step + 1,
		}
		e += 1
	}
}


package main

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

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

	var n, k int
	fmt.Fscanf(input, "%d %d\n", &n, &k)
	for m := 0; m <= n; m++ {
		if k == (n-m)*(n-m+1)/2-m {
			fmt.Println(m)
			return
		}
	}
}


package main

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

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

	var n, k int64
	fmt.Fscanf(input, "%d %d\n", &n, &k)
	a := -(2*n + 3)
	b := n * (n + 1)
	for m := int64(0); m <= n; m++ {
		if 2*k == m*m+a*m+b {
			fmt.Println(m)
			return
		}
	}
}


package main

import (
	"fmt"
)

func main() {
	var moveNum, candyNum int

	_, err := fmt.Scanln(&moveNum, &candyNum)
	if err != nil {
	}

	for i := 1; i <= moveNum; i++ {
		j := int64(moveNum - i)
		a := int64((1 + i) * i / 2)
		if a < j {
			continue
		}
		candy := a - j
		if (candy - int64(candyNum)) == 0 {
			fmt.Println(j)
		}
	}
}


package main

import (
    "fmt"
)

func main() {
    var i int
    fmt.Scan(&i)
    fmt.Println(i % 2 + 1)
}


package main

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

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


package main

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

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


package main

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

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


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

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


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

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

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


package main

import (
	"fmt"
	"strings"
)

func main() {
	var (
		str string
	)

	fmt.Scan(&str)
	fmt.Println(strings.ToLower(str))
}


package main

import (
	"fmt"
)

func main() {

	var init, goal, f int
	fmt.Scan(&init)
	fmt.Scan(&goal)
	//p := make([]int, n)

	var ans = 0
	for goal > init {
		if goal%init != 0 {
			fmt.Println("NO")
			return
		}

		goal = goal / init
		ans++
	}

	if goal == init {
		fmt.Println("YES")
		fmt.Println(ans)
	} else {
		fmt.Println("NO")
	}

	fmt.Println(5 - ans)
	fmt.Scan(&f)
}


package main

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

var scanner *bufio.Scanner

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

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

  base, target := getI64(), getI64()
  for x := int64(1); x <= target; x *= base {
    if x == target {
      writer.WriteString("YES\n")
      return
    }
  }
  writer.WriteString("NO\n")
}


package main

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

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

	var x, y [3]int64
	for i := 0; i < 3; i++ {
		Fscan(in, &x[i], &y[i])
	}
	d := x[2]*x[2] + y[2]*y[2]
	for i := 0; i < 4; i++ {
		x[0], y[0] = y[0], x[0]
		y[0] = -y[0]
		dx, dy := x[1]-x[0], y[1]-y[0]
		d1, d2 := dx*x[2]+dy*y[2], dx*y[2]-dx*x[2]
		if d == 0 && dx == 0 && dy == 0 || d > 0 && d1%d == 0 && d2%d == 0 {
			Fprint(out, "YES")
			return
		}
	}
	Fprint(out, "NO")
}

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


//A. Wrong Subtraction

/*
Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:

    if the last digit of the number is non-zero, she decreases the number by one;
    if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).

You are given an integer number 𝑛
. Tanya will subtract one from it 𝑘 times. Your task is to print the result after all 𝑘

subtractions.

It is guaranteed that the result will be positive integer number.
Input

The first line of the input contains two integer numbers 𝑛
and 𝑘 (2≤𝑛≤109, 1≤𝑘≤50

) — the number from which Tanya will subtract and the number of subtractions correspondingly.
Output

Print one integer number — the result of the decreasing 𝑛
by one 𝑘

times.

It is guaranteed that the result will be positive integer number.

Examples
Input
512 4

Output
50

Input
1000000000 9

Output
1

Note: The first example corresponds to the following sequence: 512→511→510→51→50
*/
package main

import (
	assert "github.com/rnd"
)

func main() {
	assert.Assert(substract(512, 4), 50)
	assert.Assert(substract(1000000000, 9), 1)
}

func substract(n, k int) int {
	for i := 0; i < k; i++ {
		if n%10 == 0 {
			n /= 10
		} else {
			n--
		}
	}
	return n
}


package main

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

func main() {
	args := os.Args[1:]
	i, _ := strconv.Atoi(args[0])
	j, _ := strconv.Atoi(args[1])
	fmt.Println(substract(i, j))
}

func substract(n, k int) int {
	for i := 0; i < k; i++ {
		if n%10 == 0 {
			n /= 10
		} else {
			n--
		}
	}
	return n
}


package main

import (
  "fmt"
)
func dec(n int) int {
    if n<=0{
        return 0
    }
    if n%10 == 0 {
        return n/10
    }
    return n--;
}
func main() {
    var n, k int
    fmt.Scanf("%d", &n)
    fmt.Scanf("%d", &k)
    for ;k-->0;{
        n = dec(n);
    }

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


package main

import "fmt"

func main() {
    var n, k int
    fmt.Scanf("%d %d\n", &n, %k)
    for i := 0; i < k; i++ {
        if n % 10 == 0 {
            n = n / 10
        } else {
            n--
        }
    }
    fmt.Println(n)
}


package main

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

func WrongSubstraction(n int, k int) int {
	ret := n
	if k > 0 {
		if n%10 == 0 {
			ret = WrongSubstraction(n/10, k-1)
		} else {
			ret = WrongSubstraction(n-1, k-1)
		}
	}
	return ret

}

func main() {

	n, err := strconv.Atoi(os.Args[1])
	if err != nil {
		panic(err)
	}

	k, err := strconv.Atoi(os.Args[2])
	if err != nil {
		panic(err)
	}

	fmt.Print(WrongSubstraction(n, k))
}


package main

import (
	"fmt"
	"sort"
)

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

	line := make([]int, n)
	for i, _ := range line {
		fmt.Scanf("%d", &line[i])
	}

	count := 0

	for ; !sort.SliceIsSorted(line, compare(line)); {

	}
	fmt.Print(count)

}

func compare(line []int) func(i int, j int) bool {
	return func(i, j int) bool {
		return line[i] < line[j]
	}
}


package main

import "fmt"

func main10() {
	// rrr g bbbbb gg
	var n int
	var cu string
	fmt.Scanf("%d", &n)
	fmt.Scanln(&cu)
	corAnterior := cu[:1]
	pomba := 1
	for i := 1; i < n; i++ {
		corAtual := cu[i : i+1] // pegar i
		if corAtual != corAnterior {
			pomba++
			corAnterior = corAtual
		}
	}
	fmt.Println(n - pomba)
}


package main

import (
	"fmt"
	"container/list"
)

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

	var distance [2005]int
	queue := list.New()

	distance[n] = 1
	queue.PushBack(n)

	for e := queue.Front(); e != nil; e = e.Next() {
		x := e.Value.(int)

		if x == m {
			fmt.Printf("%d\n", distance[x] - 1)
			break
		}

		if x > 1 && distance[x - 1] == 0 {
			distance[x - 1] = distance[x] + 1
			queue.PushBack(x - 1)
			if x - 1 == m {
				fmt.Printf("%d\n", distance[x])
				break
			}
		}

		if x < m && distance[x * 2] == 0 {
			distance[x * 2] = distance[x] + 1
			queue.PushBack(x * 2)
			if x * 2 == m {
				fmt.Printf("%d\n", distance[x])
				break
			}
		}
	}
}


package main

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

var scanner *bufio.Scanner

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

var cost = map[int]int{}
var target int

func foo(x, steps int) {
  c, found := cost[x]
  if found && c <= steps {
    return
  }
  cost[x] = steps
  if x < target {
    foo(2*x, steps+1)
  }
  if x > 0 {
    foo(x-1, steps+1)
  }
}

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

  x := getI()
  target = getI()
  if target <= x {
    writer.WriteString(fmt.Sprintf("%d\n", x-target))
    return
  }
  foo(x, 0)
  writer.WriteString(fmt.Sprintf("%d\n", cost[target]))
}


// You can edit this code!
// Click here and start typing.
package main

import (
	"container/list"
	"fmt"
)

type stackval struct {
	current int
	steps   int
}

func solve(n, m int) int {
	var visited [10001]int
	var best = 10000

	s := list.New()
	el := stackval{n, 0}

	s.PushBack(el)

	for s.Len() > 0 {
		el := s.Remove(s.Front()).(stackval)
		visited[el.current] = 1
		if el.current >= m {
			steps := el.steps + (el.current - m)
			if steps < best {
				best = steps
			}
		} else {
			if el.current > 0 {
				if visited[el.current-1] == 0 {
					s.PushBack(stackval{el.current - 1, el.steps + 1})
				}
			}
			if visited[el.current*2] == 0 {
				s.PushBack(stackval{el.current * 2, el.steps + 1})
			}
		}
	}

	return best
}

func main() {
	var m, n int
	fmt.Scanf("%d %d", &n, &m)
	res := solve(n, m)
	fmt.Println(res)
}


package main

import (
	"fmt"
)

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

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

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


package main

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

var bestTimes int
var m int
var ret []int

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanln(reader, &n, &m)
	max := 0
	if n > m {
		bestTimes = n - m
		max = n
	} else {
		bestTimes, max = initBestTimes(n, m)
	}
	ret = make([]int, max*2+1)
	for i := 0; i < len(ret); i++ {
		ret[i] = -1
	}
	dfs1(n, 0)
	fmt.Println(bestTimes)
}

func dfs1(n int, count int) {
	if count > bestTimes {
		return
	}
	if n == m {
		if count < bestTimes {
			bestTimes = count
		}
		return
	}
	if n == 0 {
		return
	}
	if n-1 < len(ret) && ret[n-1] == -1 {
		dfs1(n-1, count+1)
	}
	if n*2 < len(ret) && ret[n*2] == -1 {
		dfs1(n*2, count+1)
	}
}

func initBestTimes(n, m int) (int, int) {
	temp := n
	count := 0
	for {
		count++
		temp *= 2
		if temp > m {
			return count + temp - m, temp
		}
	}
}


package main

import (
	"container/list"
	"fmt"
)

type Item struct {
	value int
	depth int
}

type Queue struct {
	data *list.List
}

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

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

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

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

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

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

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

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

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

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

			it.value = graph[val][1]
			q.Enqueue(it)
		}
	}

	return ans
}

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


package main

import (
	"container/list"
	"fmt"
)

type Item struct {
	value int
	depth int
}

type Queue struct {
	data *list.List
}

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

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

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

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

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

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

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

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

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

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

			it.value = graph[val][1]
			q.Enqueue(it)
		}
	}

	return ans
}

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


package main

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

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

func main() {
	scanner.Split(bufio.ScanWords)
	var n, m int
	scan(&n, &m)
	c := 0
	for n != m {
		if n*2 == m {
			c++
			fmt.Println(c)
			return
		}
		n--
		c++
	}
	fmt.Println(c)

}

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

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

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

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


package main

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

func main() {
	var n, m int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscanln(reader, &n, &m)
	tims := 0
	if n >= m {
		tims = n - m
	} else {
		if m%2 != 0 {
			m += 1
			tims++
			if m/2 <= n {
				m = m / 2
				tims++
			} else {
				for m/2+m%2 >= n {
					m = m/2 + m%2
					if m%2 != 0 {
						tims++
					}
					//fmt.Println("M: ", m)
					if m == n {
						break
					}
					tims++
				}
			}
			for n != m {
				n--
				tims++
			}
		} else {
			if m/2 <= n {
				m = m / 2
				tims++
			} else {
				for {
					if m <= n {
						break
					}
					if m%2 != 0 {
						m++
						tims++
					}
					m = m / 2
					tims++
				}
			}
			tims += n - m
		}
	}
	fmt.Println(tims)
}


package main

import (
	"fmt"
)

type pair struct {
	nn int
	dd int
}

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

	if n >= m {
		fmt.Println(n - m)
	} else {
		device := make([]pair, 1)
		device[0] = pair{n, 0}

		ans := 0
		for {
			// pop front element
			tmp := device[0]
			device = device[1:]

			if tmp.nn == m { // reached destination
				ans = tmp.dd
				break
			}

			// add neighbors to the queue
			device = append(device, pair{tmp.nn - 1, tmp.dd + 1})
			device = append(device, pair{tmp.nn * 2, tmp.dd + 1})
		}

		fmt.Println(ans)
	}
}


package main

import (
	"fmt"
)

type pair struct {
	nn int
	dd int
}

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

	if n >= m {
		fmt.Println(n - m)
	} else {
		visited := make([]bool, 2*m+1)

		device := make([]pair, 1)
		device[0] = pair{n, 0}

		ans := 0
		visited[n] = true
		for {
			// pop front element
			tmp := device[0]
			// device = device[1:]
			copy(device[0:len(device)-1], device[1:])

			if tmp.nn == m { // reached destination
				ans = tmp.dd
				break
			}

			// add neighbors to the queue
			if tmp.nn*2 < 2*m+1 && visited[tmp.nn*2] == false {
				device = append(device, pair{tmp.nn * 2, tmp.dd + 1})
				visited[tmp.nn*2] = true
			}
			if tmp.nn-1 >= 0 && visited[tmp.nn-1] == false {
				device = append(device, pair{tmp.nn - 1, tmp.dd + 1})
				visited[tmp.nn-1] = true
			}
		}

		fmt.Println(ans)
	}
}


// 192A
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, i, j float64
	fmt.Scan(&n)
	for i = 1; i*(i+1)/2 <= n; i++ {
		j = math.Sqrt(n*2 - i*(i+1))
		if j > 0 && j*(j+1)+i*(i+1) == n*2 {
			fmt.Print("YES")
			return
		}
	}
	fmt.Print("NO")
	return
}


package main

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

var mem [1e6 + 1]*big.Int

func exp(k int) *big.Int {
	if k < len(mem) && mem[k] != nil {
		return mem[k]
	}
	t := exp(k / 2)
	ret := new(big.Int).Mul(t, t)
	if k&1 != 0 {
		ret.Mul(ret, mem[1])
	}
	if k < len(mem) {
		mem[k] = ret
	}
	return ret
}

func main() {
	var k, b, n, t int64
	fmt.Scan(&k, &b, &n, &t)
	if k == 1 {
		ans := (b*n + b - t) / b
		if ans < 0 {
			ans = 0
		}
		fmt.Println(ans)
		return
	}
	target := big.NewInt(k)
	target.Exp(target, big.NewInt(n), nil)
	target.Mul(target, big.NewInt(k-1+b))
	mul := big.NewInt(t*(k-1) + b)
	mem[0] = big.NewInt(1)
	mem[1] = big.NewInt(k)
	cur := new(big.Int)
	fmt.Println(sort.Search(int(n), func(n int) bool {
		return target.Cmp(cur.Mul(exp(n), mul)) <= 0
	}))
}


package main

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

var mem [1e6 + 1]*big.Int

func exp(k int) *big.Int {
	if mem[k] != nil {
		return mem[k]
	}
	t := exp(k / 2)
	mem[k] = new(big.Int).Mul(t, t)
	if k&1 != 0 {
		mem[k].Mul(mem[k], mem[1])
	}
	return mem[k]
}

func main() {
	var k, b, n, t int64
	fmt.Scan(&k, &b, &n, &t)
	if k == 1 {
		ans := (b*n + b - t) / b
		if ans < 0 {
			ans = 0
		}
		fmt.Println(ans)
		return
	}
	target := big.NewInt(k)
	target.Exp(target, big.NewInt(n), nil)
	target.Mul(target, big.NewInt(k-1+b))
	mul := big.NewInt(t*(k-1) + b)
	mem[1] = big.NewInt(k)
	fmt.Println(sort.Search(int(n), func(n int) bool {
		return target.Cmp(new(big.Int).Mul(exp(n), mul)) <= 0
	}))
}


package main

import (
	"fmt"
	"math/big"
)

var mem [1e6 + 1]*big.Int

func exp(k int) *big.Int {
	if mem[k] != nil {
		return mem[k]
	}
	t := exp(k / 2)
	mem[k] = new(big.Int).Mul(t, t)
	if k&1 != 0 {
		mem[k].Mul(mem[k], mem[1])
	}
	return mem[k]
}

func main() {
	var k, b, n, t int64
	fmt.Scan(&k, &b, &n, &t)
	if k == 1 {
		ans := (b*n + b - t) / b
		if ans < 0 {
			ans = 0
		}
		fmt.Println(ans)
		return
	}
	mem[0] = big.NewInt(1)
	mem[1] = big.NewInt(k)
	mul := big.NewInt(k - 1 + b)
	target := big.NewInt(t*(k-1) + b)
	for i := 0; ; i++ {
		if target.Cmp(new(big.Int).Mul(exp(i), mul)) < 0 {
			fmt.Println(int(n) - i + 1)
			return
		}
	}
}


package main

import (
	"bufio"
	"os"
)

func main() {
	var scanner *bufio.Scanner = bufio.NewScanner(os.Stdin)
	var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()           // очищает буфер при выходе из функции main
	scanner.Split(bufio.ScanWords) // заставляет scanner считать отдельными токенами слова, разделенные пробелами

	scanner.Scan()
	s1 := scanner.Text()
	scanner.Scan()
	s1 += scanner.Text()

	scanner.Scan()
	s2 := scanner.Text()
	scanner.Scan()
	s2 += scanner.Text()

	se := make([]byte, 0, 3)
	sb := make([]byte, 0, 3)
	for i := 0; i < 4; i++ {
		if s1[i] != 'X' {
			se = append(se, s1[i])
		}
		if s2[i] != 'X' {
			sb = append(sb, s2[i])
		}
	}
	ec := 0
	eb := 0
	gse := string(se)
	gsb := string(sb)

	if gse == "ABC" || gse == "CAB" || gse == "BCA" {
		ec = 1
	}
	if gsb == "ABC" || gsb == "CAB" || gsb == "BCA" {
		eb = 1
	}
	if ec == eb {
		writer.WriteString("YES")
	} else {
		writer.WriteString("NO")
	}
}


package main

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

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

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

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

	cwEnd := (start + rot) % 4
	ccwEnd := (start - rot) % 4
	if ccwEnd < 0 {
		ccwEnd += 4
	}

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

}

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

	return
}

func gsls(reader *bufio.Reader) (arr []string) {
	// Get a full line

	input, _ := reader.ReadString('\n')

	// fmt.Printf("Got %#v \n", input)

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

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

	return
}

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

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

	return
}

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

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

	return
}


package main

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

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

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

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

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

	diff := posMod(end-start, 4)

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

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

	return
}

// Input helpers

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

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

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

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

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

	return
}

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

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

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

	return
}

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

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

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

	return
}

// Math helpers

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

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


package main

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

func getR(b byte) int {
	switch b {
	case '^':
		return 0
	case '>':
		return 1
	case 'v':
		return 2
	case '<':
		return 3
	}
	return -1
}
func main() {
	sc := NewScanner()
	S, E := sc.Next(), sc.Next()
	N := sc.NextInt()

	rS := getR(S[0])
	rE := getR(E[0])

	bit := 0

	if (rS+N)%4 == rE {
		bit |= 1
	}
	if (rS-N)%4 == rE {
		bit |= 2
	}
	if bit == 1 {
		fmt.Println("cw")
	} else if bit == 2 {
		fmt.Println("ccw")
	} else {
		fmt.Println("undefined")
	}
}

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

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

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

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

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

	return mp
}

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


package main

import (
	"fmt"
)

func main() {
	var n, m int
	var a, b string
	fmt.Scanln(&n, &m)
	fmt.Scanln(&a)
	fmt.Scanln(&b)
	same := make([]int, len(b))
	for k := range b {
		j := k
		for i := range a {
			if a[i] == b[j] {
				same[k]++
				j = (j + 1) % len(b)
			}
		}
	}
	j := 0
	for i := 0; i < n; i++ {
		j += same[j%m]
	}
	fmt.Println(j / (m * len(b)))
}


package main

import "fmt"

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

	answers := make([]int, numCases)

	for i := 0; i < numCases; i++ {
		var n, k, d int
		fmt.Scanf("%d %d %d", &n, &k, &d)
		fmt.Println("d = ", d, "n = ", n)

		_ = k // unused

		schedule := make([]int, n)
		for j := 0; j < n; j++ {
			fmt.Scanf("%d", &schedule[j])
		}

		answers[i] = solveCase(schedule, d)
	}

	for _, a := range answers {
		fmt.Println(a)
	}
}

// solveCase solves single task case for:
// * schedule -- index - day, value - show id
// * days -- target number of days for subscription
func solveCase(schedule []int, days int) (numShows int) {
	shows := make(map[int]int)

	for i := 0; i < days; i++ {
		shows[schedule[i]]++
	}

	numShows = len(shows)

	for i := days; i < len(schedule); i++ {
		cnt := shows[schedule[i-days]]
		if cnt == 1 {
			delete(shows, schedule[i-days])
		} else {
			shows[schedule[i-days]]--
		}

		shows[schedule[i]]++

		if len(shows) < numShows {
			numShows = len(shows)
		}
	}

	return numShows
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _, _ := reader.ReadLine()
	inputs := strings.Split(string(input), " ")

	first, _ := strconv.Atoi(inputs[0])
	sec, _ := strconv.Atoi(inputs[1])
	sec = sec - 1
	third, _ := strconv.Atoi(inputs[2])

	f, _, _ := reader.ReadLine()
	prices := strings.Split(string(f), " ")

	costs := make([]int, len(prices))
	for i := 0; i < first; i++ {
		costs[i], _ = strconv.Atoi(prices[i])
	}

	lowR := 99999
	lowL := 99999

	for i := sec + 1; i < first; i++ {
		if costs[i] <= third && costs[i] != 0 {
			lowR = (i - sec) * 10
			break
		}
	}

	if sec > 0 {
		for i := sec - 1; i >= 0; i-- {
			if costs[i] <= third && costs[i] != 0 {
				lowL = (sec - i - 2) * 10
				break
			}
		}
	}

	if lowR >= lowL {
		fmt.Println(lowL)
	} else {
		fmt.Println(lowR)
	}
}


package main

import (
	"fmt"
)

func main() {
	var a, b, c, d, answer1, answer2, j int
	j = 1
	answer1, answer2 = 1000, 1000
	var arr []int
	fmt.Scanf("%d %d %d\n", &a, &b, &c)
	for i := 0; i < a; i++ {
		fmt.Scanf("%d", &d)
		arr = append(arr, d)
	}
	for i := b; i < len(arr); i++ {
		if arr[i] <= c && c != 0 {
			answer1 = i * 10
			break
		}
	}
	for i := b + 1; i >= 0; i-- {
		j++
		if arr[i] <= c && c != 0 {
			answer2 = j * 10
			break
		}
	}
	if answer1 > answer2 {
		fmt.Println(answer2)
	} else {
		fmt.Println(answer1)
	}
}


package main

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

func main() {
	sc := NewScanner()
	N, M, K := sc.NextInt(), sc.NextInt(), sc.NextInt()
	a := sc.NextIntArray()

	M--
	left := -N
	right := N
	for i := M - 1; i >= 0; i-- {
		if a[i] <= K && a[i] != 0 {
			left = i
			break
		}
	}

	for i := M + 1; i < N; i++ {
		if a[i] <= K && a[i] != 0 {
			right = i
			break
		}
	}

	fmt.Println(min(M-left, right-M) * 10)

}

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

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

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

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

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

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

	return mp
}

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


package main

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

func main(){
	reader  := bufio.NewReader(os.Stdin)
	firstLineTemp, _ := reader.ReadString('\n')
	firstLine := strings.TrimRight(firstLineTemp, "\n")
	firstLineSlice := strings.Split(firstLine, " ")
//	n := firstLineSlice[0] //总共的数量
	tmpM, _ := strconv.Atoi(firstLineSlice[1])
	m := tmpM - 1//公主的位置
	k, _ := strconv.Atoi(firstLineSlice[2]) //勇者的金钱

	secondReader  := bufio.NewReader(os.Stdin)
	secondLineTemp, _ := secondReader.ReadString('\n')
	secondLine := strings.TrimRight(secondLineTemp, "\n")
	secondLineSlice := strings.Split(secondLine, " ")

	//开始处理
	distance := 0
	for {
		if (m + distance >= 0 && secondLineSlice[m + distance] != "" && secondLineSlice[m + distance] != "0"){
			//进行判断
			currentHousePrice, _ := strconv.Atoi(secondLineSlice[m + distance])
			if (currentHousePrice <= k){
				break;
			}
		}
		if (m - distance >= 0 && secondLineSlice[m - distance] != "" && secondLineSlice[m - distance] != "0"){
			//再次进行判断
			currentHousePrice, _ := strconv.Atoi(secondLineSlice[m - distance])
			if (currentHousePrice <= k){
				break;
			}
		}
		distance++
	}
	fmt.Println(distance * 10)
	return ;
}


package main

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

func main() {
	var n, p, l int

	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &n)

	for i := 0; i < n; i++ {
			p = l
		fmt.Fscan(input, &l)
	}

	if n == 1 {
		if l == 15 {
			fmt.Println("DOWN")
		} else if l == 0 {

			fmt.Println("UP")
		} else {
			fmt.Println(-1)
		}

	return
}
	if p > l {
		if l == 1 {
			fmt.Println("UP")
			return
		}
		fmt.Println("DOWN")
	} else {
		if l == 15 {
			fmt.Println("DOWN")
			return
		}
		fmt.Println("UP")
	}

}


package main

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

func Sum(num int64) int64 {
	var sum int64
	sum = 0
	for num > 0 {
		sum += num % 10
		num /= 10
	}

	return sum
}

func main() {
	var n, a int64

	fmt.Scanln(&n)

	str := strconv.FormatInt(n/2, 10)
	digits := len(str)
	a = int64(str[0]-48) * int64(math.Pow10(digits-1))
	if digits > 1 {
		a += a - 1
	}

	fmt.Println(Sum(a) + Sum(n-a))
}


package main

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

func main() {
	defer writer.Flush()
	var n int64
	scanln(&n)
	var a,b int64
	if n%2 != 0 {
		a = n / 2
		b = n - a
	} else {
		a = n / 2 - 1
		b = n - a
	}
	var r int64
	for ;a >0;{
		r += a%10
		a /= 10

	}
	for b>0  {
		r += b%10
		b /= 10
	}
	println(r)
}


package main

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

func main() {
	rd := bufio.NewReader(os.Stdin)
	var n int
	var v int
	fmt.Fscanf(rd, "%d", &n)
	fmt.Fscanf(rd, "%d", &v)
	var res int
	var r int
	for i := 0; i < n; i++ {
		re := n - i
		if r < re {
			a := 0
			if v < re-r {
				a = v
			} else {
				a = re - r
			}
			r += a
			res += (i + 1) * a
		} else {
			r--
		}
	}
	fmt.Println(res)
}


package main

import (
	"bufio"
	"os"
	"fmt"
)
var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }
func readLine()(string,error) 			{ return reader.ReadString('\n') }

func main() {
	defer writer.Flush()
	var n, v int
	scanf("%d %d", &n, &v)
	var c int;
	if (n < v) {
		c = n - 1
	} else {
		c = v
		for i := 2; i <= n-v; i++ {
			c +=  i
		}
	}
	printf("%d\n" ,c)
}


package main

import (
	"fmt"
	"sort"
)

const mod = 998244353
const N = 10

var factor = [N + 1][]int{}
var primes = []int64{}

func comb(m int, n int) int64 {
	res := int64(1)
	fnm := make([]int, len(primes))
	copy(fnm, factor[n])
	for i, x := range factor[m] {
		fnm[i] += x
	}
	for w := 1; w <= m; w++ {
		r := int64(1)
		for i, p := range primes {
			for pw := fnm[i] - factor[w][i] - factor[n-w][i] -
				factor[m-w][i]; pw > 0; pw-- {
				r *= p;
			}
			r %= mod
		}
		res += r
	}
	return res % mod
}

func main() {
	abc := []int{0, 0, 0}
	fmt.Scan(&abc[0], &abc[1], &abc[2])
	sort.Ints(abc)
	sieve := [N + 1]bool{true, true}
	for p := range sieve {
		if !sieve[p] {
			primes = append(primes, int64(p))
			for q := p * p; q <= N; q += p {
				sieve[q] = true
			}
		}
	}
	for j := range factor {
		factor[j] = make([]int, len(primes))
	}
	for i, p := range primes {
		for pp := p; pp <= N; pp *= p {
			for j := pp; j <= N; j += pp {
				factor[j][i]++
			}
		}
	}
	a := factor[0]
	for _, b := range factor {
		for i, x := range a {
			b[i] += x
		}
		a = b
	}
	fmt.Println(comb(abc[0], abc[1]) * comb(abc[0], abc[2]) % mod * comb(abc[1], abc[2]) % mod)
}


package main

import (
	"fmt"
	"sort"
)

const mod = 998244353
const N = 5000

var factor = [N + 1][]int{}
var primes = []int64{}

func comb(m int, n int) int64 {
	res := int64(1)
	fnm := make([]int, len(primes))
	copy(fnm, factor[n])
	for i, x := range factor[m] {
		fnm[i] += x
	}
	for w := 1; w <= m; w++ {
		r := int64(1)
		for i, p := range primes {
			for pw := fnm[i] - factor[w][i] - factor[n-w][i] -
				factor[m-w][i]; pw > 0; pw-- {
				r *= p;
			}
			r %= mod
		}
		res += r
	}
	return res % mod
}

func main() {
	abc := []int{0, 0, 0}
	fmt.Scan(&abc[0], &abc[1], &abc[2])
	sort.Ints(abc)
	sieve := [N + 1]bool{true, true}
	for p := range sieve {
		if !sieve[p] {
			primes = append(primes, int64(p))
			for q := p * p; q <= N; q += p {
				sieve[q] = true
			}
		}
	}
	for j := range factor {
		factor[j] = make([]int, len(primes))
	}
	for i, p := range primes {
		for pp := p; pp <= N; pp *= p {
			for j := pp; j <= N; j += pp {
				factor[j][i]++
			}
		}
	}
	a := factor[0]
	for _, b := range factor {
		for i, x := range a {
			b[i] += x
		}
		a = b
	}
	fmt.Println(comb(abc[0], abc[1]) * comb(abc[0], abc[2]) % mod * comb(abc[1], abc[2]) % mod)
}


package main

import (
	"fmt"
	"sort"
)

const mod = 998244353
const N = 5001

var factor = [N][]int{}
var primes = []int64{}

func comb(m int, n int) int64 {
	for i := len(primes) - 1; i >= 0; i-- {
		if primes[i] <= int64(n) {
			primes = primes[:i+1]
			break
		}
	}
	res := int64(1)
	fnm := make([]int, len(factor[0]))
	copy(fnm, factor[n])
	for i, x := range factor[m] {
		fnm[i] += x
	}
	for w := 1; w <= m; w++ {
		fw, fmw, fnw, r := factor[w], factor[m-w], factor[n-w], int64(1)
		for i, p := range primes {
			for pw := fnm[i] - fw[i] - fmw[i] - fnw[i]; pw > 0; pw >>= 1 {
				if pw&1 == 1 {
					r = r * p % mod
				}
				p = p * p % mod
			}
		}
		res += r
	}
	return res % mod
}

func main() {
	abc := []int{0, 0, 0}
	fmt.Scan(&abc[0], &abc[1], &abc[2])
	sort.Ints(abc)
	a, b, c := abc[0], abc[1], abc[2]
	sieve := [N]bool{true, true}
	for p := range sieve {
		if !sieve[p] {
			primes = append(primes, int64(p))
			for q := p * p; q < N; q += p {
				sieve[q] = true
			}
		}
	}
	for j := range factor {
		factor[j] = make([]int, len(primes))
	}
	for i, p := range primes {
		for pp := p; pp < N; pp *= p {
			for j := pp; j < N; j += pp {
				factor[j][i]++
			}
		}
	}
	cur := factor[2]
	for _, nxt := range factor[3:c+1] {
		for i, x := range cur {
			nxt[i] += x
		}
		cur = nxt
	}
	fmt.Println(comb(b, c) * comb(a, c) % mod * comb(a, b) % mod)
}


package main

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

func main() {
	var input string

	fmt.Scanln(&input)
	num, _ := strconv.Atoi(input)

	strings.Split("", input)
	var decimal string = string(input[len(input)-2])
	var unidad string = string(input[len(input)-1])

	//fmt.Println("Decimal: ", decimal)
	//fmt.Println("Unidad: ", unidad)

	if num % 4 == 0 || num % 7 == 0 || evalDecimal(decimal, unidad){
		fmt.Println("YES")
		os.Exit(0)
	}

	fmt.Println("NO")
}

func evalDecimal(d string, u string) bool{
	if d == "4" || d == "7"{
		//fmt.Println("Decimal es 4 o 7")
		if u == "4" || u == "7" {
			//fmt.Println("Unidad es 4 o 7")
			return true
		}
	}

	return false
}


package main

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

func main() {
	if len(os.Args) < 2 {
		fmt.Println(-1)
		return
	}
	cy, err := strconv.Atoi(os.Args[1])
	if err != nil {
		fmt.Println(-2)
		return
	}
	cc := cy / 10
	cp := cy
	i := 0
	for cc > 0 {
		cp = cc
		cc = cc / 10
		i++
	}
	fmt.Println((cp+1)*(int(math.Pow10(i))) - cy)
}


package main

import (
  "fmt"
  "strings"
)

func main() {
  var s string
  fmt.Scan(&s)
  count := strings.Count(s[1:], "0")
  if count == len(s) - 1 {
    fmt.Println(s)
    return
  }
  if s[0:1] != "9" {
    c := s[0] + 1
    res := string(c)
    for i := 0; i < len(s) - 1; i++ {
      res += "0"
    }
    fmt.Println(res)
    return
  }
  res := "1"
  for i := 0; i < len(s); i++ {
    res += "0"
  }
  fmt.Println(res)
}


package main

import (
	"fmt"
	"strconv"
)

func main() {
	max := 10e9
	min := float64(1)
	step := float64(1)
	var n string
	_, _ = fmt.Scanln(&n)
	current, _ := strconv.ParseFloat(n, 64)

	next := min
	size := min
	for next < max {
		next += step
		if len(fmt.Sprintf("%f", next)) != len(fmt.Sprintf("%f", size)) {
			size = next
			step *= 10
		}

		if next - current > 0 {
			fmt.Println(next - current)
			break
		}
	}
}


package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanInt() int {
	sc.Scan(); a,_ := strconv.Atoi(sc.Text()); return a
}

func scanInt64() int64 {
	sc.Scan(); a,_ := strconv.ParseInt(sc.Text(),10,64); return a
}

func scanFloat64() float64 {
	sc.Scan(); a,_ := strconv.ParseFloat(sc.Text(),64); return a
}

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

func scanString() string {
	sc.Scan(); return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e); if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr); wr.Flush()
}

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

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	x0 := scanInt64()
	y0 := scanInt64()
	ax := scanInt64()
	ay := scanInt64()
	bx := scanInt64()
	by :=scanInt64()
	xs := scanInt64()
	ys := scanInt64()
	t := scanInt64()

	x := []int64{x0}
	y := []int64{y0}

	const mat = 1 << 60

	for x[len(x)-1]*ax+bx <= mat && y[len(y)-1]*ay+by < mat {
		next := len(x)-1
		x = append(x, ax*x[next]+bx)
		y = append(y, ay*y[next]+by)
	}

	ans := 0

	for i := 0; i < len(x); i++ {
		for j := i; j < len(x); j++ {
			ltor := x[j]-x[i]+y[j]-y[i]
			tol := abs(xs-x[i])+abs(ys-y[i])
			tor := abs(xs-x[j])+abs(ys-y[j])

			if t >= ltor+tor || t >= tol+ltor {
				// fmt.Println(ltor,tol,ltor+tor,j,i)
				ans = max(ans, j-i+1)
			}
		}
	}

	fmt.Println(ans)
	// fmt.Println(x)

}


package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanInt() int {
	sc.Scan(); a,_ := strconv.Atoi(sc.Text()); return a
}

func scanInt64() int64 {
	sc.Scan(); a,_ := strconv.ParseInt(sc.Text(),10,64); return a
}

func scanFloat64() float64 {
	sc.Scan(); a,_ := strconv.ParseFloat(sc.Text(),64); return a
}

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

func scanString() string {
	sc.Scan(); return sc.Text()
}

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e); if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr); wr.Flush()
}

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

//•*¨*•.¸¸♪Main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1000000)

	x0 := scanInt64()
	y0 := scanInt64()
	ax := scanInt64()
	ay := scanInt64()
	bx := scanInt64()
	by :=scanInt64()
	xs := scanInt64()
	ys := scanInt64()
	t := scanInt64()

	x := []int64{x0}
	y := []int64{y0}

	const mat = 100000000000000000

	for x[len(x)-1] < mat || y[len(y)-1] < mat {
		next := len(x)-1
		x = append(x, ax*x[next]+bx)
		y = append(y, ay*y[next]+by)
	}

	to := int64(0)
	ans := 0

	done := make([]bool, len(x))

	for {
		mi := int64(1 << 63 -1)
		next := -1
		for i := 0; i < len(x); i++ {
			if done[i] {
				continue
			}

			if mi > abs(xs-x[i])+abs(ys-y[i]) {
				next = i
				mi = abs(xs-x[i])+abs(ys-y[i])
			}
		}

		if next == -1 {
			break
		}

		if to+mi > t {
			break
		}

		ans++
		to += mi
		xs = x[next]
		ys = y[next]
		done[next] = true
	}

	fmt.Println(ans)

}


package main

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

const M int = 998244353
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 sp(x, y int) int {
  var mul, res int = x, 1
  for y != 0 {
    if y % 2 != 0 {
      res = (res * mul) % M
    }
    mul = (mul * mul) % M
    y /= 2
  }
  return res
}

func main() {
  defer writer.Flush()
  var n, m, k int
  scanf("%d%d%d", &n, &m, &k)
  printf("%d %d %d\n", n, m, k);
  fac := make([]int, n+1)
  fac[0] = 1
  for i := 1; i <= n; i += 1 {
    fac[i] = (fac[i-1] * i) % M
  }

  sol := fac[n-1]
  sol = (sol * sp(fac[n-1-k], M-2)) % M
  sol = (sol * sp(fac[k], M-2)) % M
  sol = (sol * sp(m-1, k)) % M
  sol = (sol * m) % M
  printf("%d\n", sol)
}


package main

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

const fn1 = "What are you doing while sending \""
const fn2 = "\"? Are you busy? Will you send \""
const fn3 = "\"?"
const f1 = "What are you doing at the end of the world? Are you busy? Will you save us?"

func solve() {
	tab := make([]uint64, 65)
	tab[0] = uint64(len(f1))
	for i := 1; i < len(tab); i++ {
		tab[i] = uint64(len(fn1)+len(fn2)+len(fn3)) +
			tab[i-1] + tab[i-1]
	}
	//	fmt.Println(tab)

	q := readInt()
	for i := 0; i < q; i++ {
		n := readInt()
		k := readUInt64() - 1

		for n >= len(tab) && k >= uint64(len(fn1)) {
			n -= 1
			k -= uint64(len(fn1))
		}

		fmt.Print(string(get_str(tab, n, k)))
	}
}

func get_str(tab []uint64, n int, k uint64) byte {
	if n == 0 {
		return f1[k]
	}

	if k < uint64(len(fn1)) {
		return fn1[k]
	}
	k -= uint64(len(fn1))

	if k < tab[n-1] {
		return get_str(tab, n-1, k)
	}
	k -= tab[n-1]

	if k < uint64(len(fn2)) {
		return fn2[k]
	}
	k -= uint64(len(fn2))

	if k < tab[n-1] {
		return get_str(tab, n-1, k)
	}
	k -= tab[n-1]

	if k < uint64(len(fn3)) {
		return fn3[k]
	}

	return '.'
}

var scanner *bufio.Scanner

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

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

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

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

func readUInt64() uint64 {
	v, _ := strconv.ParseUint(readString(), 10, 64)
	return v
}


package main

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

var reader = bufio.NewReader(os.Stdin)
var scanner = bufio.NewScanner(reader)
var lens [200000]int64

const (
	f0  = "What are you doing at the end of the world? Are you busy? Will you save us?"
	fi0 = "What are you doing while sending \""
	fi1 = "\"? Are you busy? Will you send \""
	fi2 = "\"?"
)

func f(n int, k int64) byte {
	for {
		if n == 0 {
			if k < int64(len(f0)) {
				return f0[k]
			}
			return '.'
		}

		if k < int64(len(fi0)) {
			return fi0[k]
		}
		k -= int64(len(fi0))

		nxtlen := lens[n-1]
		//fmt.Println("len ", n-1, nxtlen)
		if k < nxtlen {
			n--
			continue
		}
		k -= nxtlen

		if k < int64(len(fi1)) {
			return fi1[k]
		}
		k -= int64(len(fi1))

		if k < nxtlen {
			n--
			continue
		}
		k -= nxtlen

		if k < int64(len(fi2)) {
			return fi2[k]
		}
		return '.'
	}
}

func readint() int {
	scanner.Scan()
	i, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	return int(i)
}

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

func main() {
	scanner.Split(bufio.ScanWords)

	lens[0] = int64(len(f0))
	for i := 1; i < cap(lens); i++ {
		lens[i] = int64(len(fi0)+len(fi1)+len(fi2)) + 2*lens[i-1]
	}

	q := readint()

	for i := 0; i < q; i++ {
		n, k := readint(), readint64()-1
		fmt.Print(string(f(n, k)))
	}
}


package main

import (
    "fmt"
    "math"
)

func main() {
    var k,a,b,v int
    fmt.Scan(&k,&a,&b,&v)
    n := int(math.Ceil(float64(a)/float64(v)))
    ans := b/(k-1)
    n -= (ans*k)
    if (b%(k-1) != 0) {
        ans++
        n -= (b%(k-1))+1
    }
    if (n >= 0) { ans += n }
    fmt.Println(ans)
}


// 402A-mic_rizal
package main

import (
    "fmt"
)

func main() {
    var k, a, b, n, hasil int
    fmt.Scan(&k, &a, &b, &n)
    for a > 0 {
        if b >= k-1 {
            b -= (k - 1)
            a -= n * k
            hasil++
        } else if b == 1 {
            a -= n * (b + 1)
            hasil++
            b = 0
        } else {
            a -= n
            hasil++
        }
    }
    fmt.Println(hasil)
}


package main

import "fmt"

func main () {
	var a, b, c int32
	result := 1
	fmt.Scan(&a);
	fmt.Scan(&b);
	fmt.Scan(&c);
	if (a%c == 0) {
		result *= a/c
	} else {
		result *= (a/c)+1
	}
	if (b%c == 0) {
		result *= b/c
	} else {
		result *= (b/c)+1
	}
	fmt.Println(result)
}


import (
	"fmt"
)

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


package main
import "fmt"

func main(){
    var n,m,a int
    fmt.Scan(&n,&m,&a)
    var tiles1,tiles2 uint = n/a, m/a

    if(n%a!=0) {tiles1++}
    if(m%a!=0) {tiles2++}

    var hasil uint  = tiles1 * tiles2
    fmt.Println(hasil)
}


package main

import "fmt"

func main() {
	var n, m, a int64
	fmt.Scanf("%d%d%d", &n, &m, &a)
	var inN, inM int64 = n / a, m / a
	var count int64 = inN * inM
	var add bool = true
	if n % a == 0 {
		count = n / a
	} else {
		count = n / a + 1
	}
	if m % a == 0 {
		count *= m / a
	} else {
		count *= m / a + 1
	}
	fmt.Println(count)
}


package main

import "fmt"

func main() {
	var n, m, a, count int
	fmt.Scanf("%d%d%d", &n, &m, &a)
	var nn, mm int = n, m
	for {
		if nn < n {
			nn += n
			count++
		}
		if mm < m {
			mm += m
			count++
		}
	}
	fmt.Println(count)
}


package main

import (
	"fmt"
)

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

	var s int
	y:=n/a
	if float64(n)/float64(a)>float64(y){
	y=y+1
	}

	x:=m/a
	if float64(m)/float64(a)>float64(x){
	x=x+1
	}

	s=y*x
	fmt.Println(s)
}


package main

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

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

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

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

	if a < b {
		println(0)
	} else if a == b {
		println("infinity")
	} else {
		count := 0
		// for i := 1; i <= a; i++ {
		// 	if a % i == b {
		// 		println(i)
		// 		count++
		// 	}
		// }

		mod := a - b
		i := 1

		for ; i * i < mod; i++ {
			if mod % i == 0 {
				if mod / i > b {
					count++
				}

				if i > b {
					count++
				}
			}
		}

		if i * i == mod {
			count++
		}

		println(count)
	}
}

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

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

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

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


package main

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

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

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

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

	if a < b {
		println(0)
	} else if a == b {
		println("infinity")
	} else {
		count := 0
		for i := 1; i <= a; i++ {
			if a % i == b {
				count++
			}
		}

		println(count)
	}
}

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

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

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

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


package main

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

func main(){
	var n, m, k int
	var a [50]int
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.Atoi(r.Text())
	r.Scan()
	m, _ = strconv.Atoi(r.Text())
	r.Scan()
	k, _ = strconv.Atoi(r.Text())
	sum := 0
	x := 0
	i := 0
	for i:=0; i<n; i++ {
		r.Scan()
		x, _ = strconv.Atoi(r.Text())
		a[x-1] += 1
	}
	for m>k {
		for i:=49; i>=0; i-- {
			if a[i] > 0 {
				k += i;
				a[i] -= 1
				sum += 1
				break
			}
		}
		if i<0 {
			w.WriteString("-1")
			return
		}
	}
	w.WriteString(strconv.Itoa(sum)+"\n")
	w.Flush()
}


package main

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

func ReadNumber(in *bufio.Reader) int64 {
	line, _ := in.ReadString('\n')
	num, _ := strconv.ParseInt(strings.TrimSpace(line[:len(line)-1]), 10, 64)
	return num
}

func ReadArray(in *bufio.Reader) []int64 {
	line, _ := in.ReadString('\n')
	strs := strings.Split(strings.TrimSpace(line[:len(line)-1]), " ")
	nums := make([]int64, len(strs))
	for i, str := range strs {
		nums[i], _ = strconv.ParseInt(str, 10, 64)
	}
	return nums
}

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

func main() {
	in := bufio.NewReader(os.Stdin)
	nums := ReadArray(in)
	max_val := nums[0] - int64(math.Ceil((1.0 + math.Sqrt(float64(1 + 8 * nums[1]))) / 2))
	fmt.Printf("%d %d", max(nums[0] - nums[1]*2, 0), max_val)
}


package main

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

func solve() {
	n := readInt64()
	m := readInt64()
	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
}


// 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)
		} 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 main() {
	sc := NewScanner()
	N, M := sc.NextInt(), sc.NextInt()
	if M == 0 {
		fmt.Println(N, N)
		return
	}
	fmt.Println(N-2*M, N-(M+1))
}

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

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

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

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

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

	return mp
}

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


package main

import (
	"fmt"
)

var rotate = [][]int{
	{5, 6, 17, 18, 21, 22, 13, 14},
	{7, 8, 19, 20, 23, 24, 15, 16},
	{3, 4, 19, 20, 23, 24, 15, 16},
	{1, 2, 18, 20, 12, 11, 15, 13},
	{2, 4, 6, 8, 10, 12, 23, 21},
	{1, 3, 5, 7, 9, 11, 24, 22}}

func main() {
	var cube = make([]int, 24)
	for i := 0; i < 24; i++ {
		fmt.Scanf("%d", &cube[i])
	}
	//check already solved
	if check_solved(cube) {
		fmt.Println("YES")
		return
	}
	//rotate
	for i := 0; i < 6; i++ {
		//90-angle
		if check_rotate(cube, rotate[i], move_left2(rotate[i])) {
			fmt.Println("YES")
			return
		}
		//another 90-angle
		if check_rotate(cube, rotate[i], move_right2(rotate[i])) {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}

func move_left2(in []int) []int {
	ret := append(in[2:len(in)], in[0:2]...)
	return ret
}

func move_right2(in []int) []int {
	ret := append(in[len(in)-2:len(in)], in[0:len(in)-2]...)
	return ret
}

func check_rotate(cube, rotate, moved []int) bool {
	after := make([]int, len(cube))
	copy(after, cube)
	for i := 0; i < 8; i++ {
		after[moved[i]-1] = cube[rotate[i]-1]
	}
	return check_solved(after)
}

func check_solved(cube []int) bool {
	for i := 0; i < 6; i++ {
		if cube[i*4] != cube[i*4+1] || cube[i*4] != cube[i*4+2] || cube[i*4] != cube[i*4+3] {
			return false
		}
	}
	return true
}


package main

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

func solve() {
	var data [6][2][2]int
	for i := 0; i < 20; i++ {
		data[i/4][(i%4)/2][i%2] = readInt()
	}
	data[5][1][1] = readInt()
	data[5][1][0] = readInt()
	data[5][0][1] = readInt()
	data[5][0][0] = readInt()

	var sides []int
	if isSideFull(&data, 3) && isSideFull(&data, 4) {
		sides = []int{0, 1, 2, 5}
	} else if isSideFull(&data, 0) && isSideFull(&data, 2) {
		sides = []int{1, 4, 5, 3}
	} else if isSideFull(&data, 1) && isSideFull(&data, 5) {
		sides = []int{0, 4, 2, 3}
	} else {
		fmt.Println("NO")
		return
	}
	rotate0(&data, 1, sides)
	if isSolved(&data) {
		fmt.Println("YES")
		return
	}
	rotate0(&data, -1, sides)
	rotate0(&data, -1, sides)
	if isSolved(&data) {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

func isSolved(data *[6][2][2]int) bool {
	for i := 0; i < 6; i++ {
		if !isSideFull(data, i) {
			return false
		}
	}
	return true
}

func rotate0(data *[6][2][2]int, dir int, sides []int) {
	var nums [4][2]int
	for i := 0; i < len(sides); i++ {
		side := sides[i]
		for j := 0; j < 2; j++ {
			nums[i][j] = data[side][j][0]
		}
	}
	for i := 0; i < len(sides); i++ {
		side := sides[(i+dir+4)%4]
		for j := 0; j < 2; j++ {
			data[side][j][0] = nums[i][j]
		}
	}
}

func isSideFull(data *[6][2][2]int, side int) bool {
	color := data[side][0][0]
	for i := 0; i < 2; i++ {
		for j := 0; j < 2; j++ {
			if data[side][i][j] != color {
				return false
			}
		}
	}
	return true
}

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
}

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

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

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

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


package main

import (
	"fmt"
)

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

	m := a[0][0]
	n := a[0][1]
	for j := 0; j < 2; j++ {
		s := a[1][j]
		t := a[1][(j+1)%2]
		for k := 0; k < 2; k++ {
			u := a[2][k]
			v := a[2][(k+1)%2]

			if (s+u <= m && max(t, v) <= n) || (t+v <= m && max(s, u) <= m) {
				fmt.Println("YES")
				return
			}
		}
	}

	fmt.Println("NO")
}

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


package main

import (
	"fmt"
	"os"
)

func can_place_in(a1, b1, a2, b2 int) bool {
	if a1 >= a2 && b1 >= b2 {
		return true
	} else if a1 >= b2 && b1 >= a2 {
		return true
	}
	return false
}

func main() {
	// f, _ := os.Open("input.txt")
	f := os.Stdin
	var a1, b1, a2, b2, a3, b3 int
	fmt.Fscanf(f, "%d %d\n%d %d\n%d %d", &a1, &b1, &a2, &b2, &a3, &b3)
	// puts B into A 2 times
	var res bool
	res = false
	if b1 >= b2 && (can_place_in(a1-a2, b1, a3, b3) || can_place_in(a1, b1-b2, a3, b3)) {
		res = true
	}
	var tmp int
	tmp = a2
	a2 = b2
	b2 = tmp
	if b1 >= b2 && (can_place_in(a1-a2, b1, a3, b3) || can_place_in(a1, b1-b2, a3, b3)) {
		res = true
	}

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


package main

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

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

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

	n, m := nextInt(), nextInt()

	a := make([]int, n)
	permutations := make([][]int, 0, 10)
	maxP := 0
	minP := 0

	for i := range a {
		a[i] = i+1
	}

	for i := n-1; i > 0; {
		minP = sumMin(a)
		if maxP < minP {
			maxP = minP
			permutations = make([][]int, 0, 10)
		}

		if maxP <= minP {
			b := make([]int, n)
			copy(b, a)
			permutations = append(permutations, b)
		}
		// println(a, minP, maxP, permutations)

		i = n-1

		for ; i > 0; i-- {
			if a[i] > a[i-1] {
				sort.Ints(a[i:])

				for j := i; j < n; j++ {
					if a[i-1] < a[j] {
						a[i-1], a[j] = a[j], a[i-1]
						break
					}
				}

				break
			}
		}

	}

	for i := range a {
		printf("%d ", permutations[m-1][i])
	}

	println()
}

func sumMin(a []int) int {
	sum := 0

	for i := range a {
		for j := i; j < len(a); j++ {
			sum += min(a[i:j+1]...)
		}
	}

	return sum
}

func min(a ...int) int {
	min := math.MaxInt32

	if a != nil {
		for i := range a {
			if min > a[i] {
				min = a[i]
			}
		}
	}

	return min
}

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"
	"strconv"
	"math"
	"sort"
)

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

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

	n, m := nextInt(), nextInt()

	a := make([]int, n)
	permutations := make([][]int, 0, 10)
	maxP := 0
	minP := 0

	if n == 1 {
		println(1)
		return
	}

	for i := range a {
		a[i] = i+1
	}

	for i := n-1; i > 0; {
		minP = sumMin(a)
		if maxP < minP {
			maxP = minP
			permutations = make([][]int, 0, 10)
		}

		if maxP <= minP {
			b := make([]int, n)
			copy(b, a)
			permutations = append(permutations, b)
		}
		println(a, minP, maxP, permutations)

		i = n-1

		for ; i > 0; i-- {
			if a[i] > a[i-1] {
				sort.Ints(a[i:])

				for j := i; j < n; j++ {
					if a[i-1] < a[j] {
						a[i-1], a[j] = a[j], a[i-1]
						break
					}
				}

				break
			}
		}

	}

	println(a, permutations)
	for i := range a {
		printf("%d ", permutations[m-1][i])
	}

	println()
}

func sumMin(a []int) int {
	sum := 0

	for i := range a {
		for j := i; j < len(a); j++ {
			sum += min(a[i:j+1]...)
		}
	}

	return sum
}

func min(a ...int) int {
	min := math.MaxInt32

	if a != nil {
		for i := range a {
			if min > a[i] {
				min = a[i]
			}
		}
	}

	return min
}

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 (
    "strconv"
    "bufio"
    "os"
    "fmt"
)
// var file, _ = os.Open("input.txt")
// var outfile, _ = os.Create("output.txt")
// var in = bufio.NewScanner(file)
// var out = bufio.NewWriter(outfile)
var in = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

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

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

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

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

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

func reverse(a []int, i int, j int) {
    for i < j {
        swap(a, i, j)
        i++
        j--
    }
}

func nextPermutation(a []int) bool {
    k := len(a) - 2
    for k > -1 && a[k] > a[k + 1] { k-- }
    if k == -1 { return false }
    l := len(a) - 1
    for k < l && a[k] > a[l] { l-- }
    swap(a, k, l)
    reverse(a, k + 1, len(a) - 1)
    return true
}

func f(a []int) int {
    n := len(a)
    sum := 0
    for i := 0; i < n; i++ {
        for j := i; j < n; j++ {
            min := -1;
            for k := i; k <= j; k++ {
                if min == -1 || min > a[k] {
                    min = a[k]
                }
            }
            sum += min
        }
    }
    return sum
}

func main() {
    defer out.Flush()
    in.Split(bufio.ScanWords)
    n := nextInt()
    m := nextInt()
    a := make([]int, n)
    for i := 0; i < n; i++ {
        a[i] = i + 1
    }
    ms := f(a)
    for nextPermutation(a) {
        sum := f(a)
        if ms < sum { ms = sum }
    }
    for i := 0; i < n; i++ {
        a[i] = i + 1
    }
    if ms == f(a) {
        m--
    }
    for nextPermutation(a) {
        sum := f(a)
        if ms == sum {
            m--
            if m == 0 {
                for i := 0; i < n; i++ {
                    fmt.Fprint(out, strconv.Itoa(a[i]) + " ")
                }
                fmt.Fprintln(out)
                return
            }
        }
    }
}


package main

import "fmt"

// MAX32 is
var MAX32 int32 = 2147483647

// MIN32 is
var MIN32 int32 = -2147483648

// MAX64 is
var MAX64 int64 = 9223372036854775807

// MIN64 is
var MIN64 int64 = -9223372036854775808

func ri32(pn *int32) {
	fmt.Scanf("%d", pn)
}
func rai32(nums int32) []int32 {
	re := make([]int32, nums+1, nums+1)
	for idx := int32(1); idx != nums+1; idx++ {
		ri32(&re[idx])
	}
	return re
}

func ri64(pn *int64) {
	fmt.Scanf("%d", pn)
}
func rai64(nums int64) []int64 {
	re := make([]int64, nums+1, nums+1)
	for idx := int64(1); idx != nums+1; idx++ {
		ri64(&re[idx])
	}
	return re
}

func rstr(ps *string) {
	fmt.Scanf("%s", ps)
}
func rastr(nums int32) []string {
	re := make([]string, nums+1, nums+1)
	for idx := int32(1); idx != nums+1; idx++ {
		rstr(&re[idx])
	}
	return re
}

// OUT is
var OUT string

func oi32(i int32) {
	OUT += fmt.Sprintf("%d", i)
}
func oi64(i int64) {
	OUT += fmt.Sprintf("%d", i)
}

func oi32c(i int32, c string) {
	OUT += fmt.Sprintf("%d%s", i, c)
}
func oi64c(i int64, c string) {
	OUT += fmt.Sprintf("%d%s", i, c)
}

func oi32n(i int32) {
	oi32c(i, "\n")
}
func oi64n(i int64) {
	oi64c(i, "\n")
}

func oi32space(i int32) {
	oi32c(i, " ")
}
func oi64space(i int64) {
	oi64c(i, " ")
}

func ostring(s string) {
	OUT += s
}
func ob(b byte) {
	OUT += fmt.Sprintf("%c", b)
}

func p() {
	fmt.Print(OUT)
}

// 2 3 5 6
var N []int64

func min3(a, b, c int64) int64 {
	abxiao := int64(0)
	if N[a] <= N[b] {
		abxiao = N[a]
	}
	abxiao = N[b]
	if abxiao <= N[c] {
		return abxiao
	}
	return N[c]
}
func main() {
	N = rai64(4)
	a := min3(1, 3, 4)
	var count int64
	count += (a * 256)
	sheng2 := N[1] - a
	if sheng2 <= N[2] {
		count += (sheng2 * 32)
		oi64n(count)
		p()
		return
	}
	count += (N[2] * 32)
	oi64n(count)
	p()
}


package main

import (
	"fmt"
	"math"
)

func main() {
	var k2, k3, k5, k6 float64

	fmt.Scan(&k2, &k3, &k5, &k6)
	n256 := math.Min(k2, math.Min(k5, k6))
	n32 := math.Min(k3, k2-n256)
	fmt.Println(n256*256 + n32*32)
}


package main

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

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

	scanner.Scan()
	start := strings.Split(scanner.Text(), " ")
	x1, _ := strconv.Atoi(start[0])
	y1, _ := strconv.Atoi(start[1])

	scanner.Scan()
	stop := strings.Split(scanner.Text(), " ")
	x2, _ := strconv.Atoi(stop[0])
	y2, _ := strconv.Atoi(stop[1])

	count := 0
	for x1 != x2 || y1 != y2 {
		if x1-x2 < 0 {
			x1++
		} else if x1-x2 > 0 {
			x1--
		}

		if y1-y2 < 0 {
			y1++
		} else if y1-y2 > 0 {
			y1--
		}
		count++
	}
	fmt.Print(count)
}


package main

import (
	"fmt"
)

func lsb(x int64) int64 {
	return x & -x
}

func main() {
	var l, r int64
	fmt.Scan(&l, &r)

	if l == r {
		fmt.Println(0)
		return
	}

	var msb int64
	x := r
	for x > 0 {
		msb = lsb(x)
		x -= msb
	}

	fmt.Println(2*r - 1) // might as well try it
}


package main

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

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

	var l, r int64
	Fscan(in, &l, &r)
	if l == r {
		Fprint(out, 0)
		return
	}
	for m := l ^ r; ; m += m & -m {
		if m&(m-1) == 0 {
			Fprint(out, m-1)
			return
		}
	}
}

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


package main

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

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

	var l, r int64
	Fscan(in, &l, &r)
	if l == r {
		Fprint(out, 0)
		return
	}
	for m := l ^ r; ; m += m&-m - 1 {
		if m&(m+1) == 0 {
			Fprint(out, m)
			return
		}
	}
}

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


package main

import (
	"fmt"
	"sort"
	"strconv"
)

type T struct {
	s string
	v int
}

func comp(h1, h2 T) int {
	if h1.s != h2.s {
		return 2
	}
	if h2.v-h1.v < 3 {
		return 1
	}
	return 2
}

func parse(h string) T {
	s := h[1:]
	v, _ := strconv.Atoi(h[:1])
	return T{s: s, v: v}
}
func main() {
	var a, b, c string
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	h := []T{parse(a), parse(b), parse(c)}
	sort.Slice(h, func(i, j int) bool {
		return h[i].v < h[j].v
	})

	if h[0].s == h[1].s && h[1].s == h[2].s {
		if (h[2].v)-(h[1].v) == 0 && (h[1].v)-(h[0].v) == 0 {
			fmt.Println(0)
			return
		}
		if (h[2].v)-(h[1].v) == 1 && (h[1].v)-(h[0].v) == 1 {
			fmt.Println(0)
			return
		}
		if (h[2].v)-(h[1].v) < 3 && (h[1].v)-(h[0].v) < 3 {
			fmt.Println(1)
			return
		}
		fmt.Println(2)
		return
	}
	r := comp(h[0], h[1])
	if r == 1 {
		fmt.Println(1)
		return
	}
	r = comp(h[1], h[2])
	if r == 1 {
		fmt.Println(1)
		return
	}
	fmt.Println(comp(h[0], h[2]))
	// ints := make([]int, n)
	// var c int
	// for c < n {
	// 	fmt.Scan(&a)
	// 	ints[c] = a
	// 	c++
	// }
	// sort.Ints(ints)
	// cyc, err := circle(ints, len(ints))
	// // fmt.Println("Ints:   ", ints)
	// if err != nil {
	// 	fmt.Println("NO")
	// 	return
	// }
	// if !valid(cyc) {
	// 	fmt.Println("NO")
	// 	return
	// }
	// fmt.Println("YES")
	// // fmt.Println("Cyc: ", cyc)
	// for i := 0; i < len(cyc)-1; i++ {
	// 	fmt.Printf("%v ", cyc[i])
	// }
	// fmt.Printf("%v\n", cyc[len(cyc)-1])

}