package main
import (
	"fmt"
)
func main() {
	//var a,b,c,d int
	var s1,s2,t1,t2 int
	fmt.Scanf("%d:%d\n",&s1,&s2)
	fmt.Scanf("%d:%d",&t1,&t2)
	//fmt.Println(s1,s2,t1,t2)
	s:=s1*60+s2
	s-=t2
	s-=t1*60
	if s<0 {
		s+=24*60
	}
	fmt.Printf("%02d:%02d\n",s/60,s%60)

}


package main

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

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

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

	_ = nextInt()
	s := next()
	var outsideWords []string

	for i := strings.Index(s, "("); i >= 0; i = strings.Index(s, "(") {
		j := strings.Index(s, ")")
		outsideWords = append(outsideWords, splitWords(s[i+1:j], '_')...)
		s = s[:i] + "_" + s[j+1:]
	}

	println(maxLength(splitWords(s, '_')), len(outsideWords))

}

func splitWords(s string, c rune) []string {
	return strings.FieldsFunc(s, func(c rune) bool { return c == '_' })
}

func maxLength(s []string) int {
	l := 0

	for i := range s {
		if len(s[i]) > l {
			l = len(s[i])
		}
	}

	return l
}

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

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

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

	var n int
	var s string
	fmt.Fscanf(bufin, "%d\n", &n)
	fmt.Fscanf(bufin, "%s\n", &s)

	inside := false
	l := 0

	longestOutside := 0
	countInside := 0

	s = "_" + s + "_"
	n = len(s)

	for i := 0; i < n; i++ {
		c := s[i]
		if (c == '_') || (c == '(') || (c == ')') {
			if l > 0 {
				if inside {
					countInside++
				} else {
					if longestOutside < l {
						longestOutside = l
					}
				}
				l = 0
			}
		} else {
			l++
		}
		if c == '(' {
			inside = true
		} else if c == ')' {
			inside = false
		}
	}

	fmt.Fprintf(bufout, "%d %d\n", longestOutside, countInside)
}


package main

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

func main() {
	fsc := NewFastScanner()
	n := fsc.NextInt()
	text := fsc.Next()
	var flag, maxLength, inLength, outLength, count int
	for i := 0; i <= n; i++ {
		if i == n {
			if maxLength < outLength {
				maxLength = outLength
			}
			break
		}
		if text[i] == '(' {
			if maxLength < outLength {
				maxLength = outLength
			}
			outLength = 0
			flag = 1
		} else if text[i] == ')' {
			if inLength != 0 {
				count++
			}
			inLength = 0
			flag = 0
		} else if text[i] == '_' {
			if inLength != 0 {
				count++
			}
			inLength = 0
			if outLength != 0 {
				if maxLength < outLength {
					maxLength = outLength
				}
			}
			outLength = 0
		} else if flag == 0 {
			outLength++
		} else if flag == 1 {
			inLength++
		}
	}

	fmt.Println(maxLength, count)
}

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

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 2028)
	return &FastScanner{r: rdr}
}

func (s *FastScanner) Next() string {
	s.Pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}

func (s *FastScanner) NextInt() int {
	val, err := strconv.Atoi(s.Next())
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) NextInt64() int64 {
	val, err := strconv.ParseInt(s.Next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return val
}
func (s *FastScanner) Pre() {
	if s.p >= len(s.buf) {
		s.ReadLine()
		s.p = 0
	}
}

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


package main

import (
	"fmt"
)

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

func main() {
	var  (
		n int
		str string
	)

	fmt.Scanln(&n)
	fmt.Scanln(&str)

	i := 0;
	s_words := 0
	s_len := 0
	w_len := 0
	w_max := 0
	for i < n {
		if str[i] == '(' {
			i++

			for  i < n && str[i] != ')' {
				if str[i] != '_' {
					s_len++
				} else {
					if s_len > 0 {
						s_words++
					}
					s_len = 0
				}
				i++

			}
			i++
			if s_len > 0 {
				s_words++
			}
			s_len = 0
			continue
		}

		for i < n && str[i] != '(' {
				if str[i] != '_' {
					w_len++
				} else {
					if w_len > 0 {
						w_max = max(w_max, w_len)
					}
					w_len = 0
				}
				i++
			}

		if w_len > 0 {
			w_max = max(w_max, w_len)
		}
		w_len = 0
	}

	fmt.Println(w_max, s_words)
}


package main;

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

func mysplit(line string) []string {
    from := 0
    output := make([]string, 0, 10)
    for i, c := range line {
        if c=='(' || c==')' {
            output = append(output, line[from:i])
            from = i+1
        }
    }
    if from<len(line) {
        output = append(output, line[from:len(line)])
    }

    return output
}

func groups(line string) ([]string, []string) {
    outside, inside := make([]string, 0, 10), make([]string, 0, 10)
    parts := mysplit(line)
    out := true //line[0]!='('
    for _, p := range parts {
        if out {
            outside = append(outside, strings.Split(p, "_") ...)
        } else {
            inside = append(inside, strings.Split(p, "_") ...)
        }
        out = !out
    }

    return outside, inside

}

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

    scanner.Scan() // number
    scanner.Scan()
    outside, inside := groups(scanner.Text())

    fmt.Fprintf(os.Stderr, "%v - %v \n", outside, inside)

    longestOutside := 0
    for _, w := range outside {
        if len(w) > longestOutside {
            longestOutside = len(w)
        }
    }

    inParenthesis := 0
    for _, w := range inside {
        if len(w) > 0 {
            inParenthesis++
        }
    }

    fmt.Println(longestOutside, inParenthesis)
}


package main

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

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

type res struct {
	ind int
	wrd string
}

func inside_parthesis(S string, x *res) bool {
	l, r := false, false
	for i := x.ind; i >= 0; i-- {
		if S[i] == '(' {
			l = true
			break
		} else if S[i] == ')' {
			break
		}
	}
	for i := x.ind; i < len(S); i++ {
		if S[i] == ')' {
			r = true
			break
		} else if S[i] == '(' {
			break
		}
	}
	return l && r
}
func mysplit(S string) []res {
	var cur string
	var start int
	var ret []res

	for i, c := range S {
		if c != '_' && c != '(' && c != ')' {
			if cur == "" {
				start = i
			}
			cur += string(c)
		} else if cur != "" {
			ret = append(ret, res{start, cur})
			cur = ""
		}
	}
	if cur != "" {
		ret = append(ret, res{start, cur})
	}
	return ret
}

func main() {
	bufin = bufio.NewReader(os.Stdin)
	bufout = bufio.NewWriter(os.Stdout)
	defer bufout.Flush()
	var N int
	fmt.Fscanf(bufin, "%d\n", &N)
	var S string
	fmt.Fscanf(bufin, "%s\n", &S)
	words := mysplit(S)
	cnt := 0
	maxlen := 0
	for _, x := range words {
		if inside_parthesis(S, &x) {
			cnt += 1
		} else {
			if maxlen < len(x.wrd) {
				maxlen = len(x.wrd)
			}
		}
	}
	fmt.Fprintf(bufout, "%d %d\n", maxlen, cnt)

}


package main

import (
        "fmt"
        "regexp"
        "strconv"
        "strings"
)

func O(o interface{}, n bool) {
        if n {
                fmt.Println(o)
        } else {
                fmt.Printf("%v ", o)
        }
}

func Int(s string) int64 {
        t, _ := strconv.ParseInt(s, 10, 64)
        return t
}

func I(n bool) string {
        var t string
        if n {
                fmt.Scanln(&t)
        } else {
                fmt.Scan(&t)
        }
        return t
}

func main() {
        n := Int(I(true))
        s := I(true)
        n = n

        re := regexp.MustCompile(`\([^\(\)]*\)`)
        ss := re.FindAllString(s, -1)

        ooo := re.ReplaceAllString(s, "_")

        rrr := regexp.MustCompile(`([_])*`)
        ooo = rrr.ReplaceAllString(ooo, "$1")
        qqq := strings.Split(ooo, "_")
        mmm := 0
        for _, q := range qqq {
                if len(q) > mmm {
                        mmm = len(q)
                }
        }

        O(mmm, false)

        num := 0
        for i := range ss {
                sss := strings.Split(ss[i], "_")
                for j := range sss {
                        r := regexp.MustCompile(`[_\(\)]`)
                        sss[j] = r.ReplaceAllString(sss[j], "")
                        if len(sss[j]) > 0 {
                                num++
                        }
                }
        }
        O(num, true)
}


package main

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

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

	var longest int = 0
	var words_inside int = 0

	reader := bufio.NewReader(os.Stdin)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		inside := false
		word_length := 0
		for i := 0; i < n; i++ {
			if (s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z') {
				word_length++
			} else {
				if !inside && word_length > longest {
					longest = word_length
				}
				if inside && word_length > 0 {
					words_inside++
				}
				if s[i] == '(' {
					inside = true
				} else if s[i] == ')' {
					inside = false
				}
				word_length = 0
			}
		}
		if word_length > longest {
			longest = word_length
		}
	}

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


package main
import (
	"fmt"
)
func main() {
	var n,x int
	fmt.Scan(&n)
	c,s:=0,0
	for i:=0;i<n;i++ {
		fmt.Scan(&x)
		s+=x
	}
	n++
	if (s+1)%n!=1 {
		c++
	}
	if (s+2)%n!=1 {
		c++
	}
	if (s+3)%n!=1 {
		c++
	}
	if (s+4)%n!=1 {
		c++
	}
	if (s+5)%n!=1 {
		c++
	}
	fmt.Println(c)
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	sum := 0
	for i := 0; i < n; i++ {
		scanner.Scan()
		x, _ := strconv.Atoi(scanner.Text())
		sum += x
	}
	pos := sum-1 % (n+1)
	count := 0
	for i := 0; i < 5; i++ {
		pos = (pos+1) % (n+1)
		if pos != 0 {
			count++
		}
	}
	writer.WriteString(strconv.Itoa(count))
	writer.WriteString("\n")
}


package main

import "fmt"

func main() {
   var n int
   var a int
   fmt.Scan(&n)
   sum := 0
    for i := 0; i < n; i++ {
        fmt.Scan(&a)
        sum += a
    }
    ans := 0
    for i := 1; i <= 5; i++ {
       if (sum + i - 1) % (n+1) != 0 {
           ans += 1
       }
    }
    fmt.Println(ans)

}


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 / 2 * 2 * M
		} else if 2 <= M/N {
			M -= M / N / 2 * 2 * 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 (
	"fmt"
)

func main() {
	var a, b int64
	fmt.Scan(&a, &b)
	for (a != 0) && (b != 0) && ((a >= 2*b) || (b >= 2*a)) {
		if a >= 2*b {
			a %= 2 * b
		} else {
			b %= 2 * a
		}
	}
	fmt.Println(a, b)
}


package main

import (
	"fmt"
)

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

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

		break
	}

	return a, b
}

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

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


package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanln(&n)
	lev := make([]int, n)
	for i := range lev {
		fmt.Scan(&lev[i])
	}
	sort.Sort(sort.IntSlice(lev))

	b := 0
	for i := 0; i < n/2; i++ {
		if lev[i*2] >= lev[i*2+1] {
			b += lev[i*2] - lev[i*2+1]
		} else {
			b += lev[i*2+1] - lev[i*2]
		}
	}
	fmt.Println(b)
}


package main

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

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

    var n int
    var A []int

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

    sort.Slice(A[:], func (x, y int) bool {
        return A[x] < A[y]
    })

    var res int = 0
    for i := 0; i < n; i += 2 {
        res += A[i + 1] - A[i]
    }

    fmt.Println(res)
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	var m []int = make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&m[i])
	}
	sort.Ints(m)
	var pr int = 0
	for i := 0; i < n; i += 2 {
		pr += m[i+1] - m[i]
	}
	fmt.Println(pr)
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	var s string
	fmt.Scan(&s)
	iG := strings.Index(s, "G")
	iT := strings.Index(s, "T")
	var r bool
	var i int
	if iG-iT < 0 {
		for i = iG; i < iT && s[i] != '#'; i += k {
		}
		if i == iT {
			r = true
		}
	} else {
		for i = iG; i > iT && s[i] != '#'; i -= k {
		}
		if i == iT {
			r = true
		}
	}
	if r == true {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

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

	var ok bool = false

	reader := bufio.NewReader(os.Stdin)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		var pos_grasshopper int
		var pos_insect int

		for i := 0; i < n; i++ {
			if s[i] == 'G' {
				pos_grasshopper = i
			} else if s[i] == 'T' {
				pos_insect = i
			}
		}
		if pos_grasshopper > pos_insect {
			k = -k
		}
		for i := pos_grasshopper + k; i >= 0 && i < n; i += k {
			if s[i] == 'T' {
				ok = true
				break
			} else if s[i] == '#' {
				ok = false
				break
			}
			if (k > 0 && i > pos_insect) || (k < 0 && i < pos_insect) {
				ok = false
				break
			}
		}
	}

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


package main

import (
	"fmt"
)

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

	var t,g int
	for i,a := range(s){
		if a == 'T' {
			t =i
		}
		if a == 'G' {
			g = i
		}
	}
	flag := false
	if t>g  {
		for i := g;i<=t;i+=k {
			if s[i] == '#' {
				break
			}
			if i == t {
				flag = true
			}
		}
	} else {
		for i := g;i>=t;i-=k {
			if s[i] == '#' {
				break
			}
			if i == t {
				flag = true
			}
		}
	}
	if flag {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main
import (
    "fmt"
)
func main() {
    var a,b,c int
    fmt.Scan(&a,&b,&c)
    if a-b > c+1 {
        c++
        fmt.Println(c)
    }else {
        a-=b
        fmt.Println(a)
    }
}


package main
import (
	"fmt"
)
func main() {
	var a,b,c int
	fmt.Scan(&a,&b,&c)
	if a-b > c+1 {
		c++
		fmt.Println(c)
	}else {
		a-=b
		fmt.Println(a)
	}
}


package main

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

var scanner *bufio.Scanner

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

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

  n, a, b := getI(), getI(), getI()
  pos := a
  if n-b-1 > pos {
    pos = n-b-1
  }
  result := n-pos
  writer.WriteString(fmt.Sprintf("%d\n", result))
}


package main

import (
	"fmt"
	"strings"
)

func main(){
	var a = 0
	b := new(string)

	fmt.Scan(&a)
	fmt.Scan(b)

	temp := make([]string, 0)
	temp = strings.Split(*b, "0")
	for _, each := range temp {
		fmt.Print(len(each))
	}

}


package main

import (
  "fmt"
)

func main() {
  var n int
  var encodeStr string

  fmt.Scan(&n)
  fmt.Scan(&encodeStr)

  var counter int
  var prevDigit string = "-1"

  for i := 0; i < n; i++ {
    var currentDigit string = string(encodeStr[i])
    if currentDigit == "1" {
      counter++
      if i == n-1 {
        fmt.Printf("%d", counter)
      }
    } else if currentDigit == "0" && prevDigit == "0" {
      fmt.Printf("0")
    } else if currentDigit == "0" && prevDigit != "0" {
      fmt.Printf("%d", counter)
      counter = 0
    }
    prevDigit = currentDigit
  }

  if string(encodeStr[n - 1]) == "0" {
    fmt.Printf("0")
  }
}


package main

import (
	"fmt"
)

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

func decode(s string) int {
	tenth := 1
	onesCounter := 0
	sum := 0
	for i := len(s) - 1; i >= 0; i-- {
		if s[i] == '1' {
			onesCounter++
		} else {
			sum += (tenth * onesCounter)
			tenth *= 10
			onesCounter = 0
		}
	}
	sum += tenth * onesCounter
	return sum
}


package main

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

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


package main

import (
	"fmt"
	//"os"
)

func main() {
	//os.Stdin, _ = os.OpenFile("input.txt", os.O_RDONLY, 0666)
	//os.Stdout, _ = os.OpenFile("output.txt", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)

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

	hold, base := n, 1
	for (hold / 10) != 0 {
		hold /= 10
		base *= 10
	}
	fmt.Printf("%d\n", (n/base+1)*base-n)
}


package main

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

func main(){
	var n int
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.Atoi(r.Text())
	a := make([]int, 3001)
	count := 0
	for i:=2; i<=n; i++ {
		for j:=2; j<i; j++ {
			if a[j] == 0 && i%j == 0 {
				a[i] += 1
			}
		}
		if a[i] == 2 {
			count += 1
		}
	}
	w.WriteString(strconv.Itoa(count)+"\n")
	w.Flush()
}


package main

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

var inf int = 0x3f3f3f3f
var reader *bufio.Reader

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

var n int

func main() {
	fmt.Fscan(reader, &n)

	ans := 0
	for num := 0; num <= n; num++ {
		a := Divisor(num)
		sum := 0
		for i := 0; i < len(a); i++ {
			if IsPrime(a[i]) {
				sum++
			}
			if sum > 2 {
				break
			}
		}
		if sum == 2 {
			ans++
		}
	}

	fmt.Println(ans)
}

// IsPrime 素性测试
func IsPrime(n int) bool {
	for i := int(2); i*i <= n; i++ {
		if n%i == 0 {
			return false
		}
	}
	return n != 1
}

// Divisor 约数枚举
func Divisor(n int) (res []int) {
	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i != n/i {
				res = append(res, n/i)
			}
		}
	}
	return
}


package main

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

const (
	BIG = 1024 * 1024 * 10
)

func readLine(r *bufio.Reader) string {
	bytes, _, err := r.ReadLine()
	if err != nil {
		log.Fatalln("Failed to read line")
	}

	return string(bytes)
}

func readInts(r *bufio.Reader) []int {
	elems := strings.Fields(readLine(r))

	ret := make([]int, len(elems))
	for i, el := range elems {
		tmp, err := strconv.ParseInt(el, 10, 64)
		if err != nil {
			log.Fatalf("Failed to parse number %v", el)
		}
		ret[i] = int(tmp)
	}

	return ret
}

type Sieve struct {
	n             int
	first, primes []int
}

type Factor struct {
	Base, Exp int
}

func NewSieve(n int) *Sieve {
	first := make([]int, n+1)
	primes := make([]int, 0)

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

		for j := 0; j < len(primes) && primes[j] <= first[i] && i*primes[j] <= n; j++ {
			first[i*primes[j]] = primes[j]
		}
	}

	ret := Sieve{n, first, primes}

	return &ret
}

func (s *Sieve) IsPrime(x int) (bool, error) {
	if s.n < x {
		return false, errors.New(fmt.Sprintf("The largest supported number by this sieve is %v", s.n))
	}
	if x < s.primes[0] || x > s.primes[len(s.primes)-1] {
		return false, nil
	} else if x == s.primes[0] {
		return true, nil
	}
	low, high := 0, len(s.primes)-1
	for high-low > 1 {
		mid := (low + high) / 2
		if s.primes[mid] < x {
			low = mid
		} else {
			high = mid
		}
	}
	return s.primes[high] == x, nil
}

func (s *Sieve) Factors(x int) ([]Factor, error) {
	factors := make([]Factor, 0)

	if s.n < x {
		return factors, errors.New(fmt.Sprintf("The largest supported number by this sieve is %v", s.n))
	}

	for x > 1 {
		pi := s.first[x]
		exp := 0
		for x > 1 && s.first[x] == pi {
			exp += 1
			x /= pi
		}
		factors = append(factors, Factor{pi, exp})
	}

	return factors, nil
}
func main() {
	r := bufio.NewReaderSize(os.Stdin, BIG)

	n := readInts(r)[0]
	s := NewSieve(n)

	total := 0
	for i := 1; i <= n; i++ {
		factors, _ := s.Factors(i)
		if len(factors) == 2 {
			total += 1
		}
	}

	fmt.Println(total)
}


package main
import "fmt"

var s75 = "What are you doing at the end of the world? Are you busy? Will you save us?"
var s34 = "What are you doing while sending \""
var s32 = "\"? Are you busy? Will you send \""
var s2 = "\"?"

var f = make([]uint64, 100001)
// golang op. the recursive function call? like the g++ -O2?
func printChar(n int, k uint64) {
	if k > f[n] {
		fmt.Print(".")
		return
	}

	if n == 0 {
		fmt.Print(string(s75[k-1]))
		return
	}

	if k <= 34 {
		fmt.Print(string(s34[k-1]))
		return
	}

	k -= 34
	if k <= f[n-1] {
		printChar(n-1, k)
		return
	}

	k -= f[n-1]
	if k <= 32 {
		fmt.Print(string(s32[k-1]))
		return
	}

	k -= 32
	if k <= f[n-1] {
		printChar(n-1, k)
		return
	}

	k -= f[n-1]
	fmt.Print(string(s2[k-1]))
}

// calc len(fi)
func main() {
	// 75
	//f0 := "What are you doing at the end of the world? Are you busy? Will you save us?"
	// 34 + 75(f0) + 32 + 75(f0) + 2 = 68
	//f1 := "What are you doing while sending \"" + f0 + "\"? Are you busy? Will you send \"" + f0 + "\"?"
	//nLen := len(f0)
	//fmt.Println(nLen)
	//fmt.Println(f1)

	f[0] = 75
	// range ptr/ref
	for i := 1; i < 100001; i++ {
		f[i] = 34 + f[i-1] + 32 + f[i-1] + 2
	}

	var q int
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		var n int
		var k uint64
		fmt.Scan(&n, &k)
		printChar(n, k)
	}
	fmt.Println()
}


package main
import "fmt"

var s75 = "What are you doing at the end of the world? Are you busy? Will you save us?"
var s34 = "What are you doing while sending \""
var s32 = "\"? Are you busy? Will you send \""
var s2 = "\"?"

var f = make([]uint64, 56) // f[55] ~= 5e18 > k(1e18)

func printChar(n int, k uint64) {
	nLen := 55
	if n > nLen {
		p := uint64(34) * uint64(n - nLen) // prefix before f[56] -> f[n]
		if k > p {
			printChar(nLen, k - p)
		} else {
			k %= 34
			fmt.Print(string(s34[k-1]))
		}
		return
	}

	// n < 56
	if k > f[n] {
		fmt.Print(".")
		return
	}

	if n == 0 {
		fmt.Print(string(s75[k-1]))
		return
	}

	if k <= 34 {
		fmt.Print(string(s34[k-1]))
		return
	}

	k -= 34
	if k <= f[n-1] {
		printChar(n-1, k)
		return
	}

	k -= f[n-1]
	if k <= 32 {
		fmt.Print(string(s32[k-1]))
		return
	}

	k -= 32
	if k <= f[n-1] {
		printChar(n-1, k)
		return
	}

	k -= f[n-1]
	fmt.Print(string(s2[k-1]))
}

// calc len(fi)
func main() {
	// 75
	//f0 := "What are you doing at the end of the world? Are you busy? Will you save us?"
	// 34 + 75(f0) + 32 + 75(f0) + 2 = 68
	//f1 := "What are you doing while sending \"" + f0 + "\"? Are you busy? Will you send \"" + f0 + "\"?"
	//nLen := len(f0)
	//fmt.Println(nLen)
	//fmt.Println(f1)

	f[0] = 75
	// range ptr/ref
	for i := 1; i < len(f); i++ {
		f[i] = 34 + f[i-1] + 32 + f[i-1] + 2
	}

	var q int
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		var n int
		var k uint64
		fmt.Scan(&n, &k)
		printChar(n, k)
	}
	fmt.Println()
}


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 = "\"?"

	maxK = 1000000000000000000
)

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] = 2 * lens[i-1]
		if lens[i] < 0 || lens[i] > maxK {
			lens[i] = maxK
		} else {
			lens[i] += int64(len(fi0) + len(fi1) + len(fi2))
		}

	}

	q := readint()

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


package main

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

var arr [][]int64

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

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

	var n, m, a, b int
	var g, x, y, z int64
	fmt.Fscanf(reader, "%d %d %d %d\n", &n, &m, &a, &b)
	fmt.Fscanf(reader, "%d %d %d %d\n", &g, &x, &y, &z)
	arr = make([][]int64, n)
	for i := 0;i < n;i ++ {
		arr[i] = make([]int64, m)
		for j := 0;j < m;j ++ {
			arr[i][j] = g
			g = (g * x + y) % z
		}
	}
	var ax, bx int
	for bx = 2;bx <= b;bx <<= 1 {
		for i := 0;i < n;i ++ {
			for j := 0;j <= m - bx;j ++ {
				arr[i][j] = min(arr[i][j], arr[i][j + bx / 2])
			}
		}
	}
	for ax = 2;ax <= a;ax <<= 1 {
		for i := 0;i <= n - ax;i ++ {
			for j := 0;j < m;j ++ {
				arr[i][j] = min(arr[i][j], arr[i + ax / 2][j])
			}
		}
	}
	ax, bx = ax / 2, bx / 2
	var res int64 = 0
	for i := 0;i <= n - a;i ++ {
		for j := 0;j <= m - b;j ++ {
			di, dj := i + a, j + b
			res += min(min(arr[i][j], arr[di - ax][j]), min(arr[i][dj - bx], arr[di - ax][dj - bx]))
		}
	}
	fmt.Printf("%d", res)
}


package main

import "fmt"
import "os"

import "strconv"
import "strings"

func L(n int) int {
	if n==0 { return 0 }
	if n < 10 { return 1 }

	var P=make([]int, n+1)
	var C=make([]int, 10)

	for i:=0; i < 10; i++ { P[i]=1 }
	for i:=10; i <= n; i++ {
		m:=cyfry(i, C)
		min:=-1
		for j:=0; j < m; j++ {
			if C[j] > 0 {
				if min < 0 {
					min=P[i-C[j]]
				} else {
					if P[i-C[j]] < min {
						min=P[i-C[j]]
					}
				}
			}
		}
		P[i]=min+1
	}
	return P[n]
}

func cyfry(n int, c []int) int {
	var i int
	for i=0; n > 0; i++ {
		c[i]=n%10
		n/=10
	}
	return i
}

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

func main() {
	b:=make([]byte, 20)
	max, _:=os.Stdin.Read(b)
	s:=strings.TrimRight(string(b)[0:max], "\r\n")
	n, _:=strconv.Atoi(s)
	fmt.Print(L(n))
}


package main

import (
	"fmt"
)

func main() {
	var k, n, s, p int
	fmt.Scan(&k, &n, &s, &p)
	ss := (n-1)/s + 1
	fmt.Println((ss*k-1)/p + 1)
}


// Codeforces helper functions
// 20 Jan 18
// samadhi

package main

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

const debug = true

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

	in := gsli(reader)

	people := in[0]
	planes := in[1]
	pps := in[2]
	sheets := in[3]

	spp := planes / pps
	for spp*pps < planes {
		spp++
	}
	ppg := spp * people
	packs := ppg / sheets
	for packs*sheets < ppg {
		packs++
	}

	fmt.Println(packs)

}

// 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(reader *bufio.Reader) (arr []string) {
	// Get a full line
	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
}

// String helpers

// Is Lowercase
// Given some string[i], return whether it is lower case or not.

func isl(b byte) bool {
	var r rune
	r = rune(b)
	return unicode.IsLower(r)
}

// Math helpers

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

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

// Max Int
// Returns the max of two ints

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

// Distance formule
// Calculates the distance to the origin

func dist(x, y float64) float64 {
	return math.Sqrt(math.Pow(x, 2) + math.Pow(y, 2))
}

// Output helpers

func yes() {
	fmt.Println("Yes")
}

func no() {
	fmt.Println("No")
}

// Debug helpers

// From https://groups.google.com/forum/#!topic/golang-nuts/Qlxs3V77nss

func dbg(s string, a ...interface{}) {
	if debug {
		fmt.Printf(s, a...)
	}
}


package main

import (
    "fmt"
)

func main() {
    var k, n, s, p int
    fmt.Scanf("%d%d%d%d", &k, &n, &s, &p)
    a := (n + s - 1) / s
    fmt.Println((k * a + p - 1) / p)
}


package main

import "fmt"

var dp [4005]int

func main() {
	var n, a, b, c int
	fmt.Scan(&n, &a, &b, &c)
	if a > b {
		a, b = b, a
	}
	if a > c {
		a, c = c, a
	}
	if b > c {
		b, c = c, b
	}

	for i := 1; i < len(dp); i++ {
		dp[i] = -100000
	}
	for i := a; i <= n; i++ {
		dp[i] = max(dp[i], dp[i-a]+1)
		if i >= b {
			dp[i] = max(dp[i], dp[i-b]+1)
		}
		if i >= c {
			dp[i] = max(dp[i], dp[i-c]+1)
		}
	}

	fmt.Println(dp[n])
}

func max(x, y int) int {
	if x < y {
		x = y
	}

	return x
}


package main

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

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

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

func main() {
  defer writer.Flush()
  var n, a, b, c int
  scanf("%d %d %d %d\n", &n, &a, &b, &c)

  dp := make([]int, n+1)

  for i, _ := range dp {
    dp[i] = -1
  }
  dp[0] = 0

  for i:=1; i <= n; i++ {
    for _, j := range []int{a, b, c} {
      if i-j >= 0 && dp[i-j] != -1 {
        dp[i] = max(dp[i], dp[i-j]+1)
      }
    }
  }
  printf("%d\n", dp[n])
}


package main

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

var n, a, b, c int
var res []int

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	raw := scanner.Text()
	segs := strings.Split(raw, " ")
	n, _ = strconv.Atoi(segs[0])
	a, _ = strconv.Atoi(segs[1])
	b, _ = strconv.Atoi(segs[2])
	c, _ = strconv.Atoi(segs[3])

	d := Do()
	fmt.Println(d)
}

func Do() int {
	res = make([]int, n+1, n+1)
	for idx := 1; idx <= n; idx++ {
		res[idx] = Cut(idx)
		// fmt.Println("res", idx, res)
	}
	return res[n]
}

func Cut(idx int) int {
	if idx == 0 {
		return 0
	}
	max := 0
	if idx >= a {
		left := idx - a
		if left == 0 {
			max = 1
			goto bnote
		} else {
			if res[left] == 0 {
				max = 0
				goto bnote
			} else {
				max = 1 + res[left]
			}
		}
	}
bnote:
	bmax := 0
	{
		if idx >= b {
			left := idx - b
			if left == 0 {
				bmax = 1
				goto cnote
			} else {
				if res[left] == 0 {
					bmax = 0
					goto cnote
				} else {
					bmax = 1 + res[left]
				}
			}
		}
	}
cnote:
	cmax := 0
	{
		if idx >= c {
			left := idx - c
			if left == 0 {
				cmax = 1
				goto over
			} else {
				if res[left] == 0 {
					cmax = 0
					goto over
				} else {
					cmax = 1 + res[left]
				}
			}
		}
	}
over:
	{
		zhi := max3(max, bmax, cmax)
		return zhi
	}
}

func max3(a, b, c int) int {
	res := []int{a, b, c}
	// fmt.Println(res)
	sort.Ints(res)
	return res[2]
}


package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var n int64
	fmt.Fscan(reader, &n)
	fmt.Fprintln(writer, n - (n / 2 + n / 3 + n / 5 + n / 7 - n / 6 - n / 10 - n / 14 - n / 15 - n / 21 - n / 35 + n / 30 + n / 42 + n / 70 + n / 105 - n / 210))
}//2020-07-31 13:53:23.706


package main

import "fmt"

func main() {
    var s string
    fmt.Scan(&s)
    ans, cnt, prev := 0, 0, '_'
    for _, v := range s {
        if cnt == 5 {
            prev = '_'
        }
        if v == prev {
            cnt++
        } else {
            ans++
            cnt = 1
            prev = v
        }
    }
    fmt.Println(ans)
}


package main

import
"fmt"

func main() {

var s string

fmt.Scan(&s)

ans, cnt, prev := 0, 0, '_'

for _, v := range s {

if cnt == 5 {

prev = '_'

}

if v == prev {

cnt++

} else {

ans++

cnt = 1

prev = v

}

}

fmt.Println(ans)

}


package main

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

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

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

	n, b, p := nextInt(), nextInt(), nextInt()
	cntB := 0
	p *= n
	a := 512

	for n > 1 {
		for a > n {
			a /= 2
		}
		cntB += b*a + a/2
		n = a/2 + n - a
	}

	println(cntB, p*n)
}

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

func main() {
	var b, n, p, x, y int
	fmt.Scanf("%d%d%d", &n, &b, &p)
	y = n * p
	for n > 1 {
		k := 1
		for k <= n {
			k = k << 1
		}
		k = k >> 2
		x += (2*b + 1) * k
		n = n - k
	}
	fmt.Println(x, y)
}


package main

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

type BufferedWriter interface {
	Printf(format string, a ...interface{})
	Flush()
}

type writerImpl struct {
	*bufio.Writer
}

func NewBufferedWriter(writer io.Writer) BufferedWriter {
	return &writerImpl{Writer: bufio.NewWriter(writer)}
}

func (impl *writerImpl) Printf(f string, a ...interface{}) {
	fmt.Fprintf(impl.Writer, f, a...)
}

func (impl *writerImpl) Flush() {
	impl.Writer.Flush()
}

type WordScanner interface {
	NextInt() int
	NextInt64() int64
	NextString() string
}

type wordScannerImpl struct {
	*bufio.Scanner
}

func NewWordScanner(reader io.Reader) WordScanner {
	s := bufio.NewScanner(reader)
	s.Split(bufio.ScanWords)
	// adjust the following size as needed
	// 2 << 17 is good enough to scan strings of len 2*10^5
	// it could go as high as 2 << 26 before cf judge breaks
	size := 2 << 20
	buf := make([]byte, size)
	s.Buffer(buf, size)
	return &wordScannerImpl{Scanner: s}
}

func (impl *wordScannerImpl) NextInt() int {
	impl.Scan()
	bb := impl.Bytes()
	i := 0
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextInt64() int64 {
	impl.Scan()
	bb := impl.Bytes()
	i := int64(0)
	if bb[0] == '-' {
		for _, b := range bb[1:] {
			i *= 10
			i -= int64(b - '0')
		}
		return i
	}
	for _, b := range bb {
		i *= 10
		i += int64(b - '0')
	}
	return i
}

func (impl *wordScannerImpl) NextString() string {
	impl.Scan()
	return impl.Text()
}

var reader = NewWordScanner(os.Stdin)
var writer = NewBufferedWriter(os.Stdout)

func main() {
	defer writer.Flush()
	n, b, p := reader.NextInt64(), reader.NextInt64(), reader.NextInt64()
	y := n*p
	x := int64(0)
	for n > 1 {
		k := getK(n)
		x += k*b + k/2
		n = k/2 + n - k
	}
	writer.Printf("%d %d\n", x, y)
}

func getK(n int64) int64 {
	curr := int64(1)
	for n > 1 {
		n >>= 1
		curr <<= 1
	}
	return curr
}


package main

import "fmt"

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

	var r, c = 1, n

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			r, c = i, n/i
		}
	}

	fmt.Println(r, c)
}


package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

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

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

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

func main() {
	defer w.Flush()
	var n int
	for I(&n, "\n") == nil {
		solve(n)
	}
}

func solve(n int) {
	a := int(math.Sqrt(float64(n)))
	b := a
	for a*b != n {
		if a*b < n {
			b++
		} else {
			a--
		}
	}
	O(a, " ")
	O(b, "\n")
}


package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()

	for i := int(math.Sqrt(float64(N))); i >= 1; i-- {
		if N % i == 0 {
			fmt.Println(i, N / i)
			break
		}
	}

}

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

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

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

const N int = 100

func main() {
	io := NewIO()

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

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

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


package main

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

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

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

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

    const (
        _ = iota
        circle
        triangle
        square
    )

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

    if ans == -1 {
        fmt.Println("Infinite")
    } else {
        for i := 1; i < n - 1; i++ {
            if a[i - 1] == square && a[i] == circle && a[i + 1] == triangle {
                ans--
            }
        }

        fmt.Println("Finite")
        fmt.Println(ans)
    }
}


package main

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

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

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

const N int = 100

func main() {
	io := NewIO()

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

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

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


package main

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

// A. Playoff

func match(a, b int) int {

	if a&b == 0 {
		return a
	}

	return b
}

func solve() {

	var n int
	scanf("%d\n", &n)

	/*matches := 1 << n
	competitors := []int{}

	for i := 1; i <= matches; i++ {
		competitors = append(competitors, i)
	}

	//println(matches, competitors)

	for len(competitors) > 1 {

		a := competitors[0]
		b := competitors[1]
		competitors = competitors[2:]

		winner := match(a, b)

		//println(competitors, winner)

		competitors = append(competitors, winner)
	}*/

	println((1 << n) - 1)
}

func main() {

	var t int

	scanf("%d\n", &t)

	for t > 0 {
		solve()
		t--
	}

	writer.Flush()
}

// Constants

const (
	B  = 1e9
	BB = 1e18
)

// Data structures

type Pair struct {
	First, Second int
}

type Pairs []Pair

func (p Pairs) Len() int           { return len(p) }
func (p Pairs) Less(i, j int) bool { return p[i].First < p[j].First }
func (p Pairs) Swap(i, j int)      { p[i], p[j] = p[j], p[i] }

// Util functions

func tos(n int) string {
	return strconv.Itoa(n)
}

func toi(s string) int {
	// ignore error
	n, _ := strconv.Atoi(s)

	return n
}

func pow(b, n uint) uint {

	if n == 0 {
		return 1
	}

	var a uint = 1

	for n >= 1 {
		a = b * a
		n--
	}

	return a
}

func flip(b uint) uint {

	if b == 0 {
		return 1
	}

	return 0
}

func bin(dec uint) []uint {

	bin := []uint{}

	for dec > 0 {
		if dec%2 != 0 {
			bin = append(bin, 1)
		} else {
			bin = append(bin, 0)
		}

		dec = dec / 2
	}

	for i, j := 0, len(bin)-1; i < j; i, j = i+1, j-1 {
		bin[i], bin[j] = bin[j], bin[i]
	}

	return bin
}

func dec(b []uint) uint {

	var dec uint = 0

	for i, v := range b {
		dec += (2 << i) * v
	}

	return dec
}

// Use buffering when reading/writing data as the default fmt.Scanx/fmt.Printx
// functions doesn't.

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

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

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

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


package main

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

func main() {
    var t int
    fmt.Fscan(os.Stdin, &t)
    for i := 0; i < t; i++ {
        var n int
        fmt.Fscan(os.Stdin, &n)
        if n == 0 {
            fmt.Println(n)
        } else {
            r:= math.Pow(2, float64(n)) - float64(1)
            fmt.Println(int64(r))
        }
    }
}


package main

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

type CF1651A struct {
	sc        *bufio.Reader
	split     []string
	index     int
	separator string
}

func (in *CF1651A) GetLine() string {
	line, err := in.sc.ReadString('\n')
	if err != nil {
		fmt.Println("error line:", line, " err: ", err)
	}
	in.split = []string{}
	in.index = 0
	return line
}
func (in *CF1651A) load() {
	if len(in.split) <= in.index {
		in.split = strings.Split(in.GetLine(), in.separator)
		in.index = 0
	}
}

func (in *CF1651A) NextInt() int {
	in.load()
	val, _ := strconv.Atoi(strings.TrimSpace(in.split[in.index]))
	in.index++
	return val
}

func (in *CF1651A) NextInt64() int64 {
	in.load()
	val, _ := strconv.ParseInt(strings.TrimSpace(in.split[in.index]), 10, 64)
	in.index++
	return val
}

func (in *CF1651A) NextString() string {
	in.load()
	val := strings.TrimSpace(in.split[in.index])
	in.index++
	return val
}

/**
Run solve the problem CF1651A
Date: 21/03/22
User: pepradere
URL: https://codeforces.com/problemset/problem/1651/A
Problem: CF1651A
**/
func (in *CF1651A) Run() {
	for t := in.NextInt(); t > 0; t-- {
		n := in.NextInt()
		p := int(math.Pow(2, float64(n)))
		fmt.Println(p - 1)
	}
}

func NewCF1651A(r *bufio.Reader) *CF1651A {
	return &CF1651A{
		sc:        r,
		split:     []string{},
		index:     0,
		separator: " ",
	}
}

func main() {
	NewCF1651A(bufio.NewReader(os.Stdin)).Run()
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	koutsu := make(map[string]int)
	shuntsu := make(map[string][]int)
	scanner.Scan()
	text := scanner.Text()
	tiles := strings.Split(text, " ")
	for _, s := range tiles {
		if _, ok := koutsu[s]; !ok {
			koutsu[s] = 1
		} else {
			koutsu[s]++
		}
		char := strings.Split(s, "")
		suit := char[1]
		digit, _ := strconv.Atoi(char[0])
		digit = digit - 1
		if _, ok := shuntsu[suit]; !ok {
			arr := make([]int, 9)
			arr[digit] = 1
			shuntsu[suit] = arr
		} else {
			shuntsu[suit][digit] = 1
		}
	}

	minKou := 2
	for _, v := range koutsu {
		if 3 - v < minKou {
			minKou = 3 - v
		}
		if minKou == 0 {
			fmt.Println(minKou)
			return
		}
	}
	minShun := 2
	for _, arr := range shuntsu {
		count := 0
		for i := 0; i < len(arr) - 2; i++ {
			count = arr[i] + arr[i + 1] + arr[i + 2]
			if 3 - count < minShun {
				minShun = 3 - count
			}
		}
		if minShun == 0 {
			fmt.Println(minShun)
			return
		}
	}
	if minKou < minShun {
		fmt.Println(minKou)
	} else {
		fmt.Println(minShun)
	}
}


package main

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

func koutsu(t1, t2, t3 string) int {

	if t1 == t2 && t2 == t3 {
		return 0
	}

	strs := []string{t1, t2, t3}
	sort.Strings(strs)
	if strs[0] == strs[1] || strs[1] == strs[2] {
		return 1
	}
	return 2
}

func contains(value string, str []string) bool {
	for _, st := range str {
		if st == value {
			return true
		}
	}
	return false
}

func shuntsu(t1, t2, t3 string) int {
	tiles := []string{t1, t2, t3}
	letters := [3]string{"m", "p", "s"}
	best := 2
	for i := 1; i <= 7; i++ {
		for _, lt := range letters {
			na := strconv.Itoa(i) + lt
			nb := strconv.Itoa(i+1) + lt
			nc := strconv.Itoa(i+2) + lt
			c := 0
			if contains(na, tiles) {
				c++
			}
			if contains(nb, tiles) {
				c++
			}
			if contains(nc, tiles) {
				c++
			}
			best = min(best, 3-c)
		}
	}
	return best
}

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

func main() {
	var t1, t2, t3 string

	fmt.Scanf("%s %s %s", &t1, &t2, &t3)
	fmt.Println(min(koutsu(t1, t2, t3), shuntsu(t1, t2, t3)))
}


package main

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

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 max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func consec(arr []int) int {

	ans := 0

	for i := 0; i < len(arr); i++ {
		cur := 1
		last := arr[i]
		for j := i + 1; j < len(arr); j++ {
			if arr[j] == last+1 {
				last = last + 1
				cur++
			} else {
				ans = max(ans, cur)
				break
			}
		}
		ans = max(ans, cur)
	}
	return ans
}

func same(arr []int) int {

	ans := 0

	for i := 0; i < len(arr); i++ {
		cur := 1
		last := arr[i]
		for j := i + 1; j < len(arr); j++ {
			if arr[j] == last {
				cur++
			} else {
				ans = max(ans, cur)
				break
			}
		}
		ans = max(ans, cur)
	}
	return ans
}

func main() {
	defer writer.Flush()
	var a, b, c string

	s := []int{}
	m := []int{}
	p := []int{}

	scanf("%s %s %s\n", &a, &b, &c)

	if a[1] == byte('s') {
		cur := int(a[0] - byte('0'))
		s = append(s, cur)
	}
	if a[1] == byte('m') {
		cur := int(a[0] - byte('0'))
		m = append(m, cur)
	}
	if a[1] == byte('p') {
		cur := int(a[0] - byte('0'))
		p = append(p, cur)
	}

	if b[1] == byte('s') {
		cur := int(b[0] - byte('0'))
		s = append(s, cur)
	}
	if b[1] == byte('m') {
		cur := int(b[0] - byte('0'))
		m = append(m, cur)
	}
	if b[1] == byte('p') {
		cur := int(b[0] - byte('0'))
		p = append(p, cur)
	}

	if c[1] == byte('s') {
		cur := int(c[0] - byte('0'))
		s = append(s, cur)
	}
	if c[1] == byte('m') {
		cur := int(c[0] - byte('0'))
		m = append(m, cur)
	}
	if c[1] == byte('p') {
		cur := int(c[0] - byte('0'))
		p = append(p, cur)
	}

	sort.Ints(s)
	sort.Ints(p)
	sort.Ints(m)

	// fmt.Println(s, p, m)

	// fmt.Println(consec(p))

	if same(s) == 3 || consec(s) == 3 || same(p) == 3 || consec(p) == 3 || same(m) == 3 || consec(m) == 3 {
		printf("0")
		return
	}

	if same(s) == 2 || consec(s) == 2 || same(p) == 2 || consec(p) == 2 || same(m) == 2 || consec(m) == 2 {
		printf("1")
		return
	}

	if len(s) == 2 {
		s = []int{s[0], s[0] + 1, s[1]}
	} else if len(s) == 3 {
		s = []int{s[0], s[0] + 1, s[1], s[1] + 1, s[2]}
	}
	if len(m) == 2 {
		m = []int{m[0], m[0] + 1, m[1]}
	} else if len(m) == 3 {
		m = []int{m[0], m[0] + 1, m[1], m[1] + 1, m[2]}
	}
	if len(p) == 2 {
		p = []int{p[0], p[0] + 1, p[1]}
	} else if len(p) == 3 {
		p = []int{p[0], p[0] + 1, p[1], p[1] + 1, p[2]}
	}

	if same(s) >= 3 || consec(s) >= 3 || same(p) >= 3 || consec(p) >= 3 || same(m) >= 3 || consec(m) >= 3 {
		printf("1")
		return
	}

	printf("2")

}


package main

import "fmt"
import "sort"

func main() {
    var k, v int
    var a []int
    fmt.Scan(&k)
    for i:=0; i<k; i++ {
        fmt.Scan(&v)
        a = append(a, v)
    }
    sort.Ints(a)
    fmt.Println(func () int{
            if ans:= a[len(a)-1] - 25; ans > 0 {
                return ans
            }
            return 0
        }())
}


package main

import "fmt"

func main() {
	var k int
	fmt.Scan(&k)
	ma := 0
	for i := 0; i < k; i++ {
		var r int
		fmt.Scan(&r)
		if ma < r {
			ma = r
		}
	}
	ans := ma - 25
	if ans < 0 {
		ans = 0
	}
	fmt.Println(ans)
}


package main

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

func main() {
	z:= bufio.NewScanner(os.Stdin)
	z.Split(bufio.ScanWords)
	z.Scan()
	n, _:= strconv.Atoi(strings.TrimSpace(z.Text()))
	m := 0
	for i := 0; i < n; i++  {
		z.Scan()
		a,_ := strconv.Atoi(strings.TrimSpace(z.Text()))
		if a>m {
			m=a
		}
	}

	if m <= 25 {
		m = 0
	} else {
		m -= 25
	}
	fmt.Println(m)
}


package main
import (
	"fmt"
)

func main() {
	var s string
	kecil,besar,digit :=false,false,false
	fmt.Scan(&s)
	lens:=len(s)
	if lens<5 {
		fmt.Println("Too weak")
	} else {
		for i:=0;i<lens;i++ {
			if s[i] >='a' && s[i] <='z' {
				kecil=true
			}
			if s[i] >='A' && s[i] <='Z' {
				besar=true
			}
			if s[i] >='0' && s[i] <='9' {
				digit=true
			}
		}
		if kecil==true && besar==true && digit==true {
			fmt.Println("Correct")
		} else {
			fmt.Println("Too weak")
		}
	}
}


package main

import "fmt"

func main() {
    var s string
    var a,b,c,d bool
    fmt.Scan(&s)
    if len(s) >= 5 { a = true }
    for _, v := range s {
        if (v >= 'A') && (v <= 'Z') { b = true }
        if (v >= 'a') && (v <= 'z') { c = true }
        if (v >= '0') && (v <= '9') { d = true }
    }
    if a && b && c && d {
        fmt.Println("Correct")
    } else {
        fmt.Println("Too weak")
    }
}


package main

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

func main() {
	var s1, s2 string
	var ans strings.Builder
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &s1)
	fmt.Fscan(in, &s2)

	for i := 0; i < len(s1); i++ {
		if s2[i] == s1[i] {
			ans.WriteString("0")
		} else {
			ans.WriteString("1")
		}
	}
	fmt.Println(ans.String())
}


package main

import "fmt"

func main() {
    var s1,s2 string
    fmt.Scan(&s1,&s2)
    for i := 0; i < len(s1); i++ {
        if (s1[i] == s2[i]) { fmt.Print("0") } else { fmt.Print("1") }
    }
    fmt.Println()
}


package main

import "fmt"

func main() {
	var m, n string
	fmt.Scan(&m, &n)
	for i := 0; i < len(m); i++ {
		if m[i] == n[i] {
			fmt.Print("0")
		} else {
			fmt.Print("1")
		}
	}
}


package main

import "fmt"

func bitSum(a int64) int {
	sum := 0
	for {
		if a <= 0 {
			break
		}
		sum += int(a % 10)
		a /= 10
	}
	return sum
}

func main() {
	var n int64
	fmt.Scan(&n)
	if n < 10 {
		fmt.Println(n)
		return
	}

	ten := int64(10)
	m := n
	for {
		m /= 10
		if m < 10 {
			break
		}
		ten *= 10
	}

	a := int64(9)
	for {
		c := int64(a*10 + 9)
		if n-c < 0 {
			for i := int64(1); i < 10; i++ {
				if n > i*ten+a {
					a = (i-1)*ten + a
					break
				}
			}
			break
		}
		a = c
	}

	sum := bitSum(a)
	sum += bitSum(n - a)

	fmt.Println(sum)
}


package main

import (
	"bufio"
	"os"
	"fmt"
	"math"
)
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
	var c,s int64
	c = n
	for ;c >10;s++ {
		c /= 10
	}
	a = c * int64(math.Pow(float64(10),float64(s)))-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 (
	"fmt"
)

var (
	n int64
)

func main() {
	for {
		if _, err := fmt.Scan(&n); err != nil {
			break
		}
		solve()
	}
}

func solve() {
	ans := int64(0)
	for a := int64(0); a <= n; a = a*10 + 9 {
		ans = max(ans, s(a)+s(n-a))
	}
	fmt.Println(ans)
}

func s(x int64) int64 {
	sum := int64(0)
	for x > 0 {
		sum += x % 10
		x /= 10
	}
	return sum
}

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


package main

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

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

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

func solve(l1, r1, l2, r2, k int64) int64 {
	l := max(l1, l2)
	r := min(r1, r2)
	if l > r {
		return 0
	}
	res := r - l + 1
	if (l <= k) && (k <= r) {
		return res - 1
	}
	return res
}

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

	var l1, r1, l2, r2, k int64
	fmt.Fscanf(bufin, "%d %d %d %d %d\n", &l1, &r1, &l2, &r2, &k)
	res := solve(l1, r1, l2, r2, k)
	fmt.Fprintf(bufout, "%d\n", res)
}


package main

import "fmt"

func main() {
	var l1, r1, l2, r2, k int64
	fmt.Scan(&l1, &r1, &l2, &r2, &k)

	l := l1
	if l2 > l1 {
		l = l2
	}
	r := r1
	if r2 < r1 {
		r = r2
	}

	result := r - l + 1
	if k >= l && k <= r {
		result--
	}

	if result < 0 {
		result = 0
	}

	fmt.Println(result)
}


package main

import (
	"fmt"
)

func main() {
	var l1, r1, l2, r2, k int64
	if _, err := fmt.Scanf("%d %d %d %d %d\n", &l1, &r1, &l2, &r2, &k); err != nil {
		return
	}

	if r2 < l1 || r1 < l2 {
		fmt.Println("0")
	} else {
		l := l1
		if l < l2 {
			l = l2
		}
		r := r1
		if r > r2 {
			r = r2
		}

		var prink int64 = 0
		if l <= k && k <= r {
			prink = 1
		}

		fmt.Println(r - l - prink + 1)
	}
}


package main

import "fmt"

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

func gcd(a, b int64) int64 {
	var r int64
	if b > a {
		a, b = b, a
	}
	for {
		r = a % b
		if r == 0 {
			break
		}
		a = b
		b = r
	}
	return b
}

func main() {
	var t,w,b int64
	fmt.Scanf("%d %d %d",&t,&w,&b)
    p:=gcd(w,b)
    qw:=w/p
    qb:=b/p
    k:=t/p/qw/qb
    m:=min(w,b)-1
    r:=k + m*k + min(m,t-k*p*qw*qb)
    if r>0 {
	    rt:=gcd(r,t)
    	r,t=r/rt,t/rt
	    fmt.Printf("%d/%d\n",r,t)
	} else {
		fmt.Printf("0/1\n")
	}
}


package main

import (
	"container/list"
	"fmt"
)

type Item struct {
	value int
	depth int
}

type Queue struct {
	data *list.List
}

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

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

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

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

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

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

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

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

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

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

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

	return ans
}

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


package main

import "fmt"

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

	for m > n {
		if m % 2 == 0 {
			m /= 2
		}else {
			m++
		}
		ans++
	}
	fmt.Println(ans + n - m)
}


package main

import "fmt"

func main() {
  var n, m, ans int
  fmt.Scanf("%d %d", &n, &m)
  ans = 0
  for m > n {
    if(m % 2 == 1) {
      m++
      ans++
    }
    m >>= 1
    ans++
  }
  ans += n - m
  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)
	}
}


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 {
		c1, n1 := findFirstBigger(n, m)
		//fmt.Println(c1, n1)
		bestTimes = c1 + (n1 - m)
	}
	//fmt.Println(bestTimes)
	//ret = make([]int, max*2+1)
	//for i := 0; i < len(ret); i++ {
	//	ret[i] = -1
	//}
	dfs1(n, m, 0)
	fmt.Println(bestTimes)
}

func dfs1(n int, m int, count int) {
	//fmt.Println(n, m, count)
	if count > bestTimes {
		return
	}
	if n == m {
		if count < bestTimes {
			bestTimes = count
		}
		//fmt.Println("====")
		return
	}
	if n == 0 {
		//fmt.Println("====")
		return
	}
	if n > m {
		if count+n-m < bestTimes {
			bestTimes = count + n - m
		}
		//fmt.Println("====")
		return
	} else {
		if m%2 == 0 {
			dfs1(n, m/2, count+1)
		} else {
			_, n1 := findFirstBigger(n, m)
			for i := n1; i > m; i-- {
				if i%2 == 0 {
					dfs1(n, i, count+i-m)
				}
			}
		}

	}
}

// 次数， temp
func findFirstBigger(n, m int) (int, int) {
	temp := n
	count := 0
	for {
		count++
		temp *= 2
		if temp >= m {
			return count, temp
		}
	}
}


package main

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

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)
	cnt := 0
	for m > n {
		if m%2 == 0 {
			m /= 2
		} else {
			m++
		}
		cnt++
	}
	fmt.Println(cnt + n - m)
}

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


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

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++
			tims++
			for {
				if m <= n {
					break
				}
				if m%2 != 0 {
					m++
					tims++
				}
				m = m / 2
				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"

/**Only for test**/
type Node struct{
	next *Node
	data int
}
type queue struct{
	head *Node
	tail *Node
	size int
}
func (q *queue)push(v int){
	var newVal = new(Node);
	newVal.next = nil;
	newVal.data = v;
	if(q.head == nil){
		q.head = newVal;
		q.tail = newVal;
	}else{
		q.tail.next = newVal;
		q.tail = newVal;
	}
	q.size ++;
}
func (q queue)empty()bool{
	return (q.size == 0);
}
func (q *queue)pop(){
	if(q.empty() == true){
		panic("you are poping empty queue");
	}
	if(q.head.next == nil){
		q.head = nil;
		q.tail = nil;
	}else{
		q.head = q.head.next;
	}
	q.size --;
}
func (q queue)front()int{
	if(q.empty() == true){
		panic("you getting first element from empty queue");
	}
	return q.head.data;
}

func main() {
	var n, m int;
	fmt.Scan(&n, &m);
	var q queue;
	q.push(n);
	var a[100000] int;
	for i := 1; i < 100000; i ++{
		a[i] = 1e9;
	}
	a[n] = 0;
	for !q.empty(){
		var v = q.front();
		q.pop();
		if(v * 2 < 100000 && a[v * 2] > a[v] + 1){
			a[v * 2] = a[v] + 1;
			q.push(v * 2);
		}
		if(v - 1 > 0 && a[v - 1] > a[v] + 1){
			a[v - 1] = a[v] + 1;
			q.push(v - 1);
		}
	}
	fmt.Println(a[m]);
}


package main

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

// There are two buttons, one red and another blue
// Pressing red button multiplies n by 2
// Pressing blue button reduces n by 1
// What is the minimum number of clicks to reduce 'n' to 'm'?

func min_clicks(n, m int) int {
	if n >= m {
		return n - m
	}
	if m % 2 == 1 {
		return min_clicks(n, m + 1) + 1
	}
	return min_clicks(n, m / 2) + 1
}

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


package main

import (
	"fmt"
	"container/list"
)

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

	var distance [20005]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 (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n, m := scanInt(), scanInt()
	count := 0

	for m > n{
		if m % 2 == 0{
			m /= 2
		}else{
			m++
		}
		count++
	}
	printFmt(count + n - m)
	close(channelType)
	oWg.Wait()
}

func getMax(n, m int) string{
	var max string
	for m > 9{
		max = max + "9"
		m -= 9
		n--
	}

	max = max + strconv.Itoa(m)
	n--
	for i := 0; i < n; i++{
		max = max + "0"
	}
	return max
}

func getMin(n, m int) string{
	var min string
	for m > 9{
		min = "9" + min
		m -= 9
		n--
	}

	if n == 1{
		min = strconv.Itoa(m) + min
	}else{
		if m > 1{
			min = strconv.Itoa(m-1) + min
			n--
		}

		for i:= 0; i < n-1; i++{
			min = "0" + min
		}
		min = "1" + min
	}
	return min
}

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

var channelType chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var printFmt func(a ...interface{}) (n int, err error)

func init() {
	printFmt = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	channelType = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range channelType {
			writer.WriteString(line + "\n")
		}
	}()
}

func scanString() string {in.Scan(); return in.Text() }
func scanInt() int {i, _ := strconv.Atoi(scanString()); return i}
func scanInt64() int64 {i, _ := strconv.ParseInt(scanString(), 10, 64); return i}
func scanStringSlice(n int) []string {s := make([]string, n); for i := 0; i < n; i++ {s[i] = scanString()}; return s}
func scanIntSlice(n int) []int {arr := make([]int, n); for i := 0; i < n; i++ {arr[i] = scanInt()}; return arr}
func scanInt64Slice(n int) []int64 {arr := make([]int64, n); for i := 0; i < n; i++ {arr[i] = scanInt64()}; return arr}

/*********************** Utils ***********************/

func stringEquivalent(v interface{}) string {return fmt.Sprintf("%v", v)}
func spaceSeperatedStringFromArray(a []int) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.Itoa(a[i]) + " ")}; return sb.String()}
func spaceSeperatedStringFromArray64(a []int64) string {sb := strings.Builder{}; sb.Grow(len(a) * 9); for i := range a {sb.WriteString(strconv.FormatInt(a[i], 10) + " ")}; return sb.String()}
func minMaxFromArray(args ...int64) (int64, int64) {minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64); for _, v := range args {if v < minVal {minVal = v}; if v > maxVal {maxVal = v}}; return minVal, maxVal}
func minElementFromArray(args ...int64) int64 { mn, _ := minMaxFromArray(args...); return mn }
func maxElementFromArray(args ...int64) int64 { _, mx := minMaxFromArray(args...); return mx }
func lcmCalculation(a, b int64) int64 {return a / gcdCalculation(a, b) * b}
func gcdCalculation(a, b int64) int64 {if (a == 0) {return b}; return gcdCalculation(b%a, a)}
func sortInt64Slice(a []int64) {sort.Slice(a, func(i, j int) bool { return a[i] < a[j] })}
func absoluteValue(x int64) int64 {if x < 0 {return -x}; return x}
func min(args ...int) int { mn, _ := minMaxFinder(args...); return mn }
func max(args ...int) int { _, mx := minMaxFinder(args...); return mx }
func minMaxFinder(args ...int) (int, int) { minVal, maxVal := int(math.MaxInt32), int(math.MinInt32); for _, v := range args { if v < minVal { minVal = v }; if v > maxVal { maxVal = v } }; return minVal, maxVal }


// 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 el.current*2 < 10001 && 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 (
	//"bytes"
	"fmt"
	//"strconv"
)

/*func main() {

	var n, x, y int
	a, b, c := 0, 0, 0
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x, &y)
		a += x
		b += y
		if x%2 != y%2 {
			c++
		}
	}
	if a%2 == 0 && b%2 == 0 {
		fmt.Print("0")
	} else if c%2 == 0 && c > 0 {
		fmt.Print("1")
	} else {
		fmt.Print("-1")
	}
}*/

func Max(n int, g int) int {
	if n > g {
		return n
	} else {
		return g
	}
}

func Min(n int, g int) int {
	if n > g {
		return g
	} else {
		return n
	}
}

func main() {

	var n, g, f, ans int
	//var buffer bytes.Buffer

	fmt.Scan(&n, &g)

	if n < g {
		max := Max(n, g)
		min := Min(n, g)

		for max > min {
			if max%2 == 0 {
				max /= 2
			} else {
				max++
			}
			ans++
			//buffer.WriteString(fmt.Sprint(strconv.Itoa(max), strconv.Itoa(min)))
			//println(buffer.String())
		}

		if max == min {
			fmt.Println(ans)
		} else {
			ans += min - max
			fmt.Println(ans)
		}
	} else {
		ans += n - g
		fmt.Println(ans)
	}
	fmt.Scan(&f)

}


package main

import "fmt"

/**Only for test**/
type Node struct{
	next *Node
	data int
}
type queue struct{
	head *Node
	tail *Node
	size int
}
func (q *queue)push(v int){
	var newVal = new(Node);
	newVal.next = nil;
	newVal.data = v;
	if(q.head == nil){
		q.head = newVal;
		q.tail = newVal;
	}else{
		q.tail.next = newVal;
		q.tail = newVal;
	}
	q.size ++;
}
func (q queue)empty()bool{
	return (q.size == 0);
}
func (q *queue)pop(){
	if(q.empty() == true){
		panic("you are popping empty queue");
	}
	if(q.head.next == nil){
		q.head = nil;
		q.tail = nil;
	}else{
		q.head = q.head.next;
	}
	q.size --;
}
func (q queue)front()int{
	if(q.empty() == true){
		panic("you getting first element from empty queue");
	}
	return q.head.data;
}

func main() {
	var n, m int;
	fmt.Scan(&n, &m);
	var q queue;
	q.push(n);
	var a[100000] int;
	for i := 1; i < 100000; i ++{
		a[i] = 1e9;
	}
	a[n] = 0;
	for !q.empty(){
		var v = q.front();
		q.pop();
		if(v * 2 < 100000 && a[v * 2] > a[v] + 1){
			a[v * 2] = a[v] + 1;
			q.push(v * 2);
		}
		if(v - 1 > 0 && a[v - 1] > a[v] + 1){
			a[v - 1] = a[v] + 1;
			q.push(v - 1);
		}
	}
	fmt.Println(a[m]);
}


package main

import (
	"fmt"
)

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

func parse(n, m int) int {
	if n == m {
		return 0
	}
	if n > m {
		return n - m
	}
	return 1 + (m % 2) + parse(n, m/2+(m%2))
}

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

	fmt.Print(r)
}


package main

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

func I(i interface{}, delim string) error {
	_, err := fmt.Fscanf(r, "%v"+delim, i)
	return err
}

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

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

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

func main() {
	defer w.Flush()
	var n uint64
	for I(&n, "\n") == nil {
		solve(n)
	}
}

func solve(n uint64) {
	if n == 0 {
		O("1", "\n")
		return
	}
	O([]int{8, 4, 2, 6}[(n-1)%4], "\n")
}


package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	if N == 0 {
		fmt.Println(1)
		return
	}

	ans := 0
	N--
	switch N % 4 {
	case 0:
		ans = 8
	case 1:
		ans = 4
	case 2:
		ans = 2
	case 3:
		ans = 6
	}
	fmt.Println(ans)

}

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1<<13)
	writer := bufio.NewWriterSize(os.Stdout, 1<<13)
	n := ReadInt(reader)
	fmt.Println(solve(8, n))
	writer.Flush()
}

func solve(d, n int) int {
	if n == 0 {
		return 1
	}
	res := solve((d*d)%10, n/2)
	if n&1 > 0 {
		res *= d
	}
	return res % 10
}

func ReadInt(reader *bufio.Reader) int {
	return int(ReadInt64(reader))
}

func ReadInt64(reader *bufio.Reader) int64 {
	b, err := reader.ReadByte()
	for !isValid(b, err) {
		b, err = reader.ReadByte()
	}
	sign := int64(1)
	if b == '-' {
		sign *= -1
		b, err = reader.ReadByte()
	}
	res := int64(0)
	for isValid(b, err) {
		res = res*10 + int64(b-'0')
		b, err = reader.ReadByte()
	}
	return res * sign
}

func isValid(b byte, err error) bool {
	return err == nil && (('0' <= b && b <= '9') || b == '-')
}


package main

import (
	"io"
	"os"
)

func main() {
	// allow for up to 102 entries (line plus newline)
	b := make([]byte, 102)

	// allow for up to 201 entries (dot plus newline)
	out := make([]byte, 0, 201)

	n, errRead := os.Stdin.Read(b)
	if errRead != nil && errRead != io.EOF {
		os.Exit(1)
	}

	b = b[:n]

	for _, c := range b {
		if c >= 'A' && c <= 'Z' {
			c += 32 // 'a' - 'A' = 32
		}

		switch {
		case c < 'A': // newline: append as-is
			out = append(out, c)
		case c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y':
			continue
		default:
			out = append(out, '.', c)
		}
	}

	os.Stdout.Write(out)
}


package main

import(
	"fmt"
	"strings"
)

func main(){

	var s string
	fmt.Scan(&s)

	s = strings.ToLower(s)

	n:= len(s)

	sol := ""
	for i := 0 ; i < n ; i ++{
		if !( s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u'||s[i]=='y' ){
			sol = sol +"."+string(s[i])
		}

	}

	fmt.Printf("%s\n",sol)
}


package main

import (
	"fmt"
	"strings"
)

// func Test(t *testing.T) {
// 	a := assert.New(t)

// 	a.Equal(".t.r", do("tour"))
// 	a.Equal(".c.d.f.r.c.s", do("Codeforces"))
// 	a.Equal(".w.p.w.l", do("wpwl"))
// 	a.Equal(".k.t.j.q.h.p.q.s.v.h.w", do("ktajqhpqsvhw"))
// }

func main() {
	var s string
	fmt.Scan(&s)
	s = strings.ToLower(s)
	for i := 0; i < len(s); i++ {
		if s[i] == 'y' || s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u' {
			continue
		}
		fmt.Printf("%c%c", '.', s[i])
	}
}


package main

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

func start() {
	s := sstring()
	n := len(s)
	if n == 1 {
		if s[0] == '0' || s[0] == '_' || s[0] == 'X' {
			wlstring("1")
			return
		} else {
			wlstring("0")
			return
		}
	}
	if s[0] == '0' {
		wlstring("0")
		return
	}
	hasX := 0
	for _, v := range s {
		if v == 'X' {
			hasX = 1
			break
		}
	}
	ltemps := []string{"25", "50", "75"}
	if n != 2 {
		ltemps = append(ltemps, "00")
	}
	ending := s[n-2 : n]
	rTot := 0
	for _, temp := range ltemps {
		tempOk, xVal := true, byte('a')
		for i := range ending {
			c := ending[i]
			if c == '_' {
			} else if c == 'X' {
				if xVal != 'a' && xVal != temp[i] {
					tempOk = false
					break
				}
				xVal = temp[i]
			} else {
				if c != temp[i] {
					tempOk = false
					break
				}
			}
		}
		//
		if tempOk {
			if s[0] == 'X' && xVal == '0' {
			} else {
				r := func() int {
					if n == 2 {
						return 1
					} else if s[0] == '_' {
						return 9
					} else {
						return 1
					}
				}()
				for i := 1; i < n-2; i++ {
					if s[i] == '_' {
						r *= 10
					}
				}
				rX := 1
				if hasX == 1 && xVal == 'a' {
					rX = 10
					if s[0] == 'X' {
						rX = 9
					}
				}
				rTot += r * rX
			}
		}
	}
	wlint(rTot)
}

func main() {
	start()
	// flush
	writer.Flush()
}

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

// io utils

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

func wstring(s string) {
	writer.WriteString(s)
}
func wrune(r rune) {
	writer.WriteRune(r)
}
func wint(i int) {
	wstring(strconv.Itoa(i))
}
func wlstring(s string) {
	writer.WriteString(s)
	wrune('\n')
}
func wlrune(r rune) {
	writer.WriteRune(r)
	wrune('\n')
}
func wlint(i int) {
	wstring(strconv.Itoa(i))
	wrune('\n')
}

func init() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 4096), 1e9)
}

func printls(in []int) {
	for _, v := range in {
		wint(v)
		wrune(' ')
	}
	wlstring("")
}

func sint() int {
	i, err := strconv.Atoi(sstring())
	if err != nil {
		panic("sint: Error")
	}
	return i
}

func sints(n int) []int {
	a := make([]int, n)
	for i := range a {
		a[i] = sint()
	}
	return a
}

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


package main

import (
	"fmt"
)

func main() {
	var n, d int
	fmt.Scan(&n, &d)
	var a string
	fmt.Scan(&a)
	i := 0
	flag := false
	count := 0
	var j int
	for i < n {
		if i+d >= n {
			j = n - 1
		} else {
			j = i + d
		}
		for (j > i && j < n) && a[j] != '1' {
			j--
		}
		if j <= n-1 {
			if a[j] != '1' || j == i {
				flag = true
				break
			} else {
				i = j
				if j == n-1 {
					count++
					break
				}
				count++
			}
		}
	}
	if flag {
		fmt.Println(-1)
	} else {
		fmt.Println(count)
	}
}


package main

import "fmt"

func main() {
	// 从左开始遇到1就扩大右边界，直到超出右边界为止。
	var (
		n, d int
		s    string
	)
	fmt.Scanf("%d%d", &n, &d)
	fmt.Scan(&s)
	f := make([]int, n)
	for i := 0; i < n; i++ {
		f[i] = -1
	}
	if s[0] == '1' {
		f[0] = 0
	}
	for l, r := 0, 0; l <= r; l++ {
		if s[l] != '1' {
			continue
		}
		for r < l+d && r+1 < n {
			r++
			if s[r] == '1' {
				f[r] = f[l] + 1
			}
		}
	}

	fmt.Printf("%d\n", f[n-1])
}


package main

import (
  "fmt"
)

var n int
var d int

func ReadData() []int {
  fmt.Scanf("%d %d", &n, &d)

  var line string = ""
  fmt.Scan(&line)

  result := make([]int, 0)
  for i := 0; i < n; i++ {
    if line[i] == '1' {
      result = append(result, i)
    }
  }
  return result
}

func Solve(line []int) int {
  dp := make([]int, 1 + len(line))
  for i := 0; i < len(dp); i++ {
    dp[i] = 2 * len(line);
  }
  dp[0] = 0;
  for i := 1; i < len(line); i++ {
    current := line[i]

    result := 2 * len(dp)
    for j := i - 1; j >= 0; j-- {
      if d < current - line[j] {
        break
      }
      if dp[j] == 2 * len(dp) {
        continue
      }
      if dp[j] + 1 < result {
        result = dp[j] + 1
      }
    }
    dp[i] = result
  }

  if dp[len(line) - 1] == 2 * len(dp) {
    return -1;
  }
  return dp[len(line) - 1]
}

func main() {
  line := ReadData()
  fmt.Println(Solve(line))
}


package main

import (
	"fmt"
	"math"
)

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

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


package main

import (
	"fmt"
)

var digitsMap = map[int]int{
	1: 10,
	2: 100,
	3: 1000,
	4: 10000,
	5: 100000,
	6: 1000000,
}

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

	result := 0
	for i := 1; i <= k; i++ {
		reversed, digits := reverse(i)
		var num uint64 = uint64(i)*uint64(digitsMap[digits]) + uint64(reversed)
		result = (result + int(num%uint64(p))) % p
	}

	fmt.Println(result)
}

func reverse(num int) (reversed, digits int) {

	for ; num > 0; num /= 10 {
		reversed = (reversed * 10) + num%10
		digits++
	}

	return
}


package main

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

func zcy(n int64) int64 {
	keta := int64(0)

	m := n
	for m > 0 {
		m /= 10
		keta++
	}
	a := pow(10, keta) * n
	for p := keta - 1; p >= 0; p-- {
		a += (n % 10) * pow(10, p)
		n /= 10
	}
	return a

}

//aのb乗をします O(log b)
func pow(a int64, b int64) int64 {
	total := int64(1)
	tmp := a
	for b > 0 {
		if b%2 == 1 {
			total *= tmp
		}
		b /= 2
		tmp *= tmp
	}
	return total
}

func main() {
	sc := NewScanner()
	k, p := sc.NextInt(), sc.NextInt()

	sum := int64(0)
	for i := 1; i <= k; i++ {
		sum += zcy(int64(i))
		sum %= int64(p)
	}
	fmt.Println(sum)

}

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

func main() {

  var pages, initialSpeed, maxSpeed, acceleration, rereadPages int
  fmt.Scanf("%d %d %d %d %d", &pages, &initialSpeed, &maxSpeed, &acceleration, &rereadPages)

  var day int = 0
  for pages > 0 {
    var pageRead int = int(math.Min(float64(initialSpeed + day * acceleration), float64(maxSpeed)))
    if day > 0 {
      pageRead -= rereadPages
    }
    pages -= pageRead
    day += 1
  }

  fmt.Println(day)
}


package main

import (
	"fmt"
)

func main() {
	var c, v0, v1, a, l int
	fmt.Scanf("%d %d %d %d %d", &c, &v0, &v1, &a, &l)
	if v0 >= c {
		fmt.Println(1)
	} else {
		day := 2
		for read := v0; read < c; day++ {
			v0 = min(v0+a, v1)
			read += v0-l
		}
		fmt.Println(day - 1)
	}
}

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


package main

/*
  The idea to solve this problem is just follow the instruction :P
  The amount of data is small & the complexity would only O(n) so just done it
  wit naive approach :P
*/

import (
  "fmt"
  "math"
)

func main() {

  var pages, initialSpeed, maxSpeed, acceleration, rereadPages int
  fmt.Scanf("%d %d %d %d %d", &pages, &initialSpeed, &maxSpeed, &acceleration, &rereadPages)

  var day int = 0
  for pages > 0 {
    var pageRead int = int(math.Min(float64(initialSpeed + day * acceleration), float64(maxSpeed)))
    if day > 0 {
      pageRead -= rereadPages
    }
    pages -= pageRead
    day += 1
  }

  fmt.Println(day)
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"math/rand"
	"os"
)

const INF  = 1000000001

type Pair struct {
	first, second int
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func sort(arr []int) []int {
	if len(arr) < 2 {
		return arr
	}
	left := 0
	right := len(arr) - 1
	pivot := rand.Int() % len(arr)

	arr[pivot], arr[right] = arr[right], arr[pivot]

	for i := 0; i < len(arr); i++ {
		if arr[i] < arr[right] {
			arr[i], arr[left] = arr[left], arr[i]
			left++
		}
	}

	arr[left], arr[right] = arr[right], arr[left]

	sort(arr[:left])
	sort(arr[left+1:])
	return arr
}

func solution(reader io.Reader, writer io.Writer) {
	var n int
	fmt.Fscanf(reader, "%d\n", &n)

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

	a = sort(a)

	for i := 0; i < n; i++ {
		fmt.Fprintf(writer, "%d ", a[i])
	}
}

func main() {

	//stdin, err := os.Open("file.in")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("file.out")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)
	defer writer.Flush()

	solution(reader, writer)
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	nums := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &nums[i])
	}
	sort.Ints(nums)
	for _, x := range nums {
		fmt.Printf("%d ", x)
	}
}


package main

import (
	"fmt"
	"sort"
)

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


package main

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

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int64
	fmt.Fscanf(buf, "%d\n", &n)
	var ans int64
	for i:=int64(3);i <= n;i++{
		ans += i*(i-1)
	}
	fmt.Printf("%d\n",ans)

}

/**
01010101
0101010
 */


package main

import(
	"fmt"
)

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

	var count int = 0
	for t>2{
		count += t*(t-1)
		t--
	}
	fmt.Println(count)
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n := 0
	fmt.Fscanf(in, "%d\n", &n)
	ans := int64(0)
	for i := 3; i <= n; i++ {
		ans += int64(i * (i - 1))
	}
	fmt.Fprintf(out, "%d\n", ans)
	return
}

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


package main

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

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

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

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

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

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

	p1, p2 := ReadInt32(), ReadInt32()

	if p1 == 1 && p2 == 1 {
		PrintInts(0)
		return
	}

	cnt := 0
	for p1 > 0 && p2 > 0 {
		cnt = cnt + 1
		if p1 > p2 {
			p1 = p1 - 2
			p2 = p2 + 1
		} else {
			p1 = p1 + 1
			p2 = p2 - 2
		}
	}

	PrintInts(cnt)
}


package main

import (
	"fmt"
)

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

	var f func(x, y int) int
	f = func(x, y int) int {
		var n int
		if x < y {
			x, y = y, x
		}
		if y == 0 {
			return n
		}
		if x == 1 && y == 1 {
			return n
		}
		if x == 2 {
			return 1
		}

		n = (x - 1) / 2
		x, y = x-2*n, y+n
		//fmt.Println(x, y)
		return n + f(x, y)
	}

	fmt.Println(f(a1, a2))
}


package main

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

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

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

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

    var a, b int
    fmt.Sscanln(Read(reader), &a, &b)

    if b > a {
        a, b = b, a
    }

    var result int = 1

    if a <= 1 && b <= 1 {
        result = 0
    }

    for a > 2 || b > 2 {
        var time int = ((a + 1) / 2) - 1
        result += time
        a -= time * 2
        b += time
        a, b = b, a
    }

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


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	n, k := 0, 0
	s := ""
	fmt.Fscanf(in, "%d %d\n", &n, &k)
	fmt.Fscanf(in, "%s\n", &s)
	//	fmt.Println(s)
	a := make([]int, 26)
	for i := 0; i < len(s); i++ {
		a[s[i]-'a'] = 1
	}
	ans := 0
	cnt := 0
	for i := 0; i < k; i++ {
		for j := 0; j < 26; j++ {
			if a[j] == 1 {
				ans += j + 1
				cnt++
				a[j] = 0
				if j+1 < 26 {
					a[j+1] = 0
				}
				break
			}
		}
	}
	//fmt.Println(ans, cnt)
	if cnt < k {
		fmt.Fprintf(out, "%d\n", -1)
	} else {
		fmt.Fprintf(out, "%d\n", ans)
	}
	return
}


package main

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

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

	var str string
	fmt.Scanln(&str)

	unsorted := strings.Split(str, "")
	sort.Strings(unsorted)
	sorted := strings.Join(unsorted, "")
	s := []rune(sorted)

	weight := s[0] - 96
	count := 1
	prev := 0
	for i := 1; i < k; i++ {
		if count == n {
			break
		}

		if s[i]-s[prev] < 2 {
			continue
		}

		weight += s[i] - 96
		count++
		prev = i
	}

	if count < n {
		fmt.Println("-1")
	} else {
		fmt.Println(weight)
	}
}


// cf1011a project main.go
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, l int
	var s string
	fmt.Scan(&n, &l)
	fmt.Scan(&s)
	var sl []int
	for _, r := range s {
		sl = append(sl, int(r-'a')+1)
	}
	sort.Ints(sl)
	v := 0
	la := -1
	for _, i := range sl {
		if l > 0 {
			if i > la+1 {
				v += i
				la = i
				l--
			}
		}
		if l == 0 {
			break
		}
	}
	if l == 0 {
		fmt.Println(v)
	} else {
		fmt.Println(-1)
	}
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF869C(in io.Reader, out io.Writer) {
	const m = 998244353
	const mx = 5000
	F := [mx + 1]int64{1}
	for i := 1; i <= mx; i++ {
		F[i] = F[i-1] * int64(i) % m
	}
	pow := func(x, n int64) int64 {
		res := int64(1)
		for ; n > 0; n >>= 1 {
			if n&1 == 1 {
				res = res * x % m
			}
			x = x * x % m
		}
		return res
	}
	invF := [...]int64{mx: pow(F[mx], m-2)}
	for i := mx; i > 0; i-- {
		invF[i-1] = invF[i] * int64(i) % m
	}
	C := func(n, k int) int64 { return F[n] * invF[k] % m * invF[n-k] % m }
	f := func(a, b int) (s int64) {
		for i := 0; i <= a && i <= b; i++ {
			s = (s + C(a, i)*C(b, i)%m*F[i]) % m
		}
		return
	}

	var a, b, c int
	Fscan(in, &a, &b, &c)
	Fprint(out, f(a, b)*f(b, c)%m*f(a, c)%m)
}

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


package main

import (
	"fmt"
	"sort"
)

const mod = 998244353

var comb [][]int = nil
var fac []int64 = nil

func helper(m int, n int) int64 {
	res := int64(0)
	combm, combn := comb[m], comb[n]
	for i, t := range combm {
		res += int64(t) * int64(combn[i]) % mod * fac[i] % mod
	}
	return res % mod
}

func main() {
	abc := []int{0, 0, 0}
	fmt.Scan(&abc[0], &abc[1], &abc[2])
	sort.Ints(abc)
	a, b, c, cur, f := abc[0], abc[1], abc[2], []int{1}, int64(1)
	comb, fac = make([][]int, c+1), make([]int64, c+1)
	comb[0], fac[0] = cur[:], 1
	for i := 1; i <= c; i++ {
		nxt, u := make([]int, i+1), 0
		f = f * int64(i) % mod
		for j, v := range cur {
			nxt[j] = (u + v) % mod
			u = v
		}
		nxt[i], fac[i], comb[i], cur = 1, f, nxt, nxt
	}
	fmt.Println(helper(a, b) * helper(a, c) % mod * helper(b, c) % mod)
}


package main

import (
	. "fmt"
)

// github.com/EndlessCheng/codeforces-go
func main() {
	const m = 998244353
	const mx = 5000
	F := [mx + 1]int64{1}
	for i := 1; i <= mx; i++ {
		F[i] = F[i-1] * int64(i) % m
	}
	pow := func(x, n int64) int64 {
		res := int64(1)
		for ; n > 0; n >>= 1 {
			if n&1 == 1 {
				res = res * x % m
			}
			x = x * x % m
		}
		return res
	}
	invF := [...]int64{mx: pow(F[mx], m-2)}
	for i := mx; i > 0; i-- {
		invF[i-1] = invF[i] * int64(i) % m
	}
	C := func(n, k int) int64 { return F[n] * invF[k] % m * invF[n-k] % m }
	f := func(a, b int) (s int64) {
		for i := 0; i <= a && i <= b; i++ {
			s = (s + C(a, i)*C(b, i)%m*F[i]) % m
		}
		return
	}

	var a, b, c int
	Scan(&a, &b, &c)
	Print(f(a, b) * f(b, c) % m * f(a, c) % m)
}


// 304A
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, n int
	s := 0
	fmt.Scan(&n)
	for a = 1; a <= n; a++ {
		for b = a; b <= n; b++ {
			c := int(math.Sqrt(float64(a*a + b*b)))
			if c <= n && c*c == a*a+b*b {
				s++
			}
		}
	}
	fmt.Println(s)
}


package main

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

var w *bufio.Writer

var sc *bufio.Scanner

const minus, zero byte = '-', '0'

func nextInt() int {
	var ans, fst int = 0, 0
	var neg bool = false
	sc.Scan()
	if sc.Bytes()[0] == minus {
		fst = 1
		neg = true
	}
	for _, j := range sc.Bytes()[fst:] {
		ans = ans*10 + int(j-zero)
	}
	if neg == true {
		ans = -ans
	}
	return ans
}

func printInt(n int) {
	w.WriteString(strconv.Itoa(n) + " ")
}

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

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

func main() {

	w = bufio.NewWriter(os.Stdout)
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	cnt := 0

	N := nextInt()
	for m := 1; m <= N; m++ {
		for n := m; 2*m*n <= N; n++ {
			a, b, c := 2*m*n, n*n-m*m, n*n+m*m
			if a > b {
				a, b = b, a
			}
			if gcd(m, n) == 1 && (m^n)%2 == 1 && b <= N && c <= N {
				cnt += N / Max(Max(a, c), b)
			}
		}
	}
	printInt(cnt)
	w.Flush()
	//YOU FORGOT TO FLUSH!
}