// B. Squares and Cubes

package main

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

var tk []string
var ptr int = 0

func su() int {
	r, _ := strconv.Atoi(tk[ptr])
	ptr++
	return r
}
func main() {
	bytes, _ := ioutil.ReadAll(os.Stdin)
	tk = strings.Fields(string(bytes))

	const MM int = 1e9
	arr := make([]int, 0, 33000)
	for i := 1; i*i <= MM; i++ {
		arr = append(arr, i*i)
	}
	for i := 1; i*i*i <= MM; i++ {
		cube := i * i * i
		sqrt := int(math.Sqrt(float64(cube)))
		if sqrt*sqrt == cube {
			continue
		}
		arr = append(arr, cube)
	}
	sort.Slice(arr, func(i int, j int) bool { return arr[i] < arr[j] })

	t := su()
	for t > 0 {
		n := su()
		lo, hi := 0, len(arr)-1
		for lo <= hi {
			mid := (lo + hi) / 2
			if arr[mid] > n {
				hi = mid - 1
			} else {
				lo = mid + 1
			}
		}
		fmt.Println(lo)
		t--
	}
}


package main

import "fmt"

func main() {
	var n, a, result int
	fmt.Scan(&n)
	for ; n > 0; n-- {
		fmt.Scan(&a)
		if a > 0 {
			result += a
		} else {
			result -= a
		}
	}
	fmt.Print(result)
}


package main
import "fmt"
func main() {
	var n,x int
	fmt.Scan(&n)
	a,b := 0,0
	for ;n>0;n-- {
		fmt.Scan(&x)
		if x > 0 {
			a += x
		} else {
			b -= x
		}
	}
	fmt.Print(a+b)
}


package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	A := sc.NextIntArray()
	total := 0
	for i := 0; i < N; i++ {
		total += abs(A[i])
	}
	fmt.Println(total)
}

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

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"
	"io/ioutil"
	"log"
	"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)
	log.SetOutput(ioutil.Discard)
	// log.SetOutput(os.Stderr)

	n, a, b, p, q := nextInt64(), nextInt64(), nextInt64(), nextInt64(), nextInt64()
	log.Print(n*gcd(a, b)/(a*b), min(p, q))
	println(n/a*p + n/b*q - n*gcd(a, b)/(a*b)*min(p, q))
}

func gcd(x, y int64) int64 {
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

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

	return b
}

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

func main() {
	s := getWord()
	eidx := strings.LastIndexByte(s, 'e')
	b, _ := strconv.Atoi(s[eidx+1:])
	s = string(s[0]) + s[2:eidx] + strings.Repeat("0", 105)
	s = s[:b+1] + "." + s[b+1:]
	s = strings.Trim(s, "0")
	if strings.HasPrefix(s, ".") {
		s = "0" + s
	}
	if strings.HasSuffix(s, ".") {
		s = strings.TrimRight(s, ".")
	}
	fmt.Println(s)
}

type Input struct {
	*bufio.Scanner
}

var globalInput = wrapStdin()

func wrapStdin() Input {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return Input{Scanner: sc}
}
func getInt() int {
	globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x
}
func getIntOk() (int, bool) {
	ok := globalInput.Scan()
	x, _ := strconv.Atoi(globalInput.Text())
	return x, ok
}
func getNint(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		v[i] = getInt()
	}
	return v
}
func getVint(v []int) bool {
	var ok bool
	for i := 0; i < len(v); i++ {
		v[i], ok = getIntOk()
	}
	return ok
}
func getWord() string {
	globalInput.Scan()
	return globalInput.Text()
}
func getWordOk() (string, bool) {
	ok := globalInput.Scan()
	return globalInput.Text(), ok
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func minStr(a, b string) string {
	if a < b {
		return a
	}
	return b
}
func maxStr(a, b string) string {
	if a < b {
		return b
	}
	return a
}
func remin(a *int, b int) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax(a *int, b int) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func remin64(a *int64, b int64) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remax64(a *int64, b int64) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}
func reminStr(a *string, b string) bool {
	if b < *a {
		*a = b
		return true
	}
	return false
}
func remaxStr(a *string, b string) bool {
	if b > *a {
		*a = b
		return true
	}
	return false
}

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

type (
	FLess    func(i, j int) bool
	FSwap    func(i, j int)
	wrapSort struct {
		Length int
		FLess
		FSwap
	}
)

func (w *wrapSort) Len() int           { return w.Length }
func (w *wrapSort) Less(i, j int) bool { return w.FLess(i, j) }
func (w *wrapSort) Swap(i, j int)      { w.FSwap(i, j) }
func wsort(length int, fless func(i, j int) bool, fswap func(i, j int)) {
	sort.Sort(&wrapSort{length, fless, fswap})
}


package main

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

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

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

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

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

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

	return r
}

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

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


package main

import "fmt"

func main() {
    var n,k int
    fmt.Scan(&n,&k)
    if (k/n) > 2 {
        fmt.Println(0)
    } else {
        fmt.Println(n-(k%n))
    }
}


package main

import "fmt"

func bs(n, k int) int {
    //Find the answer
    var lo, hi, mid, ans int = 0, n, 0, 0
    for lo <= hi {
        mid = (lo+hi)/2
        left := k-2*mid
        if (n-mid)*3 <= left {
            ans = mid
            hi = mid-1
        } else {
            lo = mid+1
        }
    }
    return ans
}

func main() {
    var n, k int

    fmt.Scan(&n, &k)

    fmt.Println(bs(n, k))
}


package main

import (
	"fmt"
)

func main() {
	var exams, total int
	fmt.Scanf("%d", &exams)
	fmt.Scanf("%d", &total)
  var minscores=exams*2
  var diff = total - minscores
  switch {
    case diff < 0: panic("")
    default:
      var diffdiff int = exams-diff
      switch {
        case diffdiff<=0: fmt.Println(0)
        default: fmt.Println(diffdiff)
      }
  }
}


package main

import (
	"fmt"
	"log"
	"math"
)

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

	//validate input
	if err != nil {
		log.Fatal(err)
		return
	}

	if input < 2 || float64(input) > math.Pow10(5) {
		fmt.Println("input out of range")
		return
	}

	count := 1

	for numberOfLeaders := 2; numberOfLeaders <= input/2; numberOfLeaders ++ {
		if input % numberOfLeaders == 0 {
			count += 1
		}
	}

	fmt.Println(count)
}


// cf935a project main.go
package main

import (
	"fmt"
)

func main() {
	var n, c int
	fmt.Scan(&n)
	for i := 2; i <= n/2; i++ {
		if n%i == 0 {
			c++
		}
	}
	c++
	fmt.Println(c)
}


//A. Фафа и его компания
package main

import (
	"fmt"
)

func main() {
	var n, rez int

	fmt.Scan(&n)

	for i := 2; i <= n; i++ {
		if n%i == 0 {
			rez++
		}
	}

	fmt.Println(rez)
}


package main

import "fmt"

func main() {
        var n int
        var in string
        fmt.Scan(&n, &in)
        var a, b int = 0, 0
        for i := 0; i < n; i++ {
                if in[i] != '4' && in[i] != '7' {
                        fmt.Println("NO")
                        return
                }
                if i < n/2 {
                        a += int(in[i] - '0')
                } else {
                        b += int(in[i] - '0')
                }
        }
        if a == b {
                fmt.Println("YES")
        } else {
                fmt.Println("NO")
        }
}


package main

import (
	"fmt"
)

func is_lucky(n int, num string) bool {
	half := 0
	total := 0
	for i := 0; i < n; i++ {
		if num[i] != '4' && num[i] != '7' {
			return false
		}

		if i < n/2 {
			half += int(num[i] - '0')
		}
		total += int(num[i] - '0')
	}

	return half == total-half
}

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

	var num string
	fmt.Scan(&num)

	if is_lucky(n, num) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

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

	reader := bufio.NewReader(os.Stdin)
	re := regexp.MustCompile(`\r?\n`)
	if s, err := reader.ReadString('\n'); err != nil {
		if err != io.EOF {
			return
		}
	} else {
		s = re.ReplaceAllString(s, "")

		lucky := true
		sum1 := 0
		sum2 := 0
		for i := 0; i < n; i++ {
			digit := int(s[i] - '0')
			if digit == 4 || digit == 7 {
				if i < n/2 {
					sum1 += digit
				} else {
					sum2 += digit
				}
			} else {
				lucky = false
				break
			}
		}
		if lucky && sum1 == sum2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}


package main

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

func main() {
	var k2, k3, k5, k6 int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &k2, &k3, &k5, &k6)
	i256 := min(k2, k5)
	i256 = min(i256, k6)
	k2 -= i256
	i32 := min(k2, k3)
	fmt.Println(256*i256 + 32*i32)
}

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


package main

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

func main() {
	sc := NewScanner()
	k2, k3, k5, k6 := sc.NextInt(), sc.NextInt(), sc.NextInt(), sc.NextInt()

	k := min(k2, min(k5, k6))
	k2 -= k

	ans := 256 * k + min(k2, k3) * 32

	fmt.Println(ans)

}

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

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

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

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

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

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

	return mp
}

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


package main

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

func solve() {
    k2, k3, k5, k6 := readInt(), readInt(), readInt(), readInt()
    sum := 0
    for k2 > 0 && k5 > 0 && k6 > 0 {
        sum += 256
        k2--
        k5--
        k6--
    }
    for k2 > 0 && k3 > 0 {
        sum += 32
        k2--
        k3--
    }
    fmt.Println(sum)

}

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

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

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

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

func min(x, y int) int {
	return x + y - max(x, y)
}

// IO

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

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

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

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


package main

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

func main() {
	A, B, C, D := scanInt64(), scanInt64(), scanInt64(), scanInt64()
	var res int64 = 0
	for i := max(A + B, C); i < C + D + 1; i++ {
		res += (i - A - B + 1 + max(0, i - B - C - 1) - max(0, i - A - C) - max(0, i - B - B)) * (min(i - C, D - C + 1))
	}
	_, _  = printFmt(res)
}

/*********************** 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 int64) []int64 {arr := make([]int64, n); for i := int64(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 ...int64) int64 { mn, _ := MnMx(args...); return mn }
func max(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func MnMx(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 sorting(array []int64, fromElement int, toElement int) []int64 {
	var arr []int64
	for i := fromElement; i <= toElement; i++ {
		arr = append(arr, array[i])
	}
	sort.Slice(arr, func(i, j int) bool { return arr[i] < arr[j] })
	s := 0
	for i := fromElement; i <= toElement; i++ {
		array[i] = arr[s]
		s++
	}
	return array
}

func reverse(numbers []int64) []int64 {
	for i, j := 0, len(numbers)-1; i < j; i, j = i+1, j-1 {
		numbers[i], numbers[j] = numbers[j], numbers[i] }
	return numbers
}

func reversing(array []int64, fromElement int, toElement int) []int64 {
	var arr []int64
	for i := fromElement; i <= toElement; i++ {
		arr = append(arr, array[i])
	}
	arr = reverse(arr)
	s := 0
	for i := fromElement; i <= toElement; i++ {
		array[i] = arr[s]
		s++
	}
	return array
}

func arraySum(array []int) int {
	var ans = 0
	for _, element := range array {
		ans += element
	}
	return ans
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"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 {
	NextInt64() int64
	NextUInt64() uint64
	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) 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) NextUInt64() uint64 {
	impl.Scan()
	bb := impl.Bytes()
	i := uint64(0)
	for _, b := range bb {
		i *= 10
		i += uint64(b - '0')
	}
	return i
}

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

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

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

func abs(a int64) int64 {
	if a < 0 {
		return a * -1
	}
	return a
}

func min(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r < a {
			a = r
		}
	}
	return a
}

func max(a int64, rest ...int64) int64 {
	for _, r := range rest {
		if r > a {
			a = r
		}
	}
	return a
}

const (
	INF = math.MaxInt64
	MOD = 1e9 + 7
)

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

func main() {
	defer writer.Flush()
	a, b, c, d := reader.NextInt64(),reader.NextInt64(),reader.NextInt64(),reader.NextInt64()
	ret := int64(0)
	nx := b - a + 1
	ny := c - b + 1
	for i := max(a + b, c + 1); i <= b + c; i ++ {
		count := min(b + c - i, i - (a + b)) + 1
		countxy := min(count, nx, ny)
		countz := min(d - c + 1, i - c)
		//writer.Printf("%d %d %d\n", i, countxy, countz)
		ret += countxy * countz
	}
	writer.Printf("%d\n", ret)
}


package main

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

type node struct {
	val    int
	length int
}

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	t := int64(1)
	//fmt.Fscanf(in, "%d\n", &t)
	for tt := int64(0); tt < t; tt++ {
		a, b, c, d := 0, 0, 0, 0
		fmt.Fscanf(in, "%d %d %d %d\n", &a, &b, &c, &d)
		ans := int64(0)
		for i := a; i <= b; i++ {
			firstB := i + b - c
			bestBPos := d - i + 1
			if bestBPos <= b {
				ans += int64(c-b+1) * int64(d-c+1)
			} else if bestBPos > b && bestBPos < c {
				first := firstB
				if first < 1 {
					first = 1
				}
				last := d - c + 1
				num := last - first + 1
				ans += int64(first+last) * int64(num) / 2
				ans += int64(d-c+1) * int64(c-bestBPos)
			} else {
				first := firstB
				if first < 1 {
					first = 1
				}
				last := i
				num := last - first + 1
				ans += int64(first+last) * int64(num) / 2
			}
			// allowedB := c - i + 1
			// bestB := d - i + 1
			// if allowedB < b {
			// 	allowedB = b
			// }
			// if bestB > c {
			// 	bestB = c
			// }
			// fmt.Println(allowedB, bestB)
			// if bestB < c {
			// 	xs := bestB - allowedB + 1
			// 	ans += int64(1+xs) * int64(xs) / 2
			// 	ans += int64(c-bestB) * int64(d-c+1)
			// } else {
			// 	xs := c - allowedB + 1
			// 	ans += int64(1+xs) * int64(xs) / 2
			// }
			//fmt.Println(ans)
		}
		fmt.Fprintf(out, "%d\n", ans)
	}
	return
}


package main

import "fmt"

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

func positive(a int) int {
	if a > 0 {
		return a
	}
	return 0
}

func main() {
	var a, b, c, d int64
	fmt.Scan(&a, &b, &c, &d)
	n := 2*d + 5
	sums := make([]int64, n)
	for x := a; x <= b; x++ {
		sums[x+b]++
		sums[x+c+1]--
	}
	for i := int64(1); i < n; i++ {
		sums[i] += sums[i-1]
	}
	for i := int64(1); i < n; i++ {
		sums[i] += sums[i-1]
	}
	var ans int64
	for z := c; z <= d; z++ {
		ans += int64(sums[n-1] - sums[z])
	}
	fmt.Println(ans)
}


package main

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

func main() {
	a, b, c, d := ScanInt64(), ScanInt64(), ScanInt64(), ScanInt64()
	P(solve(a, b, c, d))

	out.Flush()
}

func solve(a, b, c, d int64) int64 {
	sum := int64(0)
	p := make([]int64, Mx64(b+c+2, d+2))
	for i := a; i <= b; i++ {
		p[i+b] += 1
		p[i+c+1] += -1
	}
	for i := 1; i < len(p); i++ {
		p[i] += p[i-1]
	}

	for i := Mx64(b+c+1, d+1); i >= a; i-- {
		p[i-1] += p[i]
	}

	for i := c; i <= d; i++ {
		sum += int64(p[i+1])
	}
	return sum
}

/*********************** I/O ***********************/
var in *bufio.Scanner
var out *bufio.Writer

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)
	out = bufio.NewWriter(os.Stdout)
}

func P(args ...interface{}) {
	print("\n", args...)
}

func PS(args ...interface{}) {
	print(" ", args...)
	print("\n", nil)
}

func print(seperator string, args ...interface{}) {
	for _, arg := range args {
		str := ""
		switch v := arg.(type) {
		case byte:
			str = string(v)
		case rune:
			str = string(v)
		case int:
			str = strconv.Itoa(v)
		case []int:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.Itoa(v[i]) + " ")
			}
			str = sb.String()
		case int64:
			str = strconv.FormatInt(v, 10)
		case []int64:
			sb := strings.Builder{}
			for i := 0; i < len(v); i++ {
				sb.WriteString(strconv.FormatInt(v[i], 10) + " ")
			}
			str = sb.String()
		case string:
			str = v
		}
		out.WriteString(str + seperator)
	}
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanWords(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanInt() int { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInts(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = ScanInt()
	}
	return a
}
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanInt64s(n int) []int64 {
	a := make([]int64, n)
	for i := 0; i < n; i++ {
		a[i] = ScanInt64()
	}
	return a
}

/*********************** Utils int64 ***********************/
func MnMx64(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 Mn64(args ...int64) int64 { mn, _ := MnMx64(args...); return mn }
func Mx64(args ...int64) int64 { _, mx := MnMx64(args...); return mx }
func LCM64(a, b int64) int64   { return a / GCD64(a, b) * b }
func GCD64(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD64(b%a, a)
}
func SortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func Abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

/*********************** Utils int ***********************/
func MnMx(args ...int) (int, int) {
	minVal, maxVal := math.MaxInt32, math.MinInt32
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int) int { mn, _ := MnMx(args...); return mn }
func Mx(args ...int) int { _, mx := MnMx(args...); return mx }
func LCM(a, b int) int   { return a / GCD(a, b) * b }
func GCD(a, b int) int {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}


/*
URL:
https://codeforces.com/problemset/problem/1355/C
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	a, b, c, d int64

	memo [2000000 + 5]int64
)

func main() {
	a, b, c, d = ReadInt64_4()

	for x := a; x <= b; x++ {
		memo[b+x]++
		memo[c+x+1]--
	}
	for i := 1; i <= 2000000; i++ {
		memo[i] += memo[i-1]
	}
	// PrintfDebug("memo: %v\n", memo[:10])

	ans := int64(0)
	for i := a + b; i <= b+c; i++ {
		// [c, d] の範囲でiより厳密に小さいものの個数を数える
		ok := BinarySearch(0, 1000000, func(mid int64) bool {
			return mid < i
		})

		if c <= ok && ok <= d {
			num := ok - c + 1
			ans += memo[i] * num
		} else if d < ok {
			num := d - c + 1
			ans += memo[i] * num
		}
	}

	fmt.Println(ans)
}

func BinarySearch(initOK, initNG int64, isOK func(mid int64) bool) (ok int64) {
	ng := initNG
	ok = initOK
	for int(math.Abs(float64(ok-ng))) > 1 {
		mid := (ok + ng) / 2
		if isOK(mid) {
			ok = mid
		} else {
			ng = mid
		}
	}

	return ok
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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


package main

import (
	"fmt"
)

var cnt [1000001]int64

func main() {
	var a, b, c, d int64
	fmt.Scan(&a, &b, &c, &d)
	for z := a + b; z <= b + c; z++ {
		x := a
		if x + c < z {
			x = z - c
		}
		xx := b
		if xx + b > z {
			xx = z - b
		}
		cnt[z] = xx - x + 1
	}
	for z := b + c - 1; z > c; z-- {
		cnt[z] += cnt[z + 1]
	}
	var ans int64
	for z := c + 1; z <= d + 1; z++ {
		ans += cnt[z]
	}
	fmt.Println(ans)
}


package main

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

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

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

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

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

}


package main

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

func main() {
	r := bufio.NewReaderSize(os.Stdin, 1024*1024)
	inp := readInts(r, 6)

	x, y, z, t1, t2, t3 := inp[0],inp[1],inp[2],inp[3],inp[4],inp[5]

	if t2 * (abs(x-z) + abs(x-y)) + 3 * t3 <= t1 * abs(x-y) {
		fmt.Print("YES")
	} else {
		fmt.Print("NO")
	}
}

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

func readInts(reader *bufio.Reader, n int) []int {
	tmpInts := strings.Split(readLine(reader), " ")

	var result []int
	for i := 0; i < n; i++ {
		tmpInt, err := strconv.ParseInt(tmpInts[i], 10, 64)
		checkError(err)
		result = append(result, int(tmpInt))
	}
	return result
}

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

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

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


package main
import (
    "fmt"
)

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

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

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


package main

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

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

	return number
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	var mashaIn, mashaWant, elevatorIn, mashaSpeed, elevatorSpeed, elevatorDoorsToggleIn int

	fmt.Fscan(reader, &mashaIn, &mashaWant, &elevatorIn, &mashaSpeed, &elevatorSpeed, &elevatorDoorsToggleIn)

	var elevatorTimeCost = abs(elevatorIn-mashaIn)*elevatorSpeed + elevatorDoorsToggleIn*3 + abs(mashaIn-mashaWant)*elevatorSpeed
	var mashaTimeCost = abs(mashaWant-mashaIn) * mashaSpeed

	if elevatorTimeCost <= mashaTimeCost {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

	return
}


        package main

        import (
        	"fmt"
        )

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

        	for _, element := range cardInHand {
        		if string(cardOnTable[0]) == string(element[0]) || string(cardOnTable[1]) == string(element[1]) {
        			fmt.Println("YES")
        			return
        		}
        	}
        	fmt.Println("NO")
        }


package main

import (
	"fmt"
	"os"
)

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


package main

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

func main() {

	reader := bufio.NewReader(os.Stdin)
	currentCard, _ := reader.ReadString('\n')
	spisCardsStr, _ := reader.ReadString('\n')

	spisCards := strings.Split(spisCardsStr, " ")

	condition := 0
	for i := 0; i < len(spisCards); i++ {

		if (spisCards[i][0] == currentCard[0]) || (spisCards[i][1] == currentCard[1]) {
			condition = 1

		}

	}
	if condition == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


package main

import (
	"fmt"
)

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

func main() {
    var a,b int
    b=0
    fmt.Scan(&a)
    for i:=1;i<a;i++ {
    	if gcd(a-1,i)==1 {
    		b++
    	}
    }
    fmt.Println(b)
}


package main

import (
	"fmt"
)

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

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

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

	fmt.Println("NO")
}

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


package main

import (
	"fmt"
	"os"
)

type Rectangle struct {
	width, height int
}

func (r Rectangle) rotate() Rectangle {
	return Rectangle{width: r.height, height: r.width}
}

func (r Rectangle) can_contain_without_rotate(other Rectangle) bool {
	return (r.width >= other.width && r.height >= other.height)
}

func (r Rectangle) can_contain(other Rectangle) bool {
	return r.can_contain_without_rotate(other) ||
		r.can_contain_without_rotate(other.rotate())
}

func (r Rectangle) place_at_left_top(other Rectangle) []Rectangle {
	if r.can_contain_without_rotate(other) {
		return []Rectangle{Rectangle{width: r.width - other.width, height: r.height}, Rectangle{width: r.width, height: r.height - other.height}}
	} else {
		return []Rectangle{}
	}
}

func (r Rectangle) can_contain_2_rectangles_without_rotate(first, second Rectangle) bool {
	res := false
	t := r.place_at_left_top(first)
	for i := 0; i < len(t); i++ {
		if t[i].can_contain(second) {
			res = true
		}
	}
	return res
}
func (r Rectangle) can_contain_2_rectangles(first, second Rectangle) bool {
	return r.can_contain_2_rectangles_without_rotate(first, second) ||
		r.rotate().can_contain_2_rectangles_without_rotate(first, second)
}

func main() {
	// f, _ := os.Open("input.txt")
	f := os.Stdin
	var a, b, c Rectangle
	fmt.Fscanf(f, "%d %d\n%d %d\n%d %d", &a.width,
		&a.height, &b.width, &b.height, &c.width, &c.height)

	if a.can_contain_2_rectangles(b, c) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import (
	"fmt"
	"os"
)

type Rectangle struct {
	width, height int
}

func (r Rectangle) rotate() Rectangle {
	return Rectangle{width: r.height, height: r.width}
}

func (r Rectangle) can_place_without_rotate_into(container Rectangle) bool {
	return r.width <= container.width && r.height <= container.height
}
func (r Rectangle) place_at_left_top(sub Rectangle) []Rectangle {
	if sub.can_place_without_rotate_into(r) {
		first_rect := Rectangle{width: r.width - sub.width, height: r.height}
		second_rect := Rectangle{width: r.width, height: r.height - sub.height}
		return []Rectangle{first_rect, second_rect}
	} else {
		return []Rectangle{}
	}
}

func (r Rectangle) can_contain_2_rectangles(first, second Rectangle) bool {
	t := r.place_at_left_top(first)
	for i := 0; i < len(t); i++ {
		if second.can_place_without_rotate_into(t[i]) || second.rotate().can_place_without_rotate_into(t[i]) {
			return true
		}
	}
	return false
}

func main() {
	// f, _ := os.Open("input.txt")
	f := os.Stdin
	var a, b, c Rectangle
	fmt.Fscanf(f, "%d %d\n%d %d\n%d %d", &a.width,
		&a.height, &b.width, &b.height, &c.width, &c.height)

	if a.can_contain_2_rectangles(b, c) || a.rotate().can_contain_2_rectangles(b, c) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

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

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

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

func main() {
    defer out.Flush()
    in.Split(bufio.ScanWords)
    a := int64(nextInt())
    b := int64(nextInt())
    var sum, i int64
    mod := int64(1000000007)
    m := (b * (b - 1) / 2) % mod
    for i = 1; i <= a; i++ {
        sum = (sum + m * ((i * b) % mod + 1)) % mod
    }
    fmt.Fprintln(out, sum)
}


package main

import (
    "fmt"
)

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

    const (
        mod = 1e9 + 7
    )

    var res uint64
    one := uint64(1)
    two := uint64(2)

    B := (b * (b - one) / two) % mod
    A1 := (a * (a + one) / two) % mod
    A := (A1*b + a) % mod
    res = (A * B) % mod
    fmt.Println(res)
}


package main

import (
	"bufio"
	"bytes"
	"errors"
	"io"
	"math/rand"
	"os"
	"strconv"
	"time"
	"unicode/utf8"
)

// ******************************** CODE STARTS ********************************

const (
	MOD int64 = 1000 * 1000 * 1000 + 7
)

var (
)

func solve() {
	a := readInt()
	b := readInt()

	r := int64(0)
	for i := 1; i <= b - 1; i++ {
		r += int64(i)
		if r >= MOD {
			r -= MOD
		}
	}

	res := int64(a) * r % MOD

	k := int64(0)
	for i := 1; i <= a; i++ {
		k += int64(i) * r % MOD
		if k >= MOD {
			k -= MOD
		}
	}

	res += int64(b) * k % MOD
	if res >= MOD {
		res -= MOD
	}

	printInt64(res)
	printLine()

}

// ********************************* CODE ENDS *********************************

// IO.

var (
	scanner *Scanner
	writer  *bufio.Writer
)

func main() {
	input := os.Stdin
	output := os.Stdout
	//	input, _ := os.Open("")
	//	output, _ := os.Create("")

	defer input.Close()
	defer output.Close()

	scanner = NewScanner(input)
	scanner.Split(bufio.ScanWords)

	writer = bufio.NewWriter(output)
	defer writer.Flush()

	rand.Seed(int64(time.Now().Nanosecond()))
	solve()
}

// Read.

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

func readLine() string {
	scanner.Split(bufio.ScanLines)
	defer scanner.Split(bufio.ScanWords)
	return readString()
}

func readInt() int {
	ans, _ := strconv.ParseInt(readString(), 10, 0)
	return int(ans)
}

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

func readFloat64() float64 {
	ans, _ := strconv.ParseFloat(readString(), 64)
	return ans
}

// Write.

func printString(value string) {
	writer.WriteString(value)
}

func printLine() {
	printString("\n")
}

func printSpace() {
	printString(" ")
}

func printInt(value int) {
	printString(strconv.FormatInt(int64(value), 10))
}

func printInt64(value int64) {
	printString(strconv.FormatInt(value, 10))
}

func printFloat64(value float64) {
	printString(strconv.FormatFloat(value, 'f', 20, 64))
}

// Tuple

type Tuple struct {
	a, b int
}

func (p Tuple) Equals(key Key) bool {
	return p.a == key.(Tuple).a
}

func (p Tuple) Less(key Key) bool {
	return p.a < key.(Tuple).a
}

type TupleSlice []Tuple

func (p TupleSlice) Len() int {
	return len(p)
}

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

func (p TupleSlice) Swap(j, i int) {
	p[j], p[i] = p[i], p[j]
}

// Min, max, abs.

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

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

func absInt(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

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

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

func absInt64(a int64) int64 {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

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

func absFloat64(a float64) float64 {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

// Set Key interface implementations.

type Int int

func (p Int) Equals(key Key) bool {
	return int(p) == int(key.(Int))
}

func (p Int) Less(key Key) bool {
	return int(p) < int(key.(Int))
}

// Set.

type Key interface {
	Equals(key Key) bool
	Less(key Key) bool
}

type node struct {
	key   Key
	left  *node
	right *node
}

func newNode(key Key) *node {
	return &node{key, nil, nil}
}

type SplayTree struct {
	root *node
	tmp  *node
	len  int
}

func NewSplayTree() *SplayTree {
	return &SplayTree{nil, newNode(nil), 0}
}

func rotateLeft(x, p *node) {
	p.right = x.left
	x.left = p
}

func rotateRight(x, p *node) {
	p.left = x.right
	x.right = p
}

func (p *SplayTree) splay(x *node, key Key) *node {
	if x == nil {
		return nil
	}

	left := p.tmp
	right := p.tmp

	for {
		if key.Less(x.key) {
			y := x.left
			if y == nil {
				break
			}
			if key.Less(y.key) { // zig-zig
				rotateRight(y, x)
				x = y
				if x.left == nil {
					break
				}
			}
			// link right
			right.left = x
			right = x
			// move left
			x = x.left
		} else if x.key.Less(key) {
			y := x.right
			if y == nil {
				break
			}
			if y.key.Less(key) { // zig-zig
				rotateLeft(y, x)
				x = y
				if x.right == nil {
					break
				}
			}
			// link left
			left.right = x
			left = x
			// move right
			x = x.right
		} else {
			break
		}
	}

	left.right = x.left
	right.left = x.right
	x.left = p.tmp.right
	x.right = p.tmp.left

	return x
}

// left <= key < right
func (p *SplayTree) split(key Key) (left, right *node) {
	p.root = p.splay(p.root, key)
	if p.root.key.Equals(key) || p.root.key.Less(key) {
		right := p.root.right
		p.root.right = nil
		return p.root, right
	} else {
		left := p.root.left
		p.root.left = nil
		return left, p.root
	}
}

// keys from left tree must be less then keys from right tree
func (p *SplayTree) join(left, right *node) *node {
	if left == nil {
		return right
	} else if right == nil {
		return left
	}
	left = p.splay(left, right.key)
	left.right = right
	return left
}

type Set interface {
	Len() int
	Insert(key Key) error
	Find(key Key) bool
	Remove(key Key) error
}

func NewSet() Set {
	return Set(NewSplayTree())
}

func (p *SplayTree) Len() int {
	return p.len
}

func (p *SplayTree) Insert(key Key) error {
	if p.root == nil {
		p.root = newNode(key)
		p.len++
	} else {
		p.root = p.splay(p.root, key)
		if p.root.key.Equals(key) {
			return errors.New("Such key already exists")
		} else {
			left, right := p.split(key)
			p.root = newNode(key)
			p.root.left = left
			p.root.right = right
			p.len++
		}
	}
	return nil
}

func (p *SplayTree) Find(key Key) bool {
	if p.root == nil {
		return false
	}
	p.root = p.splay(p.root, key)
	return p.root.key.Equals(key)
}

func (p *SplayTree) Remove(key Key) error {
	p.root = p.splay(p.root, key)
	if p.root == nil || !p.root.key.Equals(key) {
		return errors.New("Such key doesn't exist")
	}
	p.root = p.join(p.split(key))
	return nil
}

// Copied scan.go
// Scanner provides a convenient interface for reading data such as
// a file of newline-delimited lines of text. Successive calls to
// the Scan method will step through the 'tokens' of a file, skipping
// the bytes between the tokens. The specification of a token is
// defined by a split function of type SplitFunc; the default split
// function breaks the input into lines with line termination stripped. Split
// functions are defined in this package for scanning a file into
// lines, bytes, UTF-8-encoded runes, and space-delimited words. The
// client may instead provide a custom split function.
//
// Scanning stops unrecoverably at EOF, the first I/O error, or a token too
// large to fit in the buffer. When a scan stops, the reader may have
// advanced arbitrarily far past the last token. Programs that need more
// control over error handling or large tokens, or must run sequential scans
// on a reader, should use bufio.Reader instead.
//
type Scanner struct {
	r            io.Reader // The reader provided by the client.
	split        SplitFunc // The function to split the tokens.
	maxTokenSize int       // Maximum size of a token; modified by tests.
	token        []byte    // Last token returned by split.
	buf          []byte    // Buffer used as argument to split.
	start        int       // First non-processed byte in buf.
	end          int       // End of data in buf.
	err          error     // Sticky error.
}

// SplitFunc is the signature of the split function used to tokenize the
// input. The arguments are an initial substring of the remaining unprocessed
// data and a flag, atEOF, that reports whether the Reader has no more data
// to give. The return values are the number of bytes to advance the input
// and the next token to return to the user, plus an error, if any. If the
// data does not yet hold a complete token, for instance if it has no newline
// while scanning lines, SplitFunc can return (0, nil, nil) to signal the
// Scanner to read more data into the slice and try again with a longer slice
// starting at the same point in the input.
//
// If the returned error is non-nil, scanning stops and the error
// is returned to the client.
//
// The function is never called with an empty data slice unless atEOF
// is true. If atEOF is true, however, data may be non-empty and,
// as always, holds unprocessed text.
type SplitFunc func(data []byte, atEOF bool) (advance int, token []byte, err error)

// Errors returned by Scanner.
var (
	ErrTooLong         = errors.New("bufio.Scanner: token too long")
	ErrNegativeAdvance = errors.New("bufio.Scanner: SplitFunc returns negative advance count")
	ErrAdvanceTooFar   = errors.New("bufio.Scanner: SplitFunc returns advance count beyond input")
)

const (
	// Maximum size used to buffer a token. The actual maximum token size
	// may be smaller as the buffer may need to include, for instance, a newline.
	MaxScanTokenSize = 1 << 20
)

// NewScanner returns a new Scanner to read from r.
// The split function defaults to ScanLines.
func NewScanner(r io.Reader) *Scanner {
	return &Scanner{
		r:            r,
		split:        ScanLines,
		maxTokenSize: MaxScanTokenSize,
		buf:          make([]byte, 4096), // Plausible starting size; needn't be large.
	}
}

// Err returns the first non-EOF error that was encountered by the Scanner.
func (s *Scanner) Err() error {
	if s.err == io.EOF {
		return nil
	}
	return s.err
}

// Bytes returns the most recent token generated by a call to Scan.
// The underlying array may point to data that will be overwritten
// by a subsequent call to Scan. It does no allocation.
func (s *Scanner) Bytes() []byte {
	return s.token
}

// Text returns the most recent token generated by a call to Scan
// as a newly allocated string holding its bytes.
func (s *Scanner) Text() string {
	return string(s.token)
}

// Scan advances the Scanner to the next token, which will then be
// available through the Bytes or Text method. It returns false when the
// scan stops, either by reaching the end of the input or an error.
// After Scan returns false, the Err method will return any error that
// occurred during scanning, except that if it was io.EOF, Err
// will return nil.
func (s *Scanner) Scan() bool {
	// Loop until we have a token.
	for {
		// See if we can get a token with what we already have.
		if s.end > s.start {
			advance, token, err := s.split(s.buf[s.start:s.end], s.err != nil)
			if err != nil {
				s.setErr(err)
				return false
			}
			if !s.advance(advance) {
				return false
			}
			s.token = token
			if token != nil {
				return true
			}
		}
		// We cannot generate a token with what we are holding.
		// If we've already hit EOF or an I/O error, we are done.
		if s.err != nil {
			// Shut it down.
			s.start = 0
			s.end = 0
			return false
		}
		// Must read more data.
		// First, shift data to beginning of buffer if there's lots of empty space
		// or space is neded.
		if s.start > 0 && (s.end == len(s.buf) || s.start > len(s.buf)/2) {
			copy(s.buf, s.buf[s.start:s.end])
			s.end -= s.start
			s.start = 0
		}
		// Is the buffer full? If so, resize.
		if s.end == len(s.buf) {
			if len(s.buf) >= s.maxTokenSize {
				s.setErr(ErrTooLong)
				return false
			}
			newSize := len(s.buf) * 2
			if newSize > s.maxTokenSize {
				newSize = s.maxTokenSize
			}
			newBuf := make([]byte, newSize)
			copy(newBuf, s.buf[s.start:s.end])
			s.buf = newBuf
			s.end -= s.start
			s.start = 0
			continue
		}
		// Finally we can read some input. Make sure we don't get stuck with
		// a misbehaving Reader. Officially we don't need to do this, but let's
		// be extra careful: Scanner is for safe, simple jobs.
		for loop := 0; ; {
			n, err := s.r.Read(s.buf[s.end:len(s.buf)])
			s.end += n
			if err != nil {
				s.setErr(err)
				break
			}
			if n > 0 {
				break
			}
			loop++
			if loop > 100 {
				s.setErr(io.ErrNoProgress)
				break
			}
		}
	}
}

// advance consumes n bytes of the buffer. It reports whether the advance was legal.
func (s *Scanner) advance(n int) bool {
	if n < 0 {
		s.setErr(ErrNegativeAdvance)
		return false
	}
	if n > s.end-s.start {
		s.setErr(ErrAdvanceTooFar)
		return false
	}
	s.start += n
	return true
}

// setErr records the first error encountered.
func (s *Scanner) setErr(err error) {
	if s.err == nil || s.err == io.EOF {
		s.err = err
	}
}

// Split sets the split function for the Scanner. If called, it must be
// called before Scan. The default split function is ScanLines.
func (s *Scanner) Split(split SplitFunc) {
	s.split = split
}

// Split functions

// ScanBytes is a split function for a Scanner that returns each byte as a token.
func ScanBytes(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	return 1, data[0:1], nil
}

var errorRune = []byte(string(utf8.RuneError))

// ScanRunes is a split function for a Scanner that returns each
// UTF-8-encoded rune as a token. The sequence of runes returned is
// equivalent to that from a range loop over the input as a string, which
// means that erroneous UTF-8 encodings translate to U+FFFD = "\xef\xbf\xbd".
// Because of the Scan interface, this makes it impossible for the client to
// distinguish correctly encoded replacement runes from encoding errors.
func ScanRunes(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}

	// Fast path 1: ASCII.
	if data[0] < utf8.RuneSelf {
		return 1, data[0:1], nil
	}

	// Fast path 2: Correct UTF-8 decode without error.
	_, width := utf8.DecodeRune(data)
	if width > 1 {
		// It's a valid encoding. Width cannot be one for a correctly encoded
		// non-ASCII rune.
		return width, data[0:width], nil
	}

	// We know it's an error: we have width==1 and implicitly r==utf8.RuneError.
	// Is the error because there wasn't a full rune to be decoded?
	// FullRune distinguishes correctly between erroneous and incomplete encodings.
	if !atEOF && !utf8.FullRune(data) {
		// Incomplete; get more bytes.
		return 0, nil, nil
	}

	// We have a real UTF-8 encoding error. Return a properly encoded error rune
	// but advance only one byte. This matches the behavior of a range loop over
	// an incorrectly encoded string.
	return 1, errorRune, nil
}

// dropCR drops a terminal \r from the data.
func dropCR(data []byte) []byte {
	if len(data) > 0 && data[len(data)-1] == '\r' {
		return data[0 : len(data)-1]
	}
	return data
}

// ScanLines is a split function for a Scanner that returns each line of
// text, stripped of any trailing end-of-line marker. The returned line may
// be empty. The end-of-line marker is one optional carriage return followed
// by one mandatory newline. In regular expression notation, it is `\r?\n`.
// The last non-empty line of input will be returned even if it has no
// newline.
func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	if i := bytes.IndexByte(data, '\n'); i >= 0 {
		// We have a full newline-terminated line.
		return i + 1, dropCR(data[0:i]), nil
	}
	// If we're at EOF, we have a final, non-terminated line. Return it.
	if atEOF {
		return len(data), dropCR(data), nil
	}
	// Request more data.
	return 0, nil, nil
}

// isSpace reports whether the character is a Unicode white space character.
// We avoid dependency on the unicode package, but check validity of the implementation
// in the tests.
func isSpace(r rune) bool {
	if r <= '\u00FF' {
		// Obvious ASCII ones: \t through \r plus space. Plus two Latin-1 oddballs.
		switch r {
		case ' ', '\t', '\n', '\v', '\f', '\r':
			return true
		case '\u0085', '\u00A0':
			return true
		}
		return false
	}
	// High-valued ones.
	if '\u2000' <= r && r <= '\u200a' {
		return true
	}
	switch r {
	case '\u1680', '\u180e', '\u2028', '\u2029', '\u202f', '\u205f', '\u3000':
		return true
	}
	return false
}

// ScanWords is a split function for a Scanner that returns each
// space-separated word of text, with surrounding spaces deleted. It will
// never return an empty string. The definition of space is set by
// unicode.IsSpace.
func ScanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	// Skip leading spaces.
	start := 0
	for width := 0; start < len(data); start += width {
		var r rune
		r, width = utf8.DecodeRune(data[start:])
		if !isSpace(r) {
			break
		}
	}
	if atEOF && len(data) == 0 {
		return 0, nil, nil
	}
	// Scan until space, marking end of word.
	for width, i := 0, start; i < len(data); i += width {
		var r rune
		r, width = utf8.DecodeRune(data[i:])
		if isSpace(r) {
			return i + width, data[start:i], nil
		}
	}
	// If we're at EOF, we have a final, non-empty, non-terminated word. Return it.
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	// Request more data.
	return 0, nil, nil
}


package main

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

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

	var a, b, c, d int
	Fscan(in, &a, &b, &c, &d)
	if a != d || c > 0 && a*d == 0 {
		Fprint(out, 0)
	} else {
		Fprint(out, 1)
	}
}

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


package main

import "fmt"

func main() {
	var cnt1, cnt2, cnt3, cnt4 uint32
	fmt.Scan(&cnt1, &cnt2, &cnt3, &cnt4)

	res := cnt1 == cnt4 && (cnt3 == 0 || cnt1 > 0)

	if res {
		fmt.Println(1)
	} else {
		fmt.Println(0)
	}
}


package main

import "fmt"

func main() {
	var a, b, c , d int
	fmt.Scanf("%d\n%d\n%d\n%d\n", &a, &b, &c, &d);
	if c != 0{
		a--
		d--
	}
	if a >= 0 && d >= 0 && a == d{
		fmt.Println(1)
	}else{
		fmt.Println(0)
	}
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1558B(in io.Reader, out io.Writer) {
	min := func(a, b int) int {
		if a > b {
			return b
		}
		return a
	}

	var n, m int
	Fscan(in, &n, &m)
	f := make([]int, n+2)
	f[n] = 1
	for i := n - 1; i > 0; i-- {
		f[i] = f[i+1] * 2 % m
		for j := 2; j*i <= n; j++ {
			f[i] = (f[i] + (f[i*j]-f[min((i+1)*j, n+1)]+m)%m) % m
		}
	}
	Fprint(out, (f[1]-f[2]+m)%m)
}

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


package main

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

var _, _, _ = main, rw, do

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

func rw(r io.Reader, w io.Writer) {
	var n int
	var m int64
	fmt.Fscan(r, &n, &m)
	w1 := do(n, m)
	fmt.Fprintln(w, w1)
}

/*x/2 x/3      ... x/n/2 ... x/n
1 2,3 3,4,5    ... n/2   ... n
2 4,5 6,7,8    ... n
3 6,7 9,10,11  ...
4 8,9 12,13,14 ...
. ...
n+n/2+n/3+...+n/n-1=n(1+1/2+1/3+...)=nlogn
*/

func do(n int, m int64) int64 {
	a := make([]int64, n+2)
	a[n] = 1
	for i := n - 1; i >= 1; i-- {
		a[i] = a[i+1]
		for j := 2; j*i <= n; j++ {
			a[i] = (a[i] + a[j*i] - a[min(n+1, j*i+j)] + m) % m
		}
		a[i] = (a[i] + a[i+1]) % m
	}
	return (a[1] - a[2] + m) % m
}

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


package main

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

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

	var n, m int
	fmt.Fscanf(r, "%d %d\n", &n, &m)

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

	f[1] = 1
	s[1] = 1
	for i := 2; i <= n; i++ {
		f[i] = s[i-1]
		p := i

		if i <= 5 {
			for j := 2; j <= i; j++ {
				f[i] = (f[i] + f[i/j]) % m
			}
		} else {
			/*	fmt.Println(i, ": ")
				for j := 2; j <= i; j++ {
					fmt.Print(i/j, " ")
				}
				fmt.Println()*/

			for j := 2; j < i; j++ {
				if j-1 > i/j {
					break
				}
				if j-1 == i/j {
					//	fmt.Println(i, i/j, p-i/j, "x", j-1)
					f[i] = int((int64(f[i]) + int64(p-i/j)*int64(f[j-1])) % int64(m))
					break
				}
				//fmt.Println(i, i/j, p-i/j, "x", j-1)
				f[i] = int((int64(f[i]) + (int64(p-i/j) * int64(f[j-1]))) % int64(m))
				f[i] = (f[i] + f[i/j]) % m
				p = i / j
			}
		}

		s[i] = (s[i-1] + f[i]) % m
	}

	fmt.Println(f[n])
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var n, m int64
	fmt.Fscan(in, &n, &m)
	f := make([]int64, n+5)
	f[1] = 1
	pre := make([]int64, n+5)
	pre[1] = 1
	f[2] = 2
	f[3] = 5
	pre[2] = f[1] + f[2]
	pre[3] = f[1] + f[2] + f[3]
	var i int64
	for i = 4; i <= n; i++ {
		f[i] = pre[i-1] % m
		var lst int64 = -1
		var tmp int64 = 0
		var j int64
		for j = 2; j*j <= i; j++ {
			if j == 2 {
				lst = i / j
				tmp = ((tmp%m+((i%m-lst%m)%m*f[j-1]%m)%m)%m + f[i/j]%m) % m
				continue
			}
			t := lst
			lst = i / j
			tmp = ((tmp%m+((t%m-lst%m)%m*f[j-1]%m)%m)%m + f[i/j]%m) % m
		}
		if i/j == j-1 {
			t := lst
			lst = i / j
			tmp = (tmp%m + ((t%m-lst%m)%m*f[j-1]%m)%m) % m
		}
		f[i] = (f[i]%m + tmp%m) % m
		pre[i] = (pre[i-1]%m + f[i]%m) % m
	}
	fmt.Fprintln(out, f[n])
}


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

func main() {
    var m,n,t1,t2 int
    fmt.Scan(&m,&n)
    a,b,c:=0,0,0
    for i:=1;i<=6;i++ {
        t1=i-m
        t2=i-n
        if t1<0 {
            t1*=(-1)
        }
        if t2<0 {
            t2*=(-1)
        }
        if t1>t2 {
            b++
        } else if t1<t2 {
            a++
        } else {c++}
    }
    fmt.Println(a,c,b)
}


package main

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

func main() {
    s := NewInOut(os.Stdin, os.Stdout)
    a, b := s.Next(), s.Next()
    ra, rb, rd := 0, 0, 0
    for i := 1; i <= 6; i++ {
        if aabs, babs := abs(a - i), abs(b - i); aabs == babs {
            rd++
        } else if aabs < babs {
            ra++
        } else {
            rb++
        }
    }
    s.Println(ra, " ", rd, " ", rb)
    s.Flush()
}

func abs(n int) int {
    if n < 0 {
        n *= -1
    }

    return n
}

type InOut struct {
    *bufio.Reader
    *bufio.Writer
}

func NewInOut(r io.Reader, w io.Writer) *InOut {
    return &InOut{bufio.NewReader(r), bufio.NewWriter(w)}
}

// Get Next Integer
func (s *InOut) Next() (r int) {
    b, _ := s.ReadByte()
    p := 1
    for (b < '0' || '9' < b) && b != '-' {
        b, _ = s.ReadByte()
    }
    if b == '-' {
        p = -1
        b, _ = s.ReadByte()
    }
    for '0' <= b && b <= '9' {
        r = 10*r + int(b-'0')
        b, _ = s.ReadByte()
    }
    return r * p
}

// Get Next int64
func (s *InOut) NextInt64() (r int64) {
    b, _ := s.ReadByte()
    p := int64(1)
    for (b < '0' || '9' < b) && b != '-' {
        b, _ = s.ReadByte()
    }
    if b == '-' {
        p = -1
        b, _ = s.ReadByte()
    }
    for '0' <= b && b <= '9' {
        r = 10*r + int64(b-'0')
        b, _ = s.ReadByte()
    }
    return r * p
}

// Get Next Line String
func (s *InOut) NextLine() (r string) {
    b, _ := s.ReadByte()
    for b == '\r' || b == '\n' {
        b, _ = s.ReadByte()
    }
    buf := make([]byte, 0)
    for ; b != '\r' && b != '\n'; b, _ = s.ReadByte() {
        buf = append(buf, b)
    }
    return string(buf)
}

// Get Next String using delimiter whitespace
func (s *InOut) NextStr() (r string) {
    return string(s.NextBytes())
}

// Get Next String using delimiter whitespace
func (s *InOut) NextBytes() (r []byte) {
    b, _ := s.ReadByte()
    for b == '\r' || b == '\n' || b == ' ' {
        b, _ = s.ReadByte()
    }
    buf := make([]byte, 0)
    for ; b != '\r' && b != '\n' && b != ' '; b, _ = s.ReadByte() {
        buf = append(buf, b)
    }
    return buf
}

// Print Strings using the suitable way to change type
func (s *InOut) Print(os ...interface{}) {
    for _, o := range os {
        switch o.(type) {
        case byte:
            s.WriteByte(o.(byte))
        case string:
            s.WriteString(o.(string))
        case int:
            s.WriteString(strconv.Itoa(o.(int)))
        case int64:
            s.WriteString(strconv.FormatInt(o.(int64), 10))
        default:
            s.WriteString(fmt.Sprint(o))
        }
    }
}

// Print Strings using the suitable way to change type with new line
func (s *InOut) Println(os ...interface{}) {
    for _, o := range os {
        s.Print(o)
    }
    s.Print("\n")
}

// Print immediately with new line (for debug)
func (s *InOut) PrintlnNow(o interface{}) {
    fmt.Println(o)
}


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

func main() {
	var m,n,t1,t2 int
	fmt.Scan(&m,&n)
	a,b,c:=0,0,0
	for i:=1;i<=6;i++ {
		t1=i-m
		t2=i-n
		if t1<0 {
			t1*=(-1)
		}
		if t2<0 {
			t2*=(-1)
		}
		if t1>t2 {
			b++
		} else if t1<t2 {
			a++
		} else {c++}
	}
	fmt.Println(a,c,b)
}


package main

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

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

	var T int
	fmt.Fscan(in, &T)
	for t := 0; t < T; t++ {
		var tot int
		for i := 0; i < 4; i++ {
			var v int
			fmt.Fscan(in, &v)
			tot += v
		}

		if tot == 0 {
			fmt.Fprintln(out, 0)
		} else if tot == 4 {
			fmt.Fprintln(out, 2)
		} else {
			fmt.Fprintln(out, 1)
		}
	}
}


package main

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

var (
	reader = bufio.NewReader(os.Stdin)
	t      int
	a      []int
)

func solve(a []int) int {
	var c int
	for _, x := range a {
		c += x
	}
	if c == 0 {
		return 0
	}
	if c == 4 {
		return 2
	}
	return 1
}

func main() {
	fmt.Fscan(reader, &t)
	for ; t > 0; t-- {
		a = make([]int, 4)
		for i := 0; i < 4; i++ {
			fmt.Fscan(reader, &a[i])
		}
		fmt.Println(solve(a))
	}
}


package main
import(
    "fmt"
    "bufio"
    "os"
)
func main() {
	in:= bufio.NewReader(os.Stdin)
	out:= bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var t int
	fmt.Fscan(in,&t)
	for i:=0;i<t;i++{
		var x,y,x2,y2 int
		fmt.Fscan(in,&x,&y,&x2,&y2)
		if x == 1 && y == 1 && x2 == 1 && y2 == 1 {
			fmt.Fprintln(out,2)
		} else if x == 1 || y == 1 || x2 == 1 || y2 == 1 {
			fmt.Fprintln(out,1)
		} else {
			fmt.Fprintln(out,0)
		}
	}
}


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

  a, x, y := getI(), getI(), getI()
  result := -1
  if y > 0 && y%a != 0 {
    row := y/a
    if row == 0 || row%2 == 1 {  // one per row
      if x > -(a+1)/2 && x < (a+1)/2 {
        if row == 0 {
          result = 1
        } else {
          result = row/2 * 3 + 2
        }
      }
    } else {                    // two per row
      if x > -a && x != 0 && x < a {
        result = row/2 * 3
        if x > 0 {
          result++
        }
      }
    }
  }
  writer.WriteString(fmt.Sprintf("%d\n", result))
}


// 141B
package main

import (
	"fmt"
)

func f(a, x, y int) int {
	if y%a == 0 {
		return -1
	}
	t := y / a
	if t == 0 {
		if -a < 2*x && 2*x < a {
			return 1
		} else {
			return -1
		}
	}
	k := t / 2 * 3
	if t%2 == 1 {
		if -a < 2*x && 2*x < a {
			return k + 2
		} else {
			return -1
		}
	}
	if -a < x && x < 0 {
		return k
	}
	if 0 < x && x < a {
		return k + 1
	}
	return -1
}
func main() {
	var a, x, y int
	for fmt.Scan(&a, &x, &y); ; {
		fmt.Println(f(a, x, y))
		return
	}
}


package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Scan()
	line := s.Text()
	tokens := strings.Split(line, " ")
	a, _ := strconv.Atoi(tokens[0])
	x, _ := strconv.Atoi(tokens[1])
	y, _ := strconv.Atoi(tokens[2])
	fmt.Println(findSquare(a, x, y))
}

func findSquare(a, x, y int) int {
	ha := a
	a *= 2
	x *= 2
	y *= 2

	if y%a == 0 {
		return -1
	}

	yi := y / a
	switch {
	case yi == 0:
		switch {
		case -ha < x && x < ha:
			return 1
		default:
			return -1
		}

	case yi%2 == 0:
		switch {
		case -a < x && x < 0:
			return (yi / 2) * 3
		case 0 < x && x < a:
			return (yi/2)*3 + 1
		default:
			return -1
		}

	case yi%2 == 1:
		switch {
		case -ha < x && x < ha:
			return (yi/2)*3 + 2
		default:
			return -1
		}
	}

	return -1
}


package main

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

func main() {
	var a, b, n int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d %d %d", &a, &b, &n)

	for true {
		if n >= gcd(a, n) {
			n -= gcd(a, n)
		} else {
			fmt.Println(1)
			break
		}
		if n >= gcd(b, n) {
			n -= gcd(b, n)
		} else {
			fmt.Println(0)
			break
		}
	}

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


package main

import "fmt"

func gcd(a, b int) int {
	for {
		v := a % b
		a, b = b, v
		if b == 0 {
			break
		}
	}

	return a
}

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

	for {
		gone := gcd(a, n)
		n -= gone
		if n == 0 {
			fmt.Print(0)
			break
		}

		gone = gcd(b, n)
		n -= gone
		if n == 0 {
			fmt.Print(1)
			break
		}
	}
}


package main

import (
    "fmt"
)

func gcd(m, n int) int {
    var d int
    d=m%n
    for d!=0 {
    	m=n
    	n=d
    	d=m%n
    }
    return n
}

func main() {
    var a,b,n int
    fmt.Scan(&a,&b,&n)
    for  {
        n -= gcd(a, n)
        if (n == 0){
    	 	fmt.Println("0")
    	 	break
 	}
 	n -= gcd(b, n)
 	if (n == 0){
    	 	fmt.Println("1")
    	 	break
 	}
    }
}


// Codeforces 635 E, with podskazki, done
package main

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

func miconv(s string) int64 {
    iret,err := strconv.ParseInt(s, 10, 64)
    if err != nil {
        fmt.Println("error in converting " + s)
    }
    return iret
}

var x int64
var pov int64

func main() {
    // reading n
    in    := bufio.NewReader(os.Stdin)
    s,err := in.ReadString('\n')
    if err != nil {
        fmt.Println("first read failure", err)
    }
    ss := strings.Split(strings.Trim(s," \n\r")," ")
    x = miconv(ss[0])

    if x > 0 {
        x = x % 360
    } else {
        x = -(-x % 360)
        x = (x + 360) % 360
    }
    // fmt.Printf("converted x = %d\n", x)

    if x<=45 {
        pov = 0
    } else if x<=135 {
        pov = 1
    } else if x<=225 {
        pov = 2
    } else if x>=315 {
        pov = 0
    } else {
        pov = 3
    }

	// print result
	fmt.Printf("%d\n", pov)
}


package main

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

var reader *bufio.Reader

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

var a, b int

func main() {
	fmt.Fscan(reader, &a, &b)
	if a > b {
		a, b = b, a
	}
	fmt.Println(a, (b-a)/2)
}


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 Max(a, b int) (int, int) {
    if b > a {
        b, a = a, b
    }
    return a, b
}

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

    var a, b int
    line, _ := reader.ReadString(' ')
    fmt.Sscanln(line, &a)
    fmt.Sscanln(Read(reader), &b)

    a, b = Max(a, b)

    writer := bufio.NewWriter(os.Stdout)
    Write(writer, b, (a - b) / 2)
}


package main

import "fmt"

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

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

func main() {
	var a, b int

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

	max := max(a, b)
	min := min(a, b)

	fmt.Printf("%d %d", min, (max - min) / 2)
}


package main

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

func main() {
    var s string
    //fmt.Scan(&s)
    input:= bufio.NewScanner(os.Stdin)
    //input.Split(bufio.ScanLines)
    var c rune
    input.Scan()
    s=input.Text()
    //fmt.Println(s)
    //s = strings.TrimSpace(s)
    c = rune(s[len(s)-2])
    c = unicode.ToLower(c)
    var cek bool
    cek = unicode.IsSpace(c)
    //fmt.Println(cek)
    for i:=3;cek==true;i++ {
    	c = rune(s[len(s)-i])
    	c = unicode.ToLower(c)
    	cek = unicode.IsSpace(c)
    }
    //fmt.Println(s)
    //fmt.Println(string(c))
    if (c == 'a' || c == 'e' || c == 'i' || c == 'u' || c == 'o' || c == 'y') {
    	fmt.Println("YES")
    	return
    }
    fmt.Println("NO")
}


package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    for i := len(scanner.Text())-1; i >= 0; i-- {
        c := strings.ToUpper(string(scanner.Text()[i]))[0]
        if (c >= 'A') && (c <= 'Z') {
            if (c == 'A') || (c == 'E') || (c == 'I') || (c == 'O') || (c == 'U') || (c == 'Y') {
                fmt.Println("YES")
            } else {
                fmt.Println("NO")
            }
            break
        }
    }
}


// 49A-mic
package main

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

func main() {
    z := bufio.NewScanner(os.Stdin)
    var y bool
    var s []string
    y = false
    z.Scan()
    ss := z.Text()
    ss = strings.ToLower(ss)
    l := len(ss)
    for i := l - 1; i >= 0; i-- {
        if ss[i] == ' ' || ss[i] == '?' {
            continue
        } else {
            s = append(s, string(ss[i]))
            break
        }
    }
    if s[0] == "a" || s[0] == "i" || s[0] == "u" || s[0] == "e" || s[0] == "o" || s[0] == "y" {
        y = true
    }
    if y {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}


package main

import (
	"fmt"
)

var (
	colours = []byte("RGBYW")
	numbers = []byte("12345")
)

func bits(x int) (ans int) {
	for x > 0 {
		x &= (x - 1)
		ans++
	}
	return
}

func main() {
	var n int
	fmt.Scan(&n)
	cards := make([]string, n)
	for i := range cards {
		fmt.Scan(&cards[i])
	}
	res := 10
	for c := 0; c < 1 << 5; c++ {
		for nu := 0; nu < 1 << 5; nu++ {
			if bits(c) + bits(nu) > res {
				continue
			}
			know := make(map[byte]bool)
			for i := 0; i < 5; i++ {
				if c & (1 << uint(i)) != 0 {
					know[colours[i]] = true
				}
				if nu & (1 << uint(i)) != 0 {
					know[numbers[i]] = true
				}
			}
			var (
				nothing = make(map[string]bool)
				knowNu = make(map[byte]map[byte]bool)
				knowC = make(map[byte]map[byte]bool)
			)
			good := true
			for _, card := range cards {
				if !know[card[0]] && !know[card[1]] {
					nothing[card] = true
					if len(nothing) > 1 {
						good = false
						break
					}
				} else if !know[card[0]] {
					m := knowNu[card[1]]
					if m == nil {
						m = make(map[byte]bool)
						knowNu[card[1]] = m
					}
					m[card[0]] = true
					if len(m) > 1 {
						good = false
						break
					}
				} else if !know[card[1]] {
					m := knowC[card[0]]
					if m == nil {
						m = make(map[byte]bool)
						knowC[card[0]] = m
					}
					m[card[1]] = true
					if len(m) > 1 {
						good = false
						break
					}
				}
			}
			if good {
				res = bits(c) + bits(nu)
			}
		}
	}
	fmt.Println(res)
}


package main

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

func factorial(number int64) int64 {
	var i, result int64 = 0, 1

	for i = 2; i <= number; i++ {
		result *= i
	}

	return result

}

func main() {

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n := scanner.Text()

	var number, factorialVal, denom int64
	number, _ = strconv.ParseInt(n, 10, 64)

	factorialVal = factorial(number)
	denom = (number / 2) * number

	fmt.Println(factorialVal / denom)

}


package main

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

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

	var n int64
	Fscan(in, &n)
	ans := new(big.Int).Binomial(n, n/2)

	f := int64(1)
	for i := int64(2); i < n/2; i++ {
		f*=i
	}
	f*=f

	ans.Mul(ans, big.NewInt(f))
	ans.Div(ans, big.NewInt(2))
	Fprintln(out, ans.Int64())
}

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


package main

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

var _r = bufio.NewReader(os.Stdin)
var _w = bufio.NewWriter(os.Stdout)

func main() {
	var n int
	_, _ = fmt.Fscan(_r, &n)
	f := make([]int64, n+1)
	f[0] = 1
	for i := 1; i <= n; i++ {
		f[i] = f[i-1] * int64(i)
	}
	var ans int64
	ans = (f[n] / f[n/2] / f[n/2]) * (f[n/2-1]) * (f[n/2-1]) / 2
	_, _ = fmt.Fprintln(_w, ans)
	_ = _w.Flush()
}


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

func main() {
	var a,b int64 //input
	fmt.Scan(&a,&b)
	if a>0 && b>0 {
		fmt.Print("0 ",a+b,a+b," 0")
		fmt.Println()
	} else if a<0 && b>0 {
		fmt.Print(a-b," 0 ","0 ",b-a)
		fmt.Println()
	} else if a<0 && b<0 {
		fmt.Print(a+b," 0 ","0 ",a+b)
		fmt.Println()
	} else if a>0 && b<0 {
	        fmt.Print("0 ",b-a,a-b," 0")
	        fmt.Println()
	}

}


package main

import "fmt"

func main() {
    var x,y int
    fmt.Scan(&x,&y)
    if x < 0 {
        if y < 0 {
            fmt.Println(x+y,0,0,x+y)
        } else {
            fmt.Println(x-y,0,0,-(x-y))
        }
    } else {
        if y < 0 {
            fmt.Println(0,-(x-y),x-y,0)
        } else {
            fmt.Println(0,x+y,x+y,0)
        }
    }
}


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

func main() {
    var a,b int64
    fmt.Scan(&a,&b)
    if a>0 && b>0 {
        fmt.Print("0 ",a+b,a+b," 0")
        fmt.Println()
    } else if a<0 && b>0 {
        fmt.Print(a-b," 0 ","0 ",b-a)
        fmt.Println()
    } else if a<0 && b<0 {
        fmt.Print(a+b," 0 ","0 ",a+b)
        fmt.Println()
    } else if a>0 && b<0 {
            fmt.Print("0 ",b-a,a-b," 0")
            fmt.Println()
    }

}


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

  result := 29
  r, g, b := getI(), getI(), getI()
  for i := 0; r > 0 || g > 0 || b > 0; i = (i+1)%3 {
    if i == 0 {
      r -= 2
    } else if i == 1 {
      g -= 2
    } else {
      b -= 2
    }
    result++
  }
  writer.WriteString(fmt.Sprintf("%d\n", result))
}


package main

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

func check(rgb []int) bool {
	for i := 0; i < len(rgb); i++ {
		if rgb[i] > 0 {
			return false
		}
	}
	return true
}
func main() {
	fsc := NewFastScanner()
	rgb := make([]int, 3)

	for i := 0; i < len(rgb); i++ {
		rgb[i] = fsc.NextInt()
	}
	cnt := 0
	res := 0
	for !check(rgb) {
		res++
		rgb[cnt] -= 2
		cnt = (cnt + 1) % 3
	}
	fmt.Println(29 + res)
}

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

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	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) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

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, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

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

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


// _Channels_ are the pipes that connect concurrent
// goroutines. You can send values into channels from one
// goroutine and receive those values into another
// goroutine.

package main

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

// var (
//      mess make(chan string, 2)
// )

func main() {
	var str_a string
	var str_b int64
	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &str_a)
	fmt.Fscan(input, &str_b)
	var cnt [256]int
	for i := 0; i < len(str_a); i++ {
		cnt[str_a[i]-'0']++
	}
	var ans int64
	// fmt.Println(len(str_a))
	for i := 0; i < len(str_a); i++ {
		for j := 9; j >= 0; j-- {
			if cnt[j] == 0 {
				// fmt.Println(j, cnt[j])
				continue
			}
			flag := false
			t := ans
			t = t * 10
			t += int64(j)
			cnt[j]--

			if check(t, cnt, str_b) {
				ans = t
				flag = true
			} else {
				cnt[j]++
			}
			if flag {
				break
			}
		}
	}
	fmt.Println(ans)
}

func check(t int64, cnt [256]int, str_b int64) bool {
	for i := 0; i < 10; i++ {
		for cnt[i] > 0 {
			t = t * 10
			t += int64(i)
			cnt[i]--
		}
	}
	return t <= str_b
}


//http://codeforces.com/contest/915/problem/C
package main

import (
	"fmt"
	"sort"
)

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

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

func reverse(v []int) {
	for i := 0; i < len(v) / 2; i++ {
		v[i], v[len(v) - i - 1] = v[len(v) - i - 1], v[i]
	}
}

func numToVec(a int64) []int {
	var vec []int

	for a > 0 {
		vec = append(vec, int(a % 10))
		a /= 10
	}
	return vec
}

func sliceCompare(a, b []int) bool {
	n := len(a)

	for i := 0; i < n; i++ {
		if a[i] < b[i] {
			return true
		} else if a[i] > b[i] {
			return false
		}
	}

	return true
}

func printVec(vec []int) {
	n := len(vec)

	for i := 0; i < n; i++ {
		fmt.Printf("%d", vec[i])
	}
	fmt.Printf("\n")
}

func searchPos(vec []int, l, r, num int) int {
	for i := l; i < r; i++ {
		if vec[i] == num {
			return i
		}
	}
	return -1
}

func main() {
	var a, b int64
	var Va, Vb []int

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

	Va = numToVec(a)
	reverse(Va)

	Vb = numToVec(b)
	reverse(Vb)

	if len(Va) != len(Vb) {
		sort.Ints(Va)
		reverse(Va)
		printVec(Va)
	} else {
		n := len(Va)

		for i := 0; i < n; i++ {
			for dig := 9; dig >= 0; dig-- {
				pos := searchPos(Va, i, n, dig)
				if pos == -1 {
					continue
				}

				Va[i], Va[pos] = Va[pos], Va[i]
				if i != n - 1 {
					sort.Ints(Va[i+1:])
				}

				if sliceCompare(Va, Vb) == true {
					break
				}
			}
		}

		printVec(Va)
	}

}


package main

import (
	"fmt"
	// "os"
	"sort"
	)

const INF = 0x3f3f3f3f

var n, m, tot int
var ans, s, t string

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

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

func maxs(x, y string) string {
	if x>y {
		return x
	} else {
		return y
	}
}

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

func solve(u sort.IntSlice, dep, tar int, st string) {
	if dep==tar {
		ans = maxs(ans, st)
		return
	}
	k := int(t[dep])-48
	for i:=k-1; i>=0; i-- {
		if u[i]>0 {
			if st=="" && i==0 {
				continue
			}
			u[i]--
			p := st + string(i+48)
			for j:=9; j>=0; j-- {
				for k:=0; k<u[j]; k++ {
					p = p + string(j+48)
				}
			}
			u[i]++
			ans = maxs(ans, p)
			break
		}
	}
	if u[k]>0 {
		u[k]--
		solve(u, dep+1, tar, st + string(k+48))
	}
}

func main() {
	// fd, _ := os.Open("in.txt")
	// os.Stdin = fd
	var T int = 1
	// fmt.Scanf("%d", &T)
	for ci:=1; ci<=T; ci++ {
		// fmt.Scanf("%d %d\n", &n, &m)
		// fmt.Printf("Case #%d: ", ci)
		fmt.Scanf("%s\n",&s)
		fmt.Scanf("%s\n",&t)
		// fmt.Println(s)
		// fmt.Println(t)
		n = len(s)
		m = len(t)
		if n<m {
			u := make(sort.IntSlice, n)
			for i:=0; i<n; i++ {
				u[i] = int(s[i])
			}
			sort.Sort(u)
			for i:=0; i<n; i++ {
				fmt.Printf(string(u[n-1-i]))
			}
			fmt.Println()
		} else {
			ans = ""
			u := make(sort.IntSlice, 10)
			for i:=0; i<n; i++ {
				u[int(s[i])-48]++
				ans = ans + "0"
			}
			solve(u, 0, m, "")
			fmt.Println(ans)
		}
	}
}


package main

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

func readInt(scanner *bufio.Scanner) int64 {
	scanner.Scan()
	raw := scanner.Text()
	result, _ := strconv.ParseInt(strings.Trim(raw, " \n\r"), 10, 64)
	return result

}

func check(n int64) int {
	return 2 - int(n%2)
}

func solve(in io.Reader, out io.Writer) {
	reader := bufio.NewScanner(in)
	reader.Split(bufio.ScanWords)

	fmt.Fprintln(out, check(readInt(reader)))
}

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


package main
import "fmt"

func main(){
	var n int64
	fmt.Scan(&n)
	if n%2 == 0{
		fmt.Println(2)
	}else{
		fmt.Println(1)
	}
}


package main

import "fmt"

func main(){
	var n int64
	fmt.Scan(&n)
	if n %2 == 0{
		fmt.Println(2)
	}else{
		fmt.Println(1)
	}
}


package main

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

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	a, b, x, y := scanInt(scanner), scanInt(scanner), scanInt(scanner), scanInt(scanner)
	low, high := 1, 2*1000*1000*1000
	for low != high {
		k := int((int64(low)+int64(high))/2)
		div_xy := k/(x*y)
		div_x, div_y := k/x - div_xy, k/y - div_xy
		div_neither := k - div_x - div_y - div_xy
		need_a, need_b := a - div_y, b - div_x
		if need_a < 0 {
			need_a = 0
		}
		if need_b < 0 {
			need_b = 0
		}
		if need_a + need_b <= div_neither {
			high = k
		} else {
			low = k+1
		}
	}
	writer.WriteString(fmt.Sprintf("%d\n", low))
}


package main

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

func main() {
	var line string
	var count int
	reader := bufio.NewReader(os.Stdin)
	line, _ = reader.ReadString('\n')
	arrStartStrings := strings.Split(strings.TrimSpace(line), " ")
	_, _ = strconv.Atoi(arrStartStrings[0])
	line, _ = reader.ReadString('\n')
	for strings.Contains(line, "xxx"){
		line=strings.Replace(line, "xxx", "xx", 1)
		count++
	}
	fmt.Println(count)
}


package main

import . "fmt"

// github.com/EndlessCheng/codeforces-go
func main() {
	var n, st, d int
	s:=""
	Scan(&n, &s)
	s = "$" + s + "$"
	for i, b := range s {
		if b != 'x' {
			st = i
		} else if s[i+1] != 'x' && i-st > 2 {
			d += i - st - 2
		}
	}
	Print(d)
}


// https://codeforces.com/problemset/problem/978/B
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	scanner.Scan()
	word := scanner.Text()
	var countx int = 0
	var countrem int = 0
	for _, r := range word {
		if r == 'x' {
			if countx == 2 {
				countrem++
			} else {
				countx++
			}
		} else {
			countx = 0
		}
	}
	fmt.Printf("%d", countrem)
}


package main

import (
	"bufio"
	"fmt"
	"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
	fmt.Fscanf(bufin, "%d\n", &n)

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

	for i := 0; i < n; i++ {
		if (i+2 < n) && (s[i] == 'o') && (s[i+1] == 'g') && (s[i+2] == 'o') {
			j := i + 3
			for (j+1 < n) && (s[j] == 'g') && (s[j+1] == 'o') {
				j += 2
			}
			i = j - 1
			fmt.Fprintf(bufout, "***")
		} else {
			fmt.Fprintf(bufout, "%c", s[i])
		}
	}
}


package main

import (
	"fmt"
)

func main() {

	var (
		count int
		line  string
	)

	fmt.Scanf("%d\n", &count)
	fmt.Scanln(&line)

	isStarted := false
	for i := 0; i < count; {
		if !isStarted {
			if i < count-2 {

				if line[i] == 'o' && line[i+1] == 'g' && line[i+2] == 'o' {
					isStarted = true
					i += 3
				} else {
					fmt.Print(string(line[i]))
					i++
				}
			} else {
				fmt.Print(string(line[i]))
				i++
			}
		} else {
			if i < count-1 {
				if line[i] == 'g' && line[i+1] == 'o' {
					i += 2
				} else {
					fmt.Print("***")
					isStarted = false
					continue
				}
			} else {
				fmt.Print("***")
				fmt.Print(string(line[i]))
				isStarted = false
				i++
			}
		}
	}

	if isStarted {
		fmt.Print("***")
		isStarted = false
	}
}


package main

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

func OpenFile(fpath string) *os.File {
	f, err := os.Open(fpath)
	Assert(err == nil)
	return f
}

func Assert(b bool)  {
	if !b {
		panic("Assertion error")
	}
}

func GetLine(scanner *bufio.Scanner) string {
	Assert(scanner.Scan() && scanner.Err() == nil)
	return scanner.Text()
}

func ReadIntLine(scanner *bufio.Scanner) []int {
	lst := make([]int, 0)
	for _, s := range strings.Fields(GetLine(scanner)) {
		i, err := strconv.Atoi(s)
		Assert(err == nil)
		lst = append(lst, i)
	}
	return lst
}

// SliceIndex(len(slice), func(i int) bool { return slice[i] == value })
func SliceIndex(limit int, predicate func(i int) bool) int {
	for i := 0; i < limit; i++ {
		if predicate(i) {
			return i
		}
	}
	return -1
}

func Ternary(c bool, a, b interface{}) interface{} {
	if c { return a }
	return b
}

func main() {
	f := os.Stdin
//	f := strings.NewReader(`7
//aogogob`)
	//f = OpenFile("/home/ilya/opt/programming/tasks/738A.txt")
	sc := bufio.NewScanner(f)

	ReadIntLine(sc)
	line := GetLine(sc)

	var res []string

	// for idx = expression, idx != -1 is not allowed in Go in conditions
	// var idx int is not allowed also, only :=
	// idx := *new(int) allows avoid explicit -1, is a way to make zero value for int, but it is on heap
	for idx := -1; func() bool {
		idx = strings.Index(line, "ogo")
		return idx != -1
	}(); {
		res = append(res, line[:idx], "***")

		line = line[idx+3:]

		for strings.HasPrefix(line, "go") {
			line = line[2:]
		}
	}

	res = append(res, line)

	fmt.Println(strings.Join(res, ""))
}


package main

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

var n int
var s string
var res int
var m map[byte]int

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

func main() {
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	fmt.Fscan(in, &s)
	m = make(map[byte]int)

	for i:= 0; i < len(s); i++ {
		m[s[i]]++
	}

	res = min(m['U'], m['D']) + min(m['L'], m['R'])
	fmt.Printf("%d", res*2)
}


// https://codeforces.com/problemset/problem/888/B
package main

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

func move(pos []int, move rune) {
	switch move {
	case 'U':
		pos[1]++
	case 'D':
		pos[1]--
	case 'L':
		pos[0]--
	case 'R':
		pos[0]++
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	numCommands, _ := strconv.ParseInt(scanner.Text(), 10, 32)
	pos := []int{0, 0}
	scanner.Scan()
	cmds := scanner.Text()
	for _, cmd := range cmds {
		move(pos, cmd)
		// fmt.Printf("%d - current position - %d, %d\n", i+1, pos[0], pos[1])
	}
	fmt.Printf("%d", numCommands - int64(math.Abs(float64(pos[0]- 0))) - int64(math.Abs(float64(pos[1]-0))))
}


package main

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

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 max(a,b int) int { if a > b { return a } else { return b } }

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

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

	writer.WriteString(fmt.Sprintf("%d", Problem888B()))
}

func Problem888B() int {
	n := getI()
	x := 0
	y := 0
	s := getS()
	for _, char := range s {
		switch char {
		case 'U':
			y+=1
			break
		case 'D':
			y-=1
			break
		case 'L':
			x-=1
			break
		case 'R':
			x+=1
			break
		default:
			break
		}
	}
	return n - (int(math.Abs(float64(x)))+int(math.Abs(float64(y))))
}


package main

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

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

type Team struct {
	name string
	pts, x, y, played int
}

type Sorter []Team

func (s Sorter) Len() int { return len(s) }
func (s Sorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s Sorter) Less(i, j int) bool {
	if s[i].pts > s[j].pts {
		return true
	}
	if s[i].pts < s[j].pts {
		return false
	}
	if s[i].x - s[i].y > s[j].x - s[j].y {
		return true
	}
	if s[i].x - s[i].y < s[j].x - s[j].y {
		return false
	}
	if s[i].x > s[j].x {
		return true
	}
	if s[i].x < s[j].x {
		return false
	}
	return s[i].name < s[j].name
}

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

	s2m := make(map[string]*Team)
	for i := 0; i < 5; i++ {
		name1, name2, score := Next(), Next(), Next()
		if _, exists := s2m[name1]; !exists {
			s2m[name1] = &Team{name: name1}
		}

		if _, exists:= s2m[name2]; !exists {
			s2m[name2] = &Team{name: name2}
		}

		t1, _ := s2m[name1]
		t2, _ := s2m[name2]

		s := strings.Split(score, ":")
		s1, _ := strconv.Atoi(s[0])
		s2, _ := strconv.Atoi(s[1])

		t1.played += 1
		t2.played += 1
		t1.x += s1
		t1.y += s2
		t2.x += s2
		t2.y += s1

		if s1 > s2 {
			t1.pts += 3
		}else if s1 < s2 {
			t2.pts += 3
		}else {
			t1.pts += 1
			t2.pts += 1
		}
	}

	var berland, other Team
	var teams [4]*Team
	var at int = 0
	for _, value := range s2m {
		teams[at] = value
		at += 1

		if value.played == 2 {
			if value.name == "BERLAND" {
				berland = *value
			}else {
				other = *value
			}
		}
	}

	berland.pts += 3
	berland.played += 1

	other.played += 1

	// fmt.Fprintln(out, berland)

	var score1, score2 int = -1, -1
	for x := 0; x < 1000; x++ {
		for y := 0; y < x; y++ {
			b := make([]Team, 0)
			for i := 0; i < 4; i++ {
				if teams[i].name == berland.name || teams[i].name == other.name {
					continue
				}
				b = append(b, *teams[i])
			}

			// fmt.Fprintln(out, b)

			brld, othr := berland, other
			brld.x += x
			brld.y += y
			othr.x += y
			othr.y += x
			b = append(b, brld)
			b = append(b, othr)
			sort.Sort(Sorter(b))

			// fmt.Fprintln(out, b)

			if b[0].name == berland.name || b[1].name == berland.name {
				if score1 == -1 || score1 - score2 > x - y || (score1 - score2 == x - y && score2 > y){
					score1, score2 = x, y
				}
			}
		}
	}

	if score1 == -1 {
		fmt.Fprintln(out, "IMPOSSIBLE")
	}else {
		fmt.Fprintf(out, "%v:%v", score1, score2)
		fmt.Fprintln(out)
	}
}

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

	return in.Text()
}

func NextInt() int {
	ret, _ := strconv.Atoi(Next())
	return ret
}


package main

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

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

func ReadInt32 ()  []int  {
    scanner . Scan ()
    s:=scanner.Text()
    var ans []int
    ans=make([]int, 2)
    pieces:=strings.Split(s, ":")
    ans[0] , _ = strconv . Atoi (pieces[0])
    ans[1], _=strconv.Atoi(pieces[1])
    return ans
 }

func PrintInts ( hours, mins int )  {
    ansx := make([]string, 5)
    h:=strconv.Itoa(hours)
    m:=strconv.Itoa(mins)
    if hours<10{
        if mins<10 {
            ansx[0] = string('0')+h+string(':')+string('0')+m
        } else {
            ansx[0] = string('0')+h+string(':')+m
        }
    } else {
        if mins<10 {
            ansx[0] = h+string(':')+string('0')+m
        } else {
            ansx[0] = h+string(':')+m
        }
    }
    for _ , value := range ansx {
        writer . WriteString ( value )
        writer . WriteByte(' ')
    }
}

func main ()  {
    defer writer . Flush ()  // clears the buffer when the function main
    scanner . Split ( bufio . ScanWords )  // makes the scanner tokens treated as separate words separated by spaces
                            // also has the function and bufio.ScanLines bufio.ScanBytes
    var n , m []int  =  ReadInt32 (),  ReadInt32 ()

    startx:=m[0]*60+m[1]
    endx:=n[0]*60+n[1]
    duration:=endx-startx
    if duration<0 {
        duration=duration+1440
    }
    hours:=int(duration/60)
    mins:=duration%60
    PrintInts ( hours , mins )
    writer . WriteByte ( '\n' )
}


package main

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

func main() {
	var s, t string

	fmt.Scan(&s, &t)

	strs, strt := strings.Split(s, ":") , strings.Split(t, ":")
	ints, intt := make([]int, 2), make([]int, 2)

	for i := range ints {
		ints[i], _ = strconv.Atoi(strs[i])
		intt[i], _ = strconv.Atoi(strt[i])
	}

	h := 0

	if ints[1]>=intt[1] {
		ints[1] -= intt[1]
	} else {
		ints[1] += 60-intt[1]
		h++
	}

	if ints[0]>=intt[0]+h {
		ints[0] -= intt[0]+h
	} else {
		ints[0] += 24-intt[0]-h
	}

	fmt.Printf("%02d:%02d\n", ints[0], ints[1])
}


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)

}