package main

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

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

	N := io.NextLong()
	M := io.NextLong()
	K := io.NextLong()
	X := io.NextLong()
	Y := io.NextLong()

	max := Max(GetAt(N, M, 1, 1, K), GetAt(N, M, N - 1, 1, K))
	min := GetAt(N, M, N, M, K)
	sergey := GetAt(N, M, X, Y, K)

	io.Printf("%d %d %d\n", max, min, sergey)

	io.FlushOutput()
}

func GetAt(N, M, R, C, K int64) int64 {
	R--
	C--
	var cnt int64
	if N == 1 {
		cnt = K / M
		if C < K % M {
			cnt++
		}
	} else {
		T := M * (N + N - 2)
		P := K / T
		if R == 0 || R == N - 1 {
			cnt = P
		} else {
			cnt = P * 2
		}
		rem := K % T
		// fmt.Printf("(%d, %d), T = %d, P = %d, cnt = %d, rem = %d\n", R, C, T, P, cnt, rem)
		// fmt.Printf("  idx1 = %d, idx2 = %d\n", (M * R) + C, M * ((2 * N) - R - 2) + C)
		if R < N - 1 && (M * R) + C < rem {
			cnt++
		}
		if M * ((2 * N) - R - 2) + C < rem {
			cnt++
		}
	}
	// fmt.Printf("  cnt = %d\n", cnt)
	return cnt
}

func Min(lhs, rhs int64) int64 {
	if lhs < rhs {
		return lhs
	} else {
		return rhs
	}
}

func Max(lhs, rhs int64) int64 {
	if lhs > rhs {
		return lhs
	} else {
		return rhs
	}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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


package main

import (
	"fmt"
	// "os"
	)

const INF = 0x3f3f3f3f

var n, m, tot int

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

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

func main() {
	// fd, _ := os.Open("in.txt")
	// os.Stdin = fd
	var T int = 1
	// fmt.Scanf("%d", &T)
	for ci:=1; ci<=T; ci++ {
		var l, r int
		fmt.Scanf("%d %d %d %d\n", &n, &m, &l, &r)
		// fmt.Printf("Case #%d: ", ci)
		if l==1 && r==n {
			fmt.Println(0)
		} else if l==1 {
			if m<=r {
				fmt.Println(1+r-m)
			} else {
				fmt.Println(1-r+m)
			}
		} else if r==n {
			if m<l {
				fmt.Println(1+l-m)
			} else {
				fmt.Println(1-l+m)
			}
		} else {
			mid := (l+r)>>1
			if m<=mid {
				fmt.Println(r+2-l+m-l)
			} else {
				fmt.Println(r+2-l+r-m)
			}
		}
	}
}


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

import "fmt"

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
}

// comentar que nem gente
func main() {
	var n, pos, l, r int
	fmt.Scanf("%d %d %d %d\n", &n, &pos, &l, &r)
	if l == 1 && r == n {
		fmt.Printf("0\n")
	} else if l == 1 {
		fmt.Printf("%d\n", abs(r - pos) + 1)
	} else if r == n {
		fmt.Printf("%d\n", abs(l - pos) + 2)
	} else {
		if abs(l - pos) < abs(r - pos) {
			fmt.Printf("%d\n", abs(l - pos) + r - l + 2)
		} else {
			fmt.Printf("%d\n", abs(r - pos) + r - l + 2)
		}
	}
}


package main

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

func solve() {
	n := readInt()
	pos := readInt()
	l := readInt()
	r := readInt()
	if l == 1 && r == n {
		fmt.Println(0)
	} else if l == 1 {
		fmt.Println(r - pos + 1)
	} else if r == n {
		fmt.Println(pos - l + 1)
	} else {
		fmt.Println(min(pos-l+1+r-l+1, r-pos+1+r-l+1))
	}
}

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

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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


package main

import (
	"fmt"
)

const mod = 998244353

var factor [200005]int64

func getFactorial(n int) {
	factor[0], factor[1] = 1, 1
	var i int64
	for i = 2; i <= int64(n); i++ {
		factor[i] = factor[i-1] * i % mod
	}
}

func quickPow(base int64, p int) int64 {
	var answer int64 = 1
	for p > 0 {
		if p & 1 == 1 {
			answer = answer * base % mod
		}
		base = base * base % mod
		p >>= 1
	}
	return answer
}

func inv(n int64) int64 {
	return quickPow(n, mod - 2)
}

func comb(n, m int) int64 {
	return factor[n] * inv(factor[n-m]*factor[m]%mod) % mod
}

func main() {
	var n, k int
	_, _ = fmt.Scan(&n)
	_, _ = fmt.Scan(&k)
	if n < k {
		fmt.Println(0)
	} else if k == 1 {
		fmt.Println(n)
	} else if k == n {
		fmt.Println(1)
	} else {
		var factor = 1
		var answer int64 = 0
		getFactorial(n)
		for n/factor >= k {
			answer = (answer + comb(n/factor-1, k-1)) % mod
			factor++
		}
		fmt.Println(answer)
	}
}


package main

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

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

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

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

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

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

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

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

	return i
}

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

	n, k := readTwoNums(reader)

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

const MAX_N = 100010
const MOD = 998244353

var F []int64
var IF []int64

// var PM []int

func pow(a, b int64) int64 {
	var r int64 = 1
	for b > 0 {
		if b&1 == 1 {
			r *= a
			r %= MOD
		}
		a *= a
		a %= MOD
		b >>= 1
	}
	return r
}

func init() {
	// PM = make([]int, 0, 10000)
	// PM = append(PM, 1)
	// set := make([]bool, MAX_N)

	// for x := 2; x < MAX_N; x++ {
	// 	if set[x] {
	// 		continue
	// 	}
	// 	PM = append(PM, x)
	// 	for y := x + x; y < MAX_N; y += x {
	// 		set[y] = true
	// 	}
	// }

	F = make([]int64, MAX_N)
	F[0] = 1

	for i := 1; i < MAX_N; i++ {
		F[i] = int64(i) * F[i-1]
		F[i] %= MOD
	}

	IF = make([]int64, MAX_N)
	IF[MAX_N-1] = pow(F[MAX_N-1], MOD-2)

	for i := MAX_N - 2; i >= 0; i-- {
		IF[i] = int64(i+1) * IF[i+1]
		IF[i] %= MOD
	}
}

func nCr(n, r int) int64 {
	if n < r {
		return 0
	}
	res := F[n]
	res *= IF[r]
	res %= MOD
	res *= IF[n-r]
	res %= MOD
	return res
}

func solve(n, k int) int {
	var res int64

	for x := 1; ; x++ {
		// x := PM[i]
		d := n / x
		if d < k {
			break
		}
		res += nCr(d-1, k-1)
		res %= MOD
	}

	return int(res)
}


package main

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

func main() {
	const max_digits int = 10
	digits := make([]rune, max_digits)
	length := 0
	reader := bufio.NewReader(os.Stdin)
	for i := 0; i < max_digits; i++ {
		if c, _, err := reader.ReadRune(); err != nil {
			if err == io.EOF {
				break
			} else {
				return
			}
		} else if c == '\n' {
			length = i
			break
		} else {
			digits[i] = c
		}
	}

	fmt.Println(length)
	var index int = 1 + 2*((1<<uint(length-1))-1) // 1 + 2 + 4 + ... + 2^(length-1)
	fmt.Println(index)
	for i := 0; i < length; i++ {
		if digits[i] == '7' {
			index += (1 << uint(length-i-1)) // 2^(length-i-1)
		}
	}
	fmt.Println(index)
}


package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)
	i, p, k := 0, 1, 0
	// posición en su grupo de cifras
	for n > 0 {
		i = i << 1
		if n%10 == 7 {
			i++
		}
		n /= 10
		k += p
		p <<= 1
	}
	// sumamos los de menos cifras
	fmt.Printf("%d\n", (1+i)+(k-1))
}


package main

import (
	"fmt"
)

func main() {
	var a, b, n, rest, result int
	fmt.Scanln(&a, &b)
	n = a - b
	if n < 0 {
		n = -n
	}
	rest = n % 2
	n /= 2
	result = n*(n+1) + rest*(n+1)
	fmt.Println(result)
}


package main

import (
	"fmt"
	"log"
)

func init() {
	log.SetFlags(log.Lshortfile)
}

func main() {
	var n int
	var s string
	fmt.Scanf("%d\n%s", &n, &s)
	// log.Println(n, s)
	var c [300]int
	for i := range s {
		x := int(s[i])
		if x < 90 {
			x += 'a' - 'A'
		}
		c[x]++
		// log.Println(s[i], x)
	}
	ans := func() bool {
		for i := 'a'; i <= 'z'; i++ {
			if c[i] == 0 {
				return false
			}
		}
		return true
	}()
	if ans {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024 * 1024)
	n := 0
	fmt.Sscanf(readLine(reader), "%d", &n)
	set := make(map[string]bool)
	if n < 26 {
		fmt.Println("NO")
	} else {
		line := readLine(reader)
		for _,c := range line {
			set[string(c)] = true
		}
		if len(set) >= 26 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

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


package  main
import ("fmt")

func main(){
	var n int
	var s string
	fmt.Scan(&n)
	fmt.Scan(&s)
	st := make(map[byte]bool)
	for i:=0 ;i<n;i++{
		st[s[i]]=true;
	}
	l := len(st)
	if(l==26){
		fmt.Print("YES")
	}else{
		fmt.Print("NO")
	}
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var(
		nChars int
		word string
	)
	fmt.Scanf("%d\n", &nChars)
	fmt.Scanf("%s\n", &word)

	lowerWord := strings.ToLower(word)
	alphabet := makeAlphabet('a', 'b')
	for _, letter := range lowerWord {
		alphabet[rune(letter)] = true
	}

	for _, v := range alphabet {
		if !v {
			fmt.Println("NO")
			return
		}
	}

	fmt.Println("YES")
}

func makeAlphabet(start rune, end rune) map[rune]bool {
	dict := make(map[rune]bool)
	for i := rune(start); i <= rune(end); i++ {
		dict[i] = false
	}
	return dict
}


package main

import "fmt"

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

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

	fmt.Print( x-1, y)


package main
import (
    “bufio”
    “fmt”
    “os”
    “strings”
)
func main() {
    reader := bufio.NewReader(os.Stdin)
    text, _ := reader.ReadString(‘\n’)
    text = strings.ToLower(text)
    vocales := []string{“a”, “e”, “i”, “o”, “u”, “y”}
    for _, v := range vocales {
        if strings.Contains(text, v) == true {
            text = strings.Replace(text, v, “”, -1)
        }
    }
    text = strings.TrimSpace(text)
    textSlice := strings.Split(text, “”)
    newtextslice := []string{}
    for _, ts := range textSlice {
        ts = “.” + ts
        newtextslice = append(newtextslice, ts)
    }
    finalText := strings.Join(newtextslice, “”)
    fmt.Println(finalText)
}


package main

import "fmt"

func main() {
	var glasnie [12]byte = [12]byte{'A', 'O', 'Y', 'E', 'U', 'I', 'a', 'o', 'y', 'e', 'u', 'i'}
	var c byte = 0
	var flag bool = false
	for {
		fmt.Scanf("%c", &c)
		if c == '-' {
			break
		}
		for i := 0; i < 12; i++ {
			if c == glasnie[i] {
				flag = true
			}
			if flag {
				break
			}
		}
		if flag {
			flag = false
			continue
		}
		if int(c) < 97 {
			c = byte(int(c) + 32)
		}
		fmt.Printf(".%c", c)
	}
}


package main

import (
	"fmt"
	"unicode"
)

func isVowel(letter rune) bool {
	if letter == 'a' || letter == 'e' || letter == 'i' || letter == 'o' || letter == 'u' || letter == "y" {
		return true
	}
	return false
}

func getManuplatedString(someString string) string {
	var constructedString string

	for _, letter := range someString {
		lowerLetter := unicode.ToLower(letter)
		if isVowel(lowerLetter) {
			continue
		}
		constructedString = constructedString + "." + string(lowerLetter)
	}

	return constructedString
}

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

	fmt.Println(getManuplatedString(someString))

}


package main

import (
        "fmt"
        "strings"
)

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


package main

import "fmt"

type byteSet map[byte]bool

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

	sets := make([]byteSet, 0)
	curSet := byteSet{}

	for i := 0; i < n; i++ {
		if s[i] >= 'a' && s[i] <= 'z' {
			curSet[s[i]] = true
		} else {
			sets = append(sets, curSet)
			curSet = byteSet{}
		}
	}

	maxSet := byteSet{}

	for _, set := range sets {
		if len(set) > len(maxSet) {
			maxSet = set
		}
	}

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


package main

import (
	"fmt"
)

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

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

	set := make(map[byte]bool)

	ans := 0

	for i := 0; i < N; i++ {

		if s[i] >= 'a' && s[i] <= 'z' {
			if _, ok := set[s[i]]; !ok {
				set[s[i]] = true
			}
		} else {

			count := len(set)
			if count == 0 {
				continue
			}

			if ans < count {
				ans = count
			}
			set = make(map[byte]bool)
		}
	}

	fmt.Println(ans)
}


package main

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

func main() {
	var r,c, hewtee, bosoo int
	var s []string

	var so string
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d %d\n", &r, &c)
	for i := 0; i < r; i++{
		fmt.Fscanf(in, "%s\n", &so)
		s = append(s, so)
	}
	for i:=0; i < r; i++{
		var found bool = false
		for j:=0; j < c; j++{
			if string(s[i][j]) == "S"{
				found = true
			}
		}
		if !found{
			hewtee++
		}
	}
	for i:=0; i < c; i++{
		var found bool = false
		for j:=0; j < r; j++{
			if string(s[j][i]) == "S"{
				found = true
			}
		}
		if !found{
			bosoo++
		}
	}
	fmt.Println((hewtee * c) + bosoo * r - bosoo)
}


package main

import (
    "fmt"
    "strings"
    )

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

    rs := 0
    cx := make([]bool, c, c)
    for i := 0; i < r; i++ {
        var line string
        fmt.Scan(&line)
        idx := strings.Index(line, "S")
        if idx >= 0 {
            rs++
            cx[idx] = true
        }
    }

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

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


package main

import (
    "fmt"
    )

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

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

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

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


package main

import "fmt"

func main() {
	var n, k, t int
	fmt.Scan(&n, &k, &t)
	if n < t {
		n += k - t
	}
	if n > k {
		n = k
	}
	fmt.Println(n)
}


package main
import (
	"fmt"
	"bufio"
	"os"
	//"strconv"
	//"sort"
)

func main() {
	var n,x int
	out := bufio.NewWriter(os.Stdout)
	cek:=0
	fmt.Scan(&n)
	for i:=0;i<n;i++ {
		fmt.Scan(&x)
		if x==0 {
			cek++
		}
	}
	if n==1 || (n%2==0 && cek==0) || cek%2!=0 {
		out.WriteString("NO"+"\n")
	} else {
		out.WriteString("YES"+"\n")
	}
	out.Flush()
}


package main

import "fmt"

func main() {
    var n,w int
    fmt.Scan(&n)
    total := 0
    for i := 0; i < n; i++ {
        fmt.Scan(&w)
        total += w/100
    }
    if total%2 == 0 { fmt.Println("YES") } else { fmt.Println("NO") }
}


package main

import (
	"bufio"
	. "fmt"
	"io"
	"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()
	const mod = 998244353
	pow := func(x, n int64) int64 {
		x %= mod
		res := int64(1)
		for ; n > 0; n >>= 1 {
			if n&1 == 1 {
				res = res * x % mod
			}
			x = x * x % mod
		}
		return res
	}
	inv := func(a int64) int64 { return pow(a, mod-2) }
	div := func(a, b int64) int64 { return a%mod * inv(b) % mod }
	var n int
	Fscan(in, &n)
	f := make([]int64, n+1)
	f[0] = 1
	f[1] = div(1, 2)
	f[2] = div(1,4)
	for i := 3; i <= n; i++ {
		f[i] = div(2*f[i-1]+f[i-2],4)
	}
	Fprint(out, f[n])
}

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


package main

import (
	"fmt"
)

const (
	mod = 998244353
	i2  = (mod + 1) / 2
)

func main() {
	n := 0
	fmt.Scanf("%d", &n)
	res := make([]uint64, n+1)
	res[0] = 1
	for i := 0; i < n; i++ {
		for j := i + 1; j <= n; j += 2 {
			res[j] = (res[j] + res[i])
		}
	}

	fmt.Printf("%d\n", (res[n]*exp(i2, n))%mod)
}

func exp(a uint64, p int) (r uint64) {
	r = 1
	for ; p > 0; p /= 2 {
		if p%2 == 1 {
			r = (a * r) % mod
		}
		a = (a * a) % mod
	}
	return r
}


package main

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

func main() {
	var n uint64
	in := bufio.NewReader(os.Stdin)
	fmt.Fscanf(in, "%d \n", &n)
    result := int(math.Pow(5, float64(n)))
    stringresult := strconv.Itoa(result)
    fmt.Println(stringresult[len(stringresult)-2:len(stringresult)])
}


package main
import "fmt"
func main() {
    fmt.Println("hello world")
}


/*
Attempting https://codeforces.com/contest/1384/problem/B2
which will take care of B1 also, if works
*/

package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	line1, _ := reader.ReadString('\n')
	line1_arr := strings.Fields(line1)
	// fmt.Println(line1_arr)
	T, _ := strconv.Atoi(line1_arr[0])
	//fmt.Println("T:", T)
	for t := 0; t < T; t++ {
		line2, _ := reader.ReadString('\n')
		line2_arr := strings.Fields(line2)
		N, _ := strconv.Atoi(line2_arr[0])
		K, _ := strconv.Atoi(line2_arr[1])
		L, _ := strconv.Atoi(line2_arr[2])
		// fmt.Println(N, K, L)
		line3, _ := reader.ReadString('\n')
		Astr := strings.Fields(line3)
		A := make([]int, N)
		var safe []int
		soln_possible := true
		for i:=0; i<N; i++ {
			A[i], _ = strconv.Atoi(Astr[i])
			if A[i] + K <= L {
				safe = append(safe, i)
			} else if A[i] > L {
				fmt.Println("No")
				soln_possible = false
				break
			}
		}
		//fmt.Println("A:", A)
		//fmt.Println("safe:", safe)

		if !soln_possible {
			continue
		}

		safe_ind := 0
		lower_bound := -1
		upper_bound := N
		if len(safe) > 0 {
			upper_bound = safe[safe_ind]
		}
		res := "Yes"
		for true {

			retval := is_path_safe(lower_bound, upper_bound, K, L, A)
			//	fmt.Println("is_path_safe() beg: ", lower_bound, "end: ", upper_bound, "retval: ", retval)
			if !retval {
				res = "No"
				break
			} else {
				if safe_ind > len(safe) -1 {
					break
				}

				lower_bound = safe[safe_ind]
				safe_ind++
				if safe_ind > len(safe) -1 {
					upper_bound = N
				} else {
					upper_bound = safe[safe_ind]
				}
			}
		}

		fmt.Println(res)
	}
}

func is_path_safe(beg, end, K, L int, A []int) bool {
	abeg := beg + 1
	aend := end - 1
	if abeg >= aend {
		return true
	}

	t := 0
	k := K
	for i:=abeg; i<=aend; i++ {
		x := A[i] + k - L
		if x > 0 {
			t += x
			k = get_k_phase(K, k, t)
		} else {
			t++
		}

	}

	// fmt.Println("t: ", t)
	if t >= 2*K {
		return false
	}

	return true
}

func get_k_phase(K, k, t int) int {
	t %= 2*K
	if t <= K {
		return k - t
	} else {
		return k
	}
}


package main

import "fmt"

func main() {
	var x, y, z, a, b, c int32
	fmt.Scanf("%d %d %d\n", x, y, z)
	fmt.Scanf("%d %d %d", a, b, c)
	if (a < x) || (a+b < x+y) || (a+b+c < x+y+z) {
		fmt.Printf("NO")
		return
	}
	fmt.Printf("YES")
	return
}


package main

import (
    "fmt"
)

func check(x, y, z, a, b, c int) bool {
    if a < x {
        return false
    }
    if c < z {
        return x+y <= a+b
    }
    return x+y+z <= a+b+c
}

func main() {
    var x, y, z, a, b, c int
    for {
        _, err := fmt.Scanf("%d %d %d\n%d %d %d", &x, &y, &z, &a, &b, &c)
        if err != nil {
            return
        }
        if check(x, y, z, a, b, c) {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }
}


package main

import "fmt"

func solve(x int, y int, z int, a int, b int, c int) int {
  if a >= x {
    return 0
  }
  if a+b >= x+y {
    return 0
  }
  if a+b+c >= x+y+z {
    return 0
  }
  return 1
}

func main() {
	var x, y, z, a, b, c int
	fmt.Scan(&x, &y, &z, &a, &b, &c)
	if solve(x,y,z,a,b,c) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import "fmt"

func solve(x int, y int, z int, a int, b int, c int) int {
  if a >= x || a+b >= x+y || a+b+c >= x+y+z {
    return 0
  }
  return 1
}

func main() {
	var x, y, z, a, b, c int
	fmt.Scan(&x, &y, &z, &a, &b, &c)
  if solve(x, y, z, a, b, c) == 1 {
    fmt.Println("YES")
	} else {
    fmt.Println("NO")
	}
}


package main

import (
    "fmt"
)

func main() {
    var a,b int64
    fmt.Scanf("%d %d ",&a, &b)
    var sq int64
    for true{
        if a == b {
            sq++
            break
        }
        if a <= 0 || b <= 0 {
            break
        }
        if a == 1{
            sq+=b
            break
        }
        if b == 1{
            sq+=a
            break
        }
        if a>b{
            a,b = a-b, b
            sq++
        }else {
            a, b = a, b-a
            sq++
        }
    }
    fmt.Printf("%d", sq)
}


package main

import (
    "fmt"
)

func main() {
    var a, b int
    fmt.Scanf("%d%d", &a, &b)
    var sum = 0
    var x = a % b
    sum = sum + a/b
    for x > 0 {
        sum = sum + a/b
        x = a % b
    }
    fmt.Println(sum)
}


package main

import "fmt"

func main() {
	var l, r, k int64
	fmt.Scanf("%d %d %d", &l, &r, &k)
	m := foo(l, r, k)
	fmt.Print(m)
}
func foo(l, r, k int64) int64 {
	min := Min(l, r)
	max := Max(l, r)
	if min+k < max {
		return 2 * (min + k)
	} else {
		return 2 * max
	}
}
func Min(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}
func Max(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}


package main

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

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

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

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

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

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

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

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

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	l := readi()
	r := readi()
	a := readi()

	if a == 0 {
		println(min(l, r) * 2)
	} else if max(l, r)-max(l, r) <= a {
		println((l + r + a) &^ 1)
	} else {
		println((min(l, r) + a) * 2)
	}

}


package main

import (
	"fmt"
)

func main() {
	var l, r, a int
	fmt.Scanf("%d %d %d", &l, &r, &a)

	if l > r {
		tmp := l
		l = r
		r = tmp
	}

	res := l
	if r-l < a/2 {
		res += (a + r - l) / 2
	} else {
		res += a / 2
	}

	res *= 2
	fmt.Println(res)
}


package main

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

func gcd(a, b int64) int64 {
//	fmt.Printf("->%d %d\n",a,b)
	if b%a == 0 {
		return a
	}
	return gcd(b%a, a)
}
func solveD(l, n, k int64) (int64) {

	gc := gcd(l, n*k)
	tmp := n * k/gc
	if tmp < 0{
		fmt.Printf("%d %d %d\n",l,n,k)
	}
	tmp *= l
	if tmp < 0{
		fmt.Printf("-%d %d %d\n",l,n,k)
	}
	return tmp / l
}
func main() {
	buf := bufio.NewReader(os.Stdin)
	var n, k int64
	var a, b int64
	fmt.Fscanf(buf, "%d %d\n", &n, &k)
	fmt.Fscanf(buf, "%d %d\n", &a, &b)
	basic := make([]int64, 0)
	for _, v1 := range [2]int64{a, (k - a)%k} {
		for _, v2 := range [2]int64{b, (k - b)%k} {
			if v2-v1 == 0 {
				basic = append(basic, k)
			} else if v2-v1 > 0 {
				basic = append(basic, v2-v1)
			} else {
				basic = append(basic, k+v2-v1)
			}
		}
	}
	var minx int64 = -1
	var maxx int64 = -1
//	fmt.Printf("%v\n", basic)
	for _, v := range basic {
		for i := int64(0); i < n; i++ {
			tmp := solveD(v+i*k,n,k)
			if minx == -1||minx > tmp{
				minx = tmp
			}
			if maxx == -1 || maxx < tmp{
				maxx = tmp
			}
		}
	}
	fmt.Printf("%d %d\n", minx,maxx)

}

/**
01010101
0101010
 */


package main

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

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

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

	board := make([]string, 8)
	maxB, minW := 0, 10

	for i := range board {
		board[i] = next()
	}

	for c := 0; c < 8; c++ {
		b, w := -1, -1
		for r := 0; r < 8; r++ {
			if board[r][c] == 'B' {
				b = r
			}

			if w == -1 && board[r][c] == 'W' {
				w = r
			}
		}

		// println(w, b, minW, maxB)
		if w != -1 && b != -1 && w > b {
			continue
		}

		if w != -1 && w < minW {
			minW = w
		}

		if b != -1 && b > maxB {
			maxB = b
		}
	}

	// println(minW, maxB)
	maxB = 8 - maxB - 1
	// println(minW, maxB)
	if minW <= maxB {
		println("A")
	} else {
		println("B")
	}
}

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

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

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

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

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

func println(a ...interface{})               { fmt.Fprintln(writer, a...) }
func print(a ...interface{})                 { fmt.Fprint(writer, a...) }
func printf(format string, a ...interface{}) { fmt.Fprintf(writer, format, a...) }


// Author: sighduck
// URL: https://codeforces.com/problemset/problem/592/A

package main

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

func Solve(board [8]string) string {
	highestWhitePawn := 0
	lowestBlackPawn := 0
	for j := 0; j < 8; j++ {
		for i := 0; i < 8; i++ {
			if string(board[i][j]) == "B" {
				break
			} else if string(board[i][j]) == "W" {
				highestWhitePawn = i
				break
			}
		}
		for i := 7; i >= 0; i-- {
			if string(board[i][j]) == "W" {
				break
			} else if string(board[i][j]) == "B" {
				lowestBlackPawn = i
				break
			}
		}
	}
	if highestWhitePawn <= 7-lowestBlackPawn {
		return "A"
	}
	return "B"
}

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

	var board [8]string
	for i := 0; i < 8; i++ {
		fmt.Fscanf(reader, "%s\n", &board[i])
	}
	fmt.Fprintf(writer, "%s\n", Solve(board))
}


// Try Codeforces
// author: Leonrdone @ NEETSDKASU
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	xs := make([]int, n)
	for i := range xs {
		fmt.Scan(&xs[i])
	}
	ans := n
	for i, x := range xs[1:] {
		if xs[i] == 1 && x == 0 {
			ans--
		}
	}
	fmt.Println(ans)
}


package main

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

const maxTokenSize = 512 * 1024

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, maxTokenSize), maxTokenSize)

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

	a := make([]int, n)

	for i := 0; i < n; i++ {
		scanner.Scan()
		a[i], _ = strconv.Atoi(scanner.Text())
	}

	var l, r int

	for l < n {
		if a[l] == 1 {
			break
		}
		l++
	}

	r = n - 1
	for r > n-1 {
		if a[r] == 0 {
			break
		}
		r--
	}
	var ones, zeroes int
	for i := l; i < r; i++ {
		if a[i] == 1 {
			ones++
		} else {
			zeroes++
		}
	}
	if ones < zeroes {
		fmt.Println(n - ones)
	} else {
		fmt.Println(n - zeroes)
	}
}


package main

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

func main() {
	A, B, C, D := scanInt64(), scanInt64(), scanInt64(), scanInt64()
	var count = 0
	for x := A; x <= B; x++ {
		for y := B; y <= C; y++ {
			for z := C; z <= D; z++ {
				if x + y > z && x + z > y && y + z > x {
					count ++
				}
			}
		}
	}
	_, _ = printFmt(count)
}

/*********************** 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"
	"math"
	"os"
	"strconv"
	"strings"
)

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

	out.Flush()
}

func solve(a, b, c, d int) int64 {
	sum := int64(0)
	p := make([]int, Mx(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 := Mx(b+c+1, d+1); i >= a; i-- {
		p[i-1] += p[i]
	}

	P(p)
	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 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
}


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()
	ans := int64(0)
	for x := a; x <= b; x++ {
		for y := b; y <= c; y++ {
			if x + y > d {
				ans += d-c+1
			} else if x + y > c {
				ans += (x+y-c)
			}
			writer.Printf("%d %d %d\n", x, y, ans)
		}
	}
	writer.Printf("%d\n", 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()
	ans := int64(0)
	for x := a; x <= b; x++ {
		for y := b; y <= c; y++ {
			if x + y > d {
				ans += d-c+1
			} else if x + y > c {
				ans += (x+y-c)
			}
		}
	}
	writer.Printf("%d\n", ans)
}


// aaa project main.go
package main

import (
	"fmt"
)

func getTime1(h, m int) int {
	return h*60 + m
}

func getTime2(time int) (int, int) {
	return time / 60, time % 60
}

func ok(curtime int) bool {
	h, m := getTime2(curtime)
	if h/10 == 7 || h%10 == 7 {
		return false
	} else if m/10 == 7 || m%10 == 7 {
		return false
	} else {
		return true
	}
}

func main() {
	var x, h, m int
	fmt.Scanf("%d\n%d %d", &x, &h, &m)
	alltime := 0
	curtime := getTime1(h, m)
	//fmt.Println(curtime)
	for ok(curtime) {
		curtime -= x
		if curtime < 0 {
			curtime += 23*60 + 59
		}
		alltime++
	}
	fmt.Println(alltime)
}


package main

import (
	"fmt"
	"time"
)

func main() {
	var x, h, m int
	fmt.Scanf("%d\n%d %d", &x, &h, &m)
	fmt.Println(m)
	t := time.Date(2000, time.November, 10, h, m, 0, 0, time.UTC)
	i := 0
	for true {
		hour := t.Hour()
		if hour%10 == 7 {
			break
		}
		minute := t.Minute()
		if minute%10 == 7 {
			break
		}
		t = t.Add(-time.Duration(x) * time.Minute)
		i++
	}
	fmt.Print(i)
}


package main

import (
	"fmt"
	"time"
)

func main() {
	var x, h, m int
	n, err := fmt.Scanln(&x)
	if err != nil {
		panic(err)
	}
	if n != 1 {
		panic(n)
	}
	n, err = fmt.Scanln(&h, &m)
	if err != nil {
		panic(err)
	}
	if n != 2 {
		panic(n)
	}
	t := time.Date(2000, time.November, 10, h, m, 0, 0, time.UTC)
	i := 0
	for true {
		hour := t.Hour()
		if hour%10 == 7 {
			break
		}
		minute := t.Minute()
		if minute%10 == 7 {
			break
		}
		t = t.Add(-time.Duration(x) * time.Minute)
		i++
	}
	fmt.Print(i)
}


package main

import "fmt"

func main() {
	var x, h, m int
	fmt.Scanf("%d", &x)
	fmt.Scanf("%d %d", &h, &m)
	y := 0
	for m%10 != 7 && m != 7 {
		if m <= x {
			m += 60
			h--
		}
		m -= x
		y++
	}
	fmt.Println(y)
}


package main

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

func solve() {
	n := readInt64()
	l := readInt() - 1
	r := readInt() - 1
	if n == 0 {
		fmt.Println(0)
		return
	}
	tmpn := int64(1)
	req := 0
	for tmpn < n {
		tmpn <<= 1
		req = req*2 + 1
	}
	dfs(0, req-1, n, l, r)
	fmt.Println(cnt)
}

var cnt int

func dfs(lo int, hi int, val int64, l int, r int) {
	if val == 0 {
		return
	}
	mid := (lo + hi) / 2
	if val%2 == 1 && l <= mid && mid <= r {
		cnt++
	}
	dfs(lo, mid-1, val/2, l, r)
	dfs(mid+1, hi, val/2, l, r)
}

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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


package main

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

func solve() {
	n := readInt64()
	l := readInt64() - 1
	r := readInt64() - 1
	if n == 0 {
		fmt.Println(0)
		return
	}
	tmpn := int64(1)
	var req int64
	for tmpn < n {
		tmpn <<= 1
		req = req*2 + 1
	}
	dfs(0, req-1, n, l, r)
	fmt.Println(cnt)
}

var cnt int

func dfs(lo int64, hi int64, val int64, l int64, r int64) {
	if val == 0 {
		return
	}
	if l > hi || lo > r {
		return
	}
	mid := (lo + hi) / 2
	if val%2 == 1 && l <= mid && mid <= r {
		cnt++
	}
	dfs(lo, mid-1, val/2, l, r)
	dfs(mid+1, hi, val/2, l, r)
}

var scanner *bufio.Scanner

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

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

// IO

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

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

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

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

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


package main

import ("fmt")

func monthfunc(date int) int {
	var count int
	arr := []int{31,29,31,30,31,30,31,31,30,31,30,31}
	for i:=0;i<12;i++{
		if date<=arr[i]{
			count++
		}
	}
	return count
}

func weekfun(day int) int{
	var count int
	var current int = 5
	for i:=0;i<366;i++{
		if current == day{
			count++
		}
		current++
		if current > 7{
			current = 0
		}
	}
	return count
}

func main(){

	var ans int
	var str string
	fmt.Scan(&str)
	var number int = int(str[0])

	if string(str[len(str)-1])=="k"{
		ans = weekfun(number)
	}else{
		ans = monthfunc(number)
	}

	fmt.Print(ans)
}


package main

import "fmt"

//import "strings"

var s string
var n, ans int

func main() {
        fmt.Scanf("%d of %s", &n, &s)
        switch s {
        case "week":
                ans = cal_week(n)
        case "month":
                ans = cal_month(n)
        }
        fmt.Println(ans)
}

func cal_week(n int) int {
        if n == 5 {
                return 53
        } else {
                return 52
        }

}

func cal_month(n int) int {
        if n < 28 {
                return 12
        } else if n == 30 {
                return 11
        } else {
                return 7
        }
}


package main

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

func main() {
	var s string
	fmt.Scanln(&s)
	ss := strings.Split(s, " ")
	d, _ := strconv.Atoi(ss[0])
	if ss[len(ss)-1] == "month" {
		if d <= 29 {
			fmt.Println("12")
			return
		}
		if d <= 30 {
			fmt.Println("11")
			return
		}
		if d <= 31 {
			fmt.Println("7")
			return
		}
	}
	cw := 366 / 7
	if d == 5 || d == 6 {
		cw++
	}
	fmt.Printf("%v", cw)
	return
}


// cf611a project main.go
package main

import (
	"fmt"
)

func main() {
	var x int
	var s string
	fmt.Scanf("%d of %s", &x, &s)
	m := []int{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
	d := []int{52, 52, 52, 52, 53, 53, 52}
	if s == "week" {
		fmt.Println(d[x-1])
	} else {
		var c int
		for _, v := range m {
			if v <= x {
				c++
			}
		}
		fmt.Println(c)
	}
}


package main

import "fmt"
import "os"

import "strconv"
import "strings"

func L(n int) int {
	if n==0 { return 0 }
	var P=make([]int, n+1)
	var C=make([]int, 10)

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

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

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

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


package main

import (
	"fmt"
	"sort"
)

func main() {
	li := make([]int, 5)
	sum := 0
	for i := 0 ; i < 5; i++ {
		fmt.Scanf("%d", &li[i])
		sum += li[i]
	}
	sort.Ints(li)
	cut := 0
	for i:=4; i>= 0; i-- {
		if i >= 2 && li[i] == li[i-1] && li[i-1] == li[i-2] {
			cut += li[i] * 3
			break
		}
		if i >= 1 && li[i]  == li[i-1] {
			cut += li[i] *2
			break
		}
	}
	fmt.Printf("%d", sum-cut)
}


package main

import (
	"fmt"
	"sort"
	"github.com/qiuyesuifeng/goyacc/Godeps/_workspace/src/github.com/cznic/mathutil"
)

func main() {
	li := make([]int, 5)
	sum := 0
	for i := 0 ; i < 5; i++ {
		fmt.Scanf("%d", &li[i])
		sum += li[i]
	}
	sort.Ints(li)
	cut := 0
	for i:=4; i>= 0; i-- {
		if i >= 2 && li[i] == li[i-1] && li[i-1] == li[i-2] {
			cut = mathutil.Max(cut, li[i] * 3)
		}
		if i >= 1 && li[i]  == li[i-1] {
			cut = mathutil.Max(cut, li[i] * 2)
		}
	}
	fmt.Printf("%d", sum-cut)
}


package main

import (
	"fmt"
	"sort"
)

func solve(cards [5]int) int {
	sort.Ints(cards[:])
	if cards[3] == cards[4] {
		if cards[2] == cards[3] {
			return cards[0] + cards[1]
		}
		return cards[0] + cards[1] + cards[2]
	}
	// cards[3] != cards[4]
	if cards[2] == cards[3] {
		if cards[1] == cards[2] {
			return cards[0] + cards[4]
		}
		return cards[0] + cards[1] + cards[4]
	}
	// cards[2] != cards[3]
	if cards[1] == cards[2] {
		if cards[0] == cards[1] {
			return cards[3] + cards[4]
		}
		return cards[0] + cards[3] + cards[4]
	}
	// cards[1] != cards[2]
	if cards[0] == cards[1] {
		return cards[2] + cards[3] + cards[4]
	}
	// cards[0] != cards[1]
	return cards[0] + cards[1] + cards[2] + cards[3] + cards[4]
}

func main() {
	var cards [5]int
	n, err := fmt.Scanln(&cards[0], &cards[1], &cards[2], &cards[3], &cards[4])
	if n != 5 || err != nil {
		panic(err)
	}
	sum := solve(cards)
	fmt.Println(sum)
}


package main

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

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)
	var a1,b1,c1,a2,b2,c2 int
	fmt.Fscanf(reader, "%d %d %d\n", &a1, &b1, &c1)
	fmt.Fscanf(reader, "%d %d %d", &a2, &b2, &c2)

	if a1 * b2 - a2 * b1 != 0 {
		fmt.Printf("1")
	} else if a1 * c2 - a2 * c1 == 0 {
		fmt.Printf("-1")
	} else {
		fmt.Printf("0")
	}
	return
}


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 gcd(a, b int) int {
  sign := 1
  if a < 0 {
    a = -a
    sign = -sign
  }
  if b < 0 {
    b = -b
    sign = -sign
  }
  for b != 0 {
    a, b = b, a%b
  }
  return sign*a
}

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

  result := 0
  a1, b1, c1 := getI(), getI(), getI()
  a2, b2, c2 := getI(), getI(), getI()
  g1, g2 := gcd(a1, b1), gcd(a2, b2)
  a1, b1, a2, b2 = a1/g1, b1/g1, a2/g2, b2/g2
  if a1 == a2 && b1 == b2 {
    if c1 == c2 {
      result = -1
    }
  } else {
    result = 1
  }

  writer.WriteString(fmt.Sprintf("%d\n", result))
}


package main

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

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

	return s
}

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

	if e == 0 {
		return 1
	}

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

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

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

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

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

	return a
}

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

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

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

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

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

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

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

	return string(res)
}

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

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

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

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

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

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

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

var n int64

func main() {
	n = ReadInt64()

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

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

	fmt.Println(2)
}

// IsPrime judges whether an argument integer is a prime number or not.
func IsPrime(n int64) bool {
	if n == 1 {
		return false
	}

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

	return true
}

// エラトステネスの篩: O(NloglogN)
// n以下の素数の数と素数のスライスを返す
func sieve(n int) (int, []int) {
	// var prime [2000000 + 5]int
	prime := []int{}
	var isPrime [2000000 + 5 + 1]bool

	p := 0
	for i := 0; i <= n; i++ {
		isPrime[i] = true
	}
	isPrime[0], isPrime[1] = false, false

	for i := 2; i <= n; i++ {
		// iがtrueで残っている場合は素数認定し、自分より大きい倍数を取り除いていく
		if isPrime[i] {
			// prime[p] = i
			prime = append(prime, i)
			p++

			// 倍数の除去
			for j := 2 * i; j <= n; j += i {
				isPrime[j] = false
			}
		}
	}

	return p, prime
}

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

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


package main

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

const (
	MAX_INT int64 = math.MaxInt64
	MIN_INT int64 = math.MinInt64
)

func main() {

	num := ScanInt64()

	if isPrime(num) {
		fmt.Println(num)
	} else if num%2 == 0 && num%3 == 0 {
		fmt.Println("1")
	} else if num%2 != 0 && num%3 == 0 {
		fmt.Println("3")
	} else if num%2 == 0 && num%3 != 0 {
		fmt.Println("2")
	}
	close(out)
	outWg.Wait()
}

func isPrime(num int64) bool {
	return big.NewInt(num).ProbablyPrime(20)
}

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

var out chan string
var in *bufio.Scanner
var outWg *sync.WaitGroup

func init() {
	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(2e+5))
	in.Split(bufio.ScanWords)

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

	writer := bufio.NewWriterSize(os.Stdout, int(2e+5))
	go func(writer *bufio.Writer) {
		defer outWg.Done()
		defer writer.Flush()

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

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

func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}

func ScanInt64() int64 {
	intStr := ScanWord()
	i, err := strconv.ParseInt(intStr, 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

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

func Max(args ...int64) int64 {
	maxVal := MIN_INT
	for _, v := range args {
		if v > maxVal {
			maxVal = v
		}
	}
	return maxVal
}

func Min(args ...int64) int64 {
	minVal := MAX_INT
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
	}
	return minVal
}

func LCM(a, b int64) int64 {
	return a / GCD(a, b) * b
}

func GCD(a, b int64) int64 {
	if (a == 0) {
		return b
	}
	return GCD(b%a, a)
}

func iToS(v int64) string {
	return strconv.FormatInt(v, 10)
}


package main

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

func sum(n int64) int64 {
	var summ int64
	for n > 0 {
		summ += n%10
		n /= 10
	}
	return summ
}

func main(){
	var n int64
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n, _ = strconv.ParseInt(r.Text(), 0, 64)
	var l int64 = int64(math.Sqrt(float64(n)))-40
	if l < 0 {
		l = 1
	}
	var s int64 = int64(math.Sqrt(float64(n)))+1
	for i:=l; i<s; i++ {
		if i*i+i*sum(i) == n {
			w.WriteString(strconv.FormatInt(i, 10)+"\n")
			w.Flush()
			return
		}
	}
}


package main

import "fmt"

/*
var (
	a, b int
	s1,s2 string
)

func main() {
	fmt.Scan(&a,&b)
	fmt.Scanln(&s1)
	fmt.Scanln(&s2)
	if strings.Contains(s1,"*") {
		ss := strings.Split(s1,"*")
		l := len(ss[0])
		if strings.Contains(s2[:l],ss[0])&&strings.Contains(s2[l:],ss[1]){
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	} else {
		if strings.Contains(s1,s2) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}

}
*/

var (
	n,k int
)

func main()  {
	fmt.Scan(&n,&k)
	if k>2*k-1{
		fmt.Println(0)
	} else {
		if k-1<n {
			fmt.Println((k-1)/2)
		}	else {
			fmt.Println(n-k/2+1/2)
		}
	}
}


package main

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

func main() {
	sc := NewScanner()
	N, K := sc.NextInt64(), sc.NextInt64()
	m := int64(0)
	if K%2 == 0 {
		m = K/2 - 1
	} else {
		m = K / 2
	}
	Q := max(0, min(m, N-m))
	fmt.Println(Q)

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

func min(a int64, b int64) int64 {
	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 "fmt"

func main() {
	var count int
	var point_war int
	sum_war := 0
	var sum_my int;
	min_k := 0;
	fmt.Scan(&count)
	var points [100]int;
	var result int;
	for i := 0; i < count; i++ {
		fmt.Scan(&point_war)
		points[i] = point_war
		sum_war += point_war
		if (point_war > min_k) {
			min_k = point_war
		}
	}
	for i := min_k; i <= 100 ; i++ {
		sum_my = 0;
		for j := 0; j < count; j++ {
			sum_my += min_k - points[i]
		}
		if (sum_my > sum_war) {
			result  = i;
			break;
		}
	}
	fmt.Println(result)

}


package main

import "fmt"

func main() {
	var count int
	var point_war int
	sum_war := 0
	var sum_my int
	min_k := 0
	fmt.Scan(&count)
	var points [150]int
	var result int
	for i := 0; i < count; i++ {
		fmt.Scan(&point_war)
		points[i] = point_war
		sum_war += point_war
		if point_war > min_k {
			min_k = point_war
		}
	}
	for i := min_k; i <= 100; i++ {
		sum_my = 0
		for j := 0; j < count; j++ {
			sum_my += i - points[j]
		}
		if sum_my > sum_war {
			result = i
			break
		}
	}
	fmt.Println(result)

}


package main

import "fmt"

func main() {

	var n, k int
	maxElem, sumA := 0, 0

	fmt.Scan(&n)
	A := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&A[i])
		sumA += A[i]
		if A[i] > maxElem {
			maxElem = A[i]
		}
	}

	k = maxElem

	sumB := 0
	for i := 0; i < n; i++ {
		sumB += maxElem - A[i]
	}

	for ; sumB < sumA; {
		k++
		sumB += n
	}
	fmt.Print(k)
}


package main

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

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

	codes := []string{}
	b := 0
	for _, c := range strings.TrimSpace(cs) {
		if c == 'B' {
			b++
		} else {
			if b > 0 {
				codes = append(codes, fmt.Sprintf("%d", b))
				b = 0
			}
		}
	}
	if b > 0 {
		codes = append(codes, fmt.Sprintf("%d", b))
	}

	if len(codes) > 0 {
		fmt.Fprintln(os.Stdout, strings.Join(codes, " "))
	} else {
		fmt.Fprintln(os.Stdout, 0)
	}

}


// hello project main.go
package main

import (
	"fmt"
)

func max(num1 int, num2 float32) int {
	var result int
	if num1 > int(num2) {
		result = num1
	} else {
		result = int(num2)
	}
	return result
}

func swap(x string, y string) (string, string) {
	return y, x
}

func main() {
	n, m := 0, 0
	fmt.Scanf("%lld %lld", &n, &m)
	a := n / 5
	b := m / 5
	c, d := n%5, m%5
	ans := a * b * 5
	ans += a * d
	ans += b * c
	//	fmt.Println(ans)
	var i, j int
	for i = 1; i <= c; i++ {
		for j = 1; j <= d; j++ {
			if (i+j)%5 == 0 {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


// test project main.go
package main

import (
	"fmt"
)

func main() {
	//bio := bufio.NewReader(os.Stdin)
	//line, hasMoreInLine, err := bio.ReadLine()
	//fmt.Println("line: ", line, hasMoreInLine, err)

	var num int
	var num2 int
	fmt.Scanln(&num, &num2)

	count := 0

	for i := 1; i <= num; i++ {
        for j := 1; j <= num2; j++ {
			if (i + j) % 5 == 0 {
				count++;
			}
		}
    }

	fmt.Println(count)
}


// cf682a project main.go
package main

import (
	"fmt"
)

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

	fmt.Println((((n * m) + 2) / 5) + l)
}


package main

import (
	"fmt"
	"sort"
)

func main() {
	a := make([]int, 6)
	var l int
	for i := range a {
		fmt.Scan(&l)
		a[i] = l
	}
	sort.Ints(a)
	isBear := func() bool {
		return a[1] == a[4] && a[0] < a[5]
	}
	isElephant := func() bool {
		return a[0] == a[1] && a[2] == a[5] || a[0] == a[3] && a[4] == a[5]
	}

	res := "Alien"
	switch {
	case isBear():
		res = "Bear"
	case isElephant():
		res = "Elephant"
	}
	fmt.Println(res)
}


package main

import "fmt"

var sticks [10]int

func main() {
	v := 0
	for i := 0; i < 6; i++ {
		fmt.Scan(&v)
		sticks[v] += 1
	}

	legOk := false
	elephant := false
	for i := 0; i < len(sticks); i++ {
		if sticks[i] == 4 {
			legOk = true
		} else if sticks[i] == 2 {
			elephant = true
		}
	}

	if !legOk {
		fmt.Println("Alien")
	} else if elephant {
		fmt.Println("Elephant")
	} else {
		fmt.Println("Bear")
	}
}


package main

import (
    "fmt"
    )

func main() {
    var length[6] int
    var counts[10] int
    for i := 0; i < 6; i++ {
        fmt.Scan(&length[i])
        counts[length[i]]++
    }

    leg := -1
    for i := 0; i < 10; i++ {
        if counts[i] >= 4 {
            leg = i
        }
    }
    if leg == -1 {
        fmt.Println("Alien")
    } else {

        a := -1
        b := -1
        if (counts[leg] == 5) {
            a = leg
        } else if (counts[leg] == 6) {
            b = leg
        }

        for i := 0; i < 10; i++ {
            if counts[i] > 0 && i != leg {
                if a == -1 {
                    a = i
                } else if b == -1 {
                    b = i
                }
            }
        }

        if b == -1 {
            b = a
        }

        if a == b {
            fmt.Println("Elephant")
        } else {
            fmt.Println("Bear")
        }
    }
}


package main

import "fmt"

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

func main() {
	var d1, d2, d3 int
	fmt.Scanf("%d %d %d", &d1, &d2, &d3)

	ret := min(d1 + min(d1 + 2 * d2, d3 + d2),
			   d2 + min(d2 + 2 * d1, d3 + d1))
	fmt.Printf("%d", ret)
}


package main

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

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

type MySlice [][2]int

func (slice MySlice) Len() int           { return len(slice) }
func (slice MySlice) Less(i, j int) bool { return slice[i][1] < slice[j][1] }
func (slice MySlice) Swap(i, j int) {
	slice[i], slice[j] = slice[j], slice[i]
}

func main() {
	ini()
	defer writer.Flush()

	d1 := scanInt()
	d2 := scanInt()
	d3 := scanInt()

	if d3+d2+d1 < 2*(d1+d2) {
		writer.WriteString(strconv.Itoa(d3 + d2 + d1))
	} else {
		writer.WriteString(strconv.Itoa(2 * (d1 + d2)))
	}

	return
}

func binSearch(a []int, key int) int {
	l := -1
	r := len(a)
	for l < r-1 {
		m := (l + r) / 2
		if a[m] < key {
			l = m
		} else {
			r = m
		}
	}

	if a[r] != key {
		return -1
	}

	return r
}

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

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

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


package main

import (
	"fmt"
)

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

	const (
		mod = 1e9 + 7
	)

	res := 0

	res = a * (a + 1)
	res %= mod
	res *= b
	res %= mod
	res /= 2
	res += a
	res = res * (((b * (b - 1)) % mod) / 2)
	res %= mod
	fmt.Println(res)
}


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 + 1)) % mod
    }
    fmt.Fprintln(out, sum)
}


package main

import (
	"fmt"
	"strings"
)

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


package main

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

func main() {
	var in string
	fmt.Scanf("%s\n", &in)
	in = strings.ToLower(in)
	in = strings.Replace(in, "a", ".", -1)
	in = strings.Replace(in, "o", ".", -1)
	in = strings.Replace(in, "u", ".", -1)
	in = strings.Replace(in, "i", ".", -1)
	in = strings.Replace(in, "y", ".", -1)
	in = strings.Replace(in, "e", ".", -1)
	match, _ := regexp.MatchString("([a-z][a-z])", in)
	if(match){
	      for i:=1; i<len(in); i++ {
	            if( in[i]!='.' && in[i-1]!='.'){
	                  in = string(in[:i]+"."+in[i:])
	            }
	      }
	}
  for i:=0; i<len(in); i++ {
	            if( in[i]=='.' && in[i+1]=='.'){
	                  in = string(in[:i]+in[i+1:])
	            }
	      }
        in = strings.Replace(in, "..", ".", -1)

	if(in[0]!='.'){
	      in = string('.')+in
	}

  if(in[len(in)-1]=='.'){
	      fmt.Println(in[:len(in)-1])
	}else{
    fmt.Println(in)
  }

}


package main

import "fmt"
import "strings"

func main() {
    for {
        s, t := "", ""
        n, _ := fmt.Scanf("%s\n", &s)

        if n == 0 {
            break
        }

        for i := 0; i < len(s); i++ {
            switch s[i] {
                case 'a', 'e', 'i', 'o', 'u', 'y'
                     'A', 'E', 'I', 'O', 'U', 'Y':
                default:
                    t = t + "." + string(s[i])
            }
        }

        t = strings.ToLower(t)
        fmt.Println(t)
    }
}


package main

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

// a+b+e+g == a+c+f+g == b+d+g+h == c+d+g+i
//
// b+e = c+f
// a+f = d+i
// b+h = c+i
// a+e = d+h
//
// e-f = c-b
// h-i = c-b
// e-h = d-a
// f-i = d-a
//
// f+h = e+i
//
// g can be anything from 1 to n
// assume c >= b && d >= a (problem is symmetric)
// i can be from 1 to (n-(c-b)-(d-a))
// h = i + (c-b); from (1+(c-b)) to (n-(d-a))
// f = i + (d-a); from (1+(d-a)) to (n-(c-b))
// e = i + (c-b) + (d-a); from (1+(c-b)+(d-a)) to n
//
// total combinations: n * (n-(c-b)-(d-a)) assuming c>=b && d>=a
//
func Combinations(n, a, b, c, d uint64) uint64 {
	if b > c {
		c, b = b, c
	}
	if a > d {
		d, a = a, d
	}
	return n*(n-(c-b)-(d-a))
}

func CombinationsStr(s string) string {
	var n, a, b, c, d uint64
	fmt.Sscanf(s, "%d %d %d %d %d", &n, &a, &b, &c, &d)
	res := Combinations(n, a, b, c, d)
	return fmt.Sprint(res)
}

func main() {
	// fmt.Println(CombinationsStr("2 1 1 1 2")) // 2
	// fmt.Println(CombinationsStr("3 3 1 2 3")) // 6
	buf, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}
	res := CombinationsStr(string(buf))
	fmt.Println(res)
}


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

	println(n/a*p + n/b*q - n/(a*b)*gcd(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 (
	"fmt"
	"math"
)

func main() {
	if solve() {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func solve() bool {
	var n, R, r float64
	fmt.Scan(&n, &R, &r)
	if r > R {
		return false
	}
	if R == r {
		return n == 1
	}
	return math.Pi/math.Asin(r/(R-r))+1e-9 >= n
}


package main

import (
    "fmt"
    "math"
)

func main() {
    var n,r,R float64
    fmt.Scan(&n,&R,&r)
    if ((n == 1) && (r <= R)) || ((math.Asin(r/(R-r))-(math.Pi/n)) <= 0.0000001) {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}


// 140A
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, r, x int
	var c float64
	fmt.Scan(&n, &r, &x)
	if n == 1 {
		if x > r {
			fmt.Println("NO")
		} else {
			fmt.Println("YES")
		}

	} else {
		c = float64(x)/math.Sin(float64(3.14159)/float64(n)) + float64(x)
		c = c - float64(r)
		if c > 0.00001 {
			fmt.Println("NO")
		} else {
			println("YES")
		}
	}
}


package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n)
	fmt.Scan(&s)
	xs := make([]int, n)
	for i, r := range []rune(s) {
		xs[i] = int(r - '0')
	}
	x := 0
	for i := n - 1; i >= 0; i-- {
		x <<= 1
		x += xs[i]
	}
	y := x + 1
	ys := make([]int, n)
	for i := 0; i < n; i++ {
		ys[i] = y & 1
		y >>= 1
	}
	z := 0
	for i := 0; i < n; i++ {
		if xs[i] != ys[i] {
			z++
		}
	}
	fmt.Println(z)
}


package main

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

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


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

import (
	"fmt"
)

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

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

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


package main

import "fmt"

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

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

    fmt.Println(ans)
}


package main

import "os"
import "bufio"

func main(){
	var n string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n = r.Text()
	if n <= "127" {
		w.WriteString("byte")
	} else if n <= "32767" {
		w.WriteString("short")
	} else if n <= "2147483647" {
		w.WriteString("int")
	} else if n <= "9223372036854775807" {
		w.WriteString("long")
	} else {
		w.WriteString("BigInteger")
	}
	w.WriteString("\n")
	w.Flush()
}


package main

import "fmt"

func main() {
	n := 0
	fmt.Scan(&n)

	inputPiles := make([]int, n)
	pilesOutput := make([]int, n)

	for i := range inputPiles {
		fmt.Scan(&inputPiles[i])
	}
	for i := range pilesOutput {
		fmt.Scan(&pilesOutput[i])
	}

	inputPilesSum := sum(inputPiles)
	outputPilesSum := sum(pilesOutput)

	if inputPilesSum >= outputPilesSum {
		println("Yes")
		return
	}
	println("No")
}

func sum(slice []int) int {
	sum := 0
	for _, value := range slice {
		sum += value
	}

	return sum
}


package main

import "fmt"

func main() {
	n := 0
	fmt.Scan(&n)

	inputPiles := make([]int, n)
	pilesOutput := make([]int, n)

	for i := range inputPiles {
		fmt.Scan(&inputPiles[i])
	}
	for i := range pilesOutput {
		fmt.Scan(&pilesOutput[i])
	}

	inputPilesSum := sum(inputPiles)
	outputPilesSum := sum(pilesOutput)

	if inputPilesSum >= outputPilesSum {
		fmt.println("Yes")
		return
	}
	fmt.println("No")
}

func sum(slice []int) int {
	sum := 0
	for _, value := range slice {
		sum += value
	}

	return sum
}


package codeforces

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

func convertAndCount(x []string) int {
	c := 0
	for _, s := range x {
		n, _ := strconv.Atoi(s)
		c += n
	}
	return c
}

func main() {
	var n int
	fmt.Scanln(&n)
	var s1, s2 string
	fmt.Scanln(&s1)
	fmt.Scanln(&s2)

	if convertAndCount(strings.Split(s1, " ")) == convertAndCount(strings.Split(s2, " ")) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

import "fmt"

var (
	n, input, ans int
	mp1 map[int]int
)

func main() {
	fmt.Scanln(&n)

	mp1 = make(map[int]int)
	ans = 1

	for i := 0; i < n; i++ {
		fmt.Scan(&input)
		mp1[int(input)] = 1
	}

	for i := 0; i < n; i++ {
		fmt.Scan(&input)
		if input != 0 && mp1[int(input)] == 0 {
			ans = 0
		}
	}

	if ans > 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


package main

import (
	"fmt"
	"strings"
)

func main() {
	var s, r string
	fmt.Scan(&s)
	if strings.ContainsAny(s, "HQ9") {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


package main

import (
	"fmt"
	"os"
)

func main() {
	var code string
	fmt.Scanf("%s\n", &code)
	for _, char := range code {
		if char == 'H' || char == 'Q' || char == '9' {
			fmt.Print("YES")
			os.Exit(1)
		}
	}

	fmt.Print("NO")
}


package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	output := false
	for i := 0; i < len(s); i++ {
		switch {
		case s[i] == 'H':
			fallthrough
		case s[i] == '+':
			fallthrough
		case s[i] == '9':
			fallthrough
		case s[i] == 'Q':
			output = true
		}
	}
	if output {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


package main
import ("fmt")
func main() {
    var s string
    fmt.Scan(&s)
    flag:=false
    for i:=range(s) {
        if s[i]=='H'||s[i]=='9'||s[i]=='Q'||s[i]=='+' {
            flag=true
            break
        }
    }
    if flag {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}


package main

import (
    "fmt"
    "bytes"
)

const ZERO int = int('0')

func process(s string) []int {
    var cnt [10]int
    for _, c := range s {
        cnt[int(c) - ZERO]++
    }
    return cnt[:]
}

func getMax(cnt []int) string {
    var buffer bytes.Buffer
    for i := 9; i >= 0; i-- {
        for j := 0; j < cnt[i]; j++ {
            buffer.WriteRune(rune(i + ZERO))
        }
    }
    return buffer.String()
}

func main() {
    var a, b string
    fmt.Scan(&a, &b)
    cnt := process(a)
    var ans string
    if len(b) > len(a) {
        ans = getMax(cnt)
    } else {
        var buffer bytes.Buffer
        valid := true
        for i, c := range b {
            numb := int(c) - ZERO

            // attempt to go lower
            for numb--; cnt[numb] == 0 && numb >= 0; numb-- {}
            if numb >= 0 {
                buffer.WriteRune(rune(numb + ZERO))
                cnt[numb]--
                buffer.WriteString(getMax(cnt))
                ans = buffer.String()
                cnt[numb]++
                buffer.Truncate(i)
            }

            // reset
            numb = int(c) - ZERO
            if cnt[numb] > 0 {
                buffer.WriteRune(c)
                cnt[numb]--
            } else {
                for ; cnt[numb] == 0 && numb >= 0; numb-- { }
                if numb >= 0 {
                    buffer.WriteRune(rune(numb + ZERO))
                    cnt[numb]--
                    buffer.WriteString(getMax(cnt))
                } else {
                    valid = false
                }
                break
            }
        }
        if valid {
            ans = buffer.String()
        }
    }
    fmt.Println(ans)
}


package main

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

func solve() {
	a := []byte(strconv.FormatInt(readInt64(), 10))
	b := []byte(strconv.FormatInt(readInt64(), 10))
	anum := make([]int, len(a))
	for i := 0; i < len(a); i++ {
		anum[i] = int(a[i] - '0')
	}
	bnum := make([]int, len(b))
	for i := 0; i < len(b); i++ {
		bnum[i] = int(b[i] - '0')
	}
	sort.Sort(sort.Reverse(sort.IntSlice(anum)))
	if len(a) == len(b) {
		dfs(anum, bnum, 0)
	}
	for _, v := range anum {
		fmt.Print(v)
	}
	fmt.Println()
}

func dfs(anum []int, bnum []int, pos int) bool {
	if pos == len(anum) {
		return true
	}
	for i := pos; i < len(anum); i++ {
		if anum[i] < bnum[pos] {
			anum[pos], anum[i] = anum[i], anum[pos]
			resort(anum, pos+1)
			return true
		}
		if anum[i] <= bnum[pos] {
			anum[pos], anum[i] = anum[i], anum[pos]
			resort(anum, pos+1)
			if dfs(anum, bnum, pos+1) {
				return true
			}
			resort(anum, pos)
		}
	}
	return false
}

func resort(nums []int, pos int) {
	for i := pos; i < len(nums)-1; i++ {
		for j := i + 1; j < len(nums); j++ {
			if nums[i] < nums[j] {
				nums[i], nums[j] = nums[j], nums[i]
			}
		}
	}
}

var scanner *bufio.Scanner

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

// IO

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

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

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

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

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

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

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


package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	a := s.Text()
	s.Scan()
	b, _ := strconv.ParseInt(s.Text(), 10, 64)
	do([]rune(a), b)
}

func do(a []rune, b int64) {
	max := int64(math.MinInt64)
	permute(a, len(a), b, &max)
	fmt.Println(max)
}

func permute(a []rune, n int, b int64, max *int64) {
	if n < 1 {
		x, _ := strconv.ParseInt(string(a), 10, 64)
		if x > *max && x < b {
			*max = x
		}
	}

	for i := 0; i < n; i++ {
		swap(a, i, n-1)
		permute(a, n-1, b, max)
		swap(a, i, n-1)
	}
}

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


package main

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

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	s.Scan()
	a := s.Text()
	s.Scan()
	b, _ := strconv.ParseInt(s.Text(), 10, 64)

	xs := make([]int, len(a))
	for i := 0; i < len(a); i++ {
		xs[i] = int(a[i] - '0')
	}
	do(xs, b)
}

func do(a []int, b int64) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	permute(a, len(a), b, 0)
}

func permute(a []int, n int, b int64, ans int64) {
	if n == 0 {
		zeroes := 0
		for i := 0; i < len(a); i++ {
			if a[i] == 0 {
				zeroes++
			} else {
				break
			}
		}

		rs := make([]rune, len(a)-zeroes)
		for i := 0; i < len(a)-zeroes; i++ {
			rs[i] = rune(a[i+zeroes]) + '0'
		}
		fmt.Println(string(rs))
		return
	}

	i := len(a) - n
	d := a[i]
	for ans+int64(d)*powInt(10, n-1) > b {
		i++
		d = a[i]
	}
	swap(a, len(a)-n, i)
	sort.Sort(sort.Reverse(sort.IntSlice(a[len(a)-n+1:])))
	permute(a, n-1, b, ans+int64(d)*powInt(10, n-1))
}

func powInt(a, b int) int64 {
	return int64(math.Pow(float64(a), float64(b)))
}

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


// _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"
	"unsafe"
)

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

func main() {

	// var test [3]int32
	// var p_test *[3]int32

	// fmt.Println(unsafe.Sizeof(test), unsafe.Sizeof(p_test))

	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 [2560000]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 [2560000]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
}


package main

import (
	"fmt"
	"strings"
)

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

func run(s1, s2 string) int {
	s1, s2 = strings.ToLower(s1), strings.ToLower(s2)
	for i := range s1 {
		switch {
		case s1[i] < s2[i]:
			return -1
		case s1[i] > s2[i]:
			return 1
		}
	}
	return 0
}


package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	text := scanner.Text()
	str := strings.Split(text, " ")
	str1 := strings.ToLower(str[0])
	str2 := strings.ToLower(str[1])

	for i := 0; i < len(str1); i++ {
		str1Char := string([]rune(str1)[i])
		str2Char := string([]rune(str2)[i])
		if str1Char < str2Char {
			fmt.Println("-1")
			return
		}
		if str1Char > str2Char {
			fmt.Println("1")
			return
		}
	}
	fmt.Println("0")
}


package main

import "fmt"

func prog(a int) int {
	return ((1 + a) * a) / 2
}

func main() {
	var n int
	fmt.Scan(&n)
	fmt.Println(prog(n) + prog(n - 2))
}


package main

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

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

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

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

	return x * factorial(x-1)
}

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

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

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

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


package main

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

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

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

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

	return x * factorial(x-1)
}

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

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

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

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


package main

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

var stdin *bufio.Reader
var stdout *bufio.Writer

func init() {
	stdin = bufio.NewReader(os.Stdin)
    stdout = bufio.NewWriter(os.Stdout)
}

func main() {

	n, m := 0, 0

	fmt.Fscanf(stdin, "%d%d", &n, &m)

	x := 2 * n

	if 3 * m > x {
		x = 3 * m
	}

	if 3 * (n + m) > 2 * x {
		x = (3 * (n + m) + 1) / 2
	}

	fmt.Fprintf(stdout, "%d\n", x)

    stdout.Flush()
}


package main

import (
	"fmt"
)

func main() {
	var c, v0, v1, a, l int
	fmt.Scanf("%d%d%d%d%d", &c, &v0, &v1, &a, &l)

	days := 0
	r := 0
	for {
		days += 1
		if days == 1 {
			r = c - v0
		} else {
			r = r - v0 - a*(days-1) + l
		}

		if r <= 0 {
			break
		}
	}

	fmt.Println(days)
}


package main

import "fmt"
import "math"

func main() {
	var c, v0, v1, a, l int
	fmt.Scanf("%d %d %d %d %d", &c, &v0, &v1, &a, &l)

	var readPages int = 0
	var day int = 0
	for readPages < c {
		delta := c - readPages
		tmp := v0 + day*a
		if day > 0 {
			tmp -= l
		}

		read := math.Min(float64(v1), float64(tmp))
		read = math.Min(float64(read), float64(delta))

		readPages += int(read)
		day++
	}

	fmt.Println(day)
}


package main

import (
	"fmt"
)

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

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