package main

import "fmt"

func main() {
	k := "qwertyuiopasdfghjkl;zxcvbnm,./"
	var keyboard [128]int

	for i := 0; i < len(k); i++ {
		keyboard[int(k[i])] = i
	}

	var d, s, r string
	fmt.Scanln(&d)
	fmt.Scanln(&s)

	for i := 0; i < len(s); i++ {
		if d == "R" {
			index := keyboard[int(s[i])]
			r += string(k[index-1])
		} else {
			r += string(k[keyboard[int(s[i])]+1])
		}
	}

	fmt.Println(r)
}

package main

import (
	"fmt"
	"strings"
)

func main()  {
	var dir,words string
	key := "qwertyuiopasdfghjkl;zxcvbnm,./"

	fmt.Scanf("%s\n", &dir)
	fmt.Scanf("%s", &words)
	for i := 0; i < len(words); i++ {
		for j := 0; j < len(key); j++ {
				// fmt.Printf(string(key[i][j]))
			if (string(words[i]) == string(key[j])) {
				if(strings.ToLower(string(dir)) == "r"){
					fmt.Printf("%c", key[j-1])
				}else{
					fmt.Printf("%c", key[j+1])
				}

			}
		}
	}
	// fmt.Println(key)
}

package main

import (
	"fmt"
)

func main() {
	var KBD = []string{"qwertyuiop", "asdfghjkl;", "zxcvbnm,./"}

	var kbd [3][10]rune
	for i := range KBD {
		for j, c := range KBD[i] {
			kbd[i][j] = c
		}
	}
	L, R, shift := make(map[rune]rune), make(map[rune]rune), make(map[rune]rune)
	// make L
	for i := range KBD {
		for j := range KBD[i] {
			if j == 9 {
				break
			}
			L[kbd[i][j]] = kbd[i][j+1]
		}
	}
	// make R
	for i := range KBD {
		for j := range KBD[i] {
			if j == 0 {
				continue
			}
			R[kbd[i][j]] = kbd[i][j-1]
		}
	}
	var d, mole string
	fmt.Scanln(&d)
	if d == "R" {
		shift = R
	} else {
		shift = L
	}
	fmt.Scanln(&mole)
	for _, c := range mole {
		fmt.Printf(string(shift[c]))
	}
	fmt.Println()
}

package main

import "fmt"

type Site struct {
	row int
	pos int
}

var keyboards [3][]byte
var sites map[byte]*Site

func init() {
	keyboards[0] = []byte("qwertyuiop")
	keyboards[1] = []byte("asdfghjkl;")
	keyboards[2] = []byte("zxcvbnm,./")

	sites = make(map[byte]*Site)
	for i := 0; i < 3; i++ {
		for j := 0; j < len(keyboards[i]); j++ {
			sites[keyboards[i][j]] = &Site{i, j}
		}
	}
}

func main() {
	var c, word string
	fmt.Scan(&c, &word)

	for i := 0; i < len(word); i++ {
		site := sites[word[i]]
		if c == "R" {
			fmt.Printf("%c", keyboards[site.row][site.pos-1])
		} else {
			fmt.Printf("%c", keyboards[site.row][site.pos+1])
		}
	}
}

package main

import (
    "bytes"
    "fmt"
    "strings"
)

func main() {
    kb := `qwertyuiop
        asdfghjkl;
        zxcvbnm,./`
    var (
        d string
        s string
    )
    fmt.Scan(&d, &s)

    i := 1
    if d == "R" {
        i = -1
    }

    var buffer bytes.Buffer
    for _, v := range s {
        ind := strings.IndexRune(kb, v)
        buffer.WriteString(string(kb[ind+i]))
    }
    fmt.Println(buffer.String())
}

package main

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

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

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

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

func main() {
    defer writer.Flush()
    scanner.Split(bufio.ScanWords)
    var q int
    a := make([]string, 3)
    a[0] = "qwertyuiop"
    a[1] = "asdfghjkl;"
    a[2] = "zxcvbnm,./"
    s := ReadString()
    if s == "R" {
        q = -1
    } else {
        q = 1
    }
    s = ReadString()
    r := ""
    dicti := make(map[uint8]int)
    dictj := make(map[uint8]int)
    for j := 0; j < 3; j++ {
        for i := 0; i < 10; i++ {
            dicti[a[j][i]] = i
            dictj[a[j][i]] = j
        }
    }
    for i := 0; i < len(s); i++ {
        r += string(a[dictj[s[i]]][dicti[s[i]]+q])
    }
    writer.WriteString(r)
    writer.WriteString("\n")
}

package main

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

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

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

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

func main() {
    defer writer.Flush()
    scanner.Split(bufio.ScanWords)
    var q int
    keyboard := "qwertyuiopasdfghjkl;zxcvbnm,./"
    dict := make(map[uint8]int)

    if ReadString() == "R" {
        q = -1
    } else {
        q = 1
    }

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

    r := ""
    for i := range s {
        r += string(keyboard[dict[s[i]]+q])
    }

    writer.WriteString(r + "\n")
}

package main

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

func main() {
	r := map[string]string{
		"q":"", "w":"q", "e":"w", "r":"e", "t":"r", "y":"t", "u":"y", "i":"u", "o":"i", "p":"o",
		"a":"", "s":"a", "d":"s", "f":"d", "g":"f", "h":"g", "j":"h", "k":"j", "l":"k", ";":"l",
		"z":"", "x":"z", "c":"x", "v":"c", "b":"v", "n":"b", "m":"n", ",":"m", ".":",", "/":".",
	}
	l := map[string]string{
		"q":"w", "w":"e", "e":"r", "r":"t", "t":"y", "y":"u", "u":"i", "i":"o", "o":"p", "p":"",
		"a":"s", "s":"d", "d":"f", "f":"g", "g":"h", "h":"j", "j":"k", "k":"l", "l":";", ";":"",
		"z":"x", "x":"c", "c":"v", "v":"b", "b":"n", "n":"m", "m":",", ",":".", ".":"/", "/":"",
	}

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

	if(strings.TrimSpace(shift) == "R") {
		chain = convert(&r, chain)
	} else {
		chain = convert(&l, chain)
	}
	fmt.Printf("%s\n", chain)
}

func convert(m *map[string]string, chain string) string {
	for i := 0; i < len(chain); i++ {
		var c = string(chain[i])
		c = (*m)[c]
		chain = replaceAtIndex(chain, c, i)
	}
	return chain
}

func replaceAtIndex(str string, char string, index int) string {
	return str[:index] + char + str[index+1:]
}

package main

import (
    "fmt"
    )

const keyboard = "qwertyuiopasdfghjkl;zxcvbnm,./"

func get_real(mov string, ch byte) string {
    i := 0
    for i = 0; i < len(keyboard); i++ {
        if keyboard[i] == ch {
            break
        }
    }
    if mov == "R" {
        return string(keyboard[i-1])
    } else {
        return string(keyboard[i+1])
    }
}

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

    var line string
    fmt.Scan(&line)

    result := ""
    for i := 0; i < len(line); i++ {
        result += get_real(mov, line[i])
    }

    fmt.Println(result)
}

package main

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

func main() {
	var direction string
	var myString string
	charArr := [...]string{"q", "w", "e", "r", "t", "y", "u", "i", "o", "p",
		"a", "s", "d", "f", "g", "h", "j", "k", "l", ";",
		"z", "x", "c", "v", "b", "n", "m", ",", ".", "/"}
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &direction)
	fmt.Fscan(reader, &myString)
	for _, currentChar := range myString {
		for index := 0; index < len(charArr); index++ {
			if string(currentChar) == charArr[index] {
				if direction == "R" {
					fmt.Print(charArr[index-1])
				} else {
					fmt.Print(charArr[index+1])
				}
				break
			}
		}
	}

}

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)
    d := next()
    s := next()
    a := []string {"qwertyuiop", "asdfghjkl;", "zxcvbnm,./"}
    ans := ""
    dx := 1
    if d == "L" {
        dx = -1
    }
    for l := 0; l < len(s); l++ {
        for i := 0; i < len(a); i++ {
            ok := false
            for j := 0; j < len(a[i]); j++ {
                if a[i][j] == s[l] {
                    ans = ans + string(a[i][j - dx])
                    ok = true
                    break
                }
            }
            if ok {
                break
            }
        }
    }
    fmt.Fprintln(out, ans)
}

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)
	side := next()
	var result []string
	if side == "R" {
		result = getChangedString(-1)
	} else {
		result = getChangedString(1)
	}
	fmt.Println(strings.Join(result, ""))
}

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...)
}

func getChangedString(p int) []string {
	inputStr := next()
	firstLine := "qwertyuiopasdfghjkl;zxcvbnm,./"
	splitOfChars := splitString(firstLine)
	splitInput := splitString(inputStr)
	result := make([]string, len(splitInput))
	for i, c := range splitInput {
		for j, a := range splitOfChars {
			if a == c {
				result[i] = splitOfChars[j+p]
				break
			}
		}
	}
	return result
}

func splitString(input string) (result []string) {
	result = strings.Split(input, "")
	return
}

package main

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

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

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

	keys := "qwertyuiopasdfghjkl;zxcvbnm,./"

	dx := 1
	if next() == "R" {
		dx = -1
	}

	for _, k := range next() {
		if strings.IndexRune(keys, k) > -1 {
			fmt.Print(string(keys[strings.IndexRune(keys, k) + dx]))
		}
	}
}

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

package main

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

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

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

	move := next()
	s := next()
	k := "qwertyuiopasdfghjkl;zxcvbnm,./"
	m := make(map[rune]int)
	ret := make([]rune, 0)
	pos := 0

	for i, v := range k {
		m[v] = i
	}

	for _, v := range s {
		if move == "L" {
			switch v {
				case 'p':
					pos = m['p']
				case ';':
					pos = m[';']
				case '/':
					pos = m['/']
				default:
					pos = m[v] + 1
			}

		} else {
			switch v {
			case 'q':
				pos = m['q']
			case 'a':
				pos = m['a']
			case 'z':
				pos = m['z']
			default:
				pos = m[v] - 1
			}
		}
		ret = append(ret, rune(k[pos]))
		// println(v, string(v), pos, string(k[pos]))
		// println(ret)
	}

	println(string(ret))
}

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

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

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

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

package main

import "fmt"

func main() {
	upperRow := map[string]int{"q": 1, "w": 2, "e": 3, "r": 4, "t": 5, "y": 6, "u": 7, "i": 8, "o": 9, "p": 10}
	lookUpUpperRow := map[int]string{1: "q", 2: "w", 3: "e", 4: "r", 5: "t", 6: "y", 7: "u", 8: "i", 9: "o", 10: "p"}

	middleRow := map[string]int{"a": 1, "s": 2, "d": 3, "f": 4, "g": 5, "h": 6, "j": 7, "k": 8, "l": 9, ";": 10}
	lookUpMiddleRow := map[int]string{1: "a", 2: "s", 3: "d", 4: "f", 5: "g", 6: "h", 7: "j", 8: "k", 9: "l", 10: ";"}

	lowerRow := map[string]int{"z": 1, "x": 2, "c": 3, "v": 4, "b": 5, "n": 6, "m": 7, ",": 8, ".": 9, "/": 10}
	lookUpLowerRow := map[int]string{1: "z", 2: "x", 3: "c", 4: "v", 5: "b", 6: "n", 7: "m", 8: ",", 9: ".", 10: "/"}

	var shiftDirection, inputString string

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

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

	strSize := len(inputString)

	for i := 0; i < strSize; i++ {
		if upperRow[string(inputString[i])] != 0 {
			targetPos := upperRow[string(inputString[i])]
			if shiftDirection == "R" {
				fmt.Print(lookUpUpperRow[targetPos-1])
			} else {
				fmt.Print(lookUpUpperRow[targetPos+1])
			}
		} else if middleRow[string(inputString[i])] != 0 {
			targetPos := middleRow[string(inputString[i])]
			if shiftDirection == "R" {
				fmt.Print(lookUpMiddleRow[targetPos-1])
			} else {
				fmt.Print(lookUpMiddleRow[targetPos+1])
			}
		} else {
			targetPos := lowerRow[string(inputString[i])]
			if shiftDirection == "R" {
				fmt.Print(lookUpLowerRow[targetPos-1])
			} else {
				fmt.Print(lookUpLowerRow[targetPos+1])
			}
		}
	}

	fmt.Println()

}

// test project main.go
package main

import (
    "fmt"
)

func main() {
    key := []string{"qwertyuiop", "asdfghjkl;", "zxcvbnm,./"}
    ch := ""
    str := ""
    fmt.Scan(&ch)
    fmt.Scan(&str)
    add := 0
    if "R" == ch {
        add = -1
    } else {
        add = 1
    }
    for k := 0; k < len(str); k++ {
        for i := 0; i < 3; i++ {
            for j := 0; j < len(key[i]); j++ {
                if key[i][j] == str[k] {
                    fmt.Printf("%c", key[i][j+add])
                }
            }
        }
    }
    fmt.Println()
}

package main

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

func main() {
	rep := "qwertyuiopasdfghjkl;zxcvbnm,./"
	var d, s string
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	d = scanner.Text()
	scanner.Scan()
	s = scanner.Text()

	if strings.Compare(d, "R") == 0 {
		for i := 1; i < len(rep); i++ {
			s = strings.Replace(s, string(rep[i]), string(rep[i-1]), -1)
		}
	}
	if strings.Compare(d, "L") == 0 {
		for i := len(rep) - 1; i > 0; i-- {
			s = strings.Replace(s, string(rep[i-1]), string(rep[i]), -1)
		}
	}
	fmt.Print(s)
}

package main

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

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

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

	keys := "qwertyuiopasdfghjkl;zxcvbnm, ./"

	dx := 1
	if next() == "R" {
		dx = -1
	}

	for _, k := range next() {
		if strings.IndexRune(keys, k) > -1 {
			fmt.Print(string(keys[strings.IndexRune(keys, k) + dx]))
		}
	}
}

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

package main

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

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

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

	keys := []string{
		"qwertyuiop",
		"asdfghjkl;",
		"zxcvbnm, ./",
	}

	dx := 1
	if next() == "R" {
		dx = -1
	}

	for _, k := range next() {
		for _, s := range keys {
			if strings.IndexRune(s, k) > -1 {
				fmt.Print(string(s[strings.IndexRune(s, k) + dx]))
			}
		}
	}

}

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

package main

import "fmt"

func main() {
	upperRow := map[string]int{"q": 1, "w": 2, "e": 3, "r": 4, "t": 5, "y": 6, "u": 7, "i": 8, "o": 9, "p": 10}
	lookUpUpperRow := map[int]string{1: "q", 2: "w", 3: "e", 4: "r", 5: "t", 6: "y", 7: "u", 8: "i", 9: "o", 10: "p"}

	middleRow := map[string]int{"a": 1, "s": 2, "d": 3, "f": 4, "g": 5, "h": 6, "j": 7, "k": 8, "l": 9, ";": 10}
	lookUpMiddleRow := map[int]string{1: "a", 2: "s", 3: "d", 4: "f", 5: "g", 6: "h", 7: "j", 8: "k", 9: "l", 10: ";"}

	lowerRow := map[string]int{"z": 1, "x": 2, "c": 3, "v": 4, "b": 5, "n": 6, "m": 7, ",": 8, ".": 9, "/": 10}
	lookUpLowerRow := map[int]string{1: "z", 2: "x", 3: "c", 4: "v", 5: "b", 6: "n", 7: "m", 8: ",", 9: ".", 10: "/"}

	var shiftDirection, inputString string

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

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

	strSize := len(inputString)

	for i := 0; i < strSize; i++ {
		if upperRow[string(inputString[i])] != 0 {
			targetPos := upperRow[string(inputString[i])]
			if shiftDirection == "L" {
				fmt.Print(lookUpUpperRow[targetPos-1])
			} else {
				fmt.Print(lookUpUpperRow[targetPos+1])
			}
		} else if middleRow[string(inputString[i])] != 0 {
			targetPos := middleRow[string(inputString[i])]
			if shiftDirection == "L" {
				fmt.Print(lookUpMiddleRow[targetPos-1])
			} else {
				fmt.Print(lookUpMiddleRow[targetPos+1])
			}
		} else {
			targetPos := lowerRow[string(inputString[i])]
			if shiftDirection == "L" {
				fmt.Print(lookUpLowerRow[targetPos-1])
			} else {
				fmt.Print(lookUpLowerRow[targetPos+1])
			}
		}
	}

	fmt.Println()

}

package main

import (
	"fmt"
)

func main() {
	var KBD = []string{"qwertyuiop", "asdfghjkl;", "zxcvbnm,./"}

	var kbd [3][10]rune
	for i := range KBD {
		for j, c := range KBD[i] {
			kbd[i][j] = c
		}
	}
	L, R, shift := make(map[rune]rune), make(map[rune]rune), make(map[rune]rune)
	// make L
	for i := range KBD {
		for j := range KBD[i] {
			if j == 9 {
				break
			}
			L[kbd[i][j]] = kbd[i][j+1]
		}
	}
	// make R
	for i := range KBD {
		for j := range KBD[i] {
			if j == 0 {
				continue
			}
			R[kbd[i][j]] = kbd[i][j-1]
		}
	}
	var d, mole string
	fmt.Scanln(&d)
	if d == "R" {
		shift = R
	} else {
		shift = L
	}
	fmt.Scanln(&mole)
	fmt.Println(mole)
	for _, c := range mole {
		fmt.Printf(string(shift[c]))
	}
	fmt.Println()
}


package main

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

type Vec [4]int

func (v Vec) max() int {
	max := -999
	for i := 0;i < len(v);i ++ {
		if v[i] > max {
			max = v[i]
		}
	}
	return max
}

func (v Vec) min() int {
	min := 999
	for i := 0;i < len(v);i ++ {
		if v[i] < min {
			min = v[i]
		}
	}
	return min
}

func abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}
func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var ax, ay, bx, by Vec
	fmt.Fscanf(reader, "%d %d %d %d %d %d %d %d\n", &ax[0], &ay[0], &ax[1], &ay[1], &ax[2], &ay[2], &ax[3], &ay[3])
	fmt.Fscanf(reader, "%d %d %d %d %d %d %d %d\n", &bx[0], &by[0], &bx[1], &by[1], &bx[2], &by[2], &bx[3], &by[3])

	axMax, axMin, ayMax, ayMin := ax.max(), ax.min(), ay.max(), ay.min()
	bxMax, bxMin, byMax, byMin := bx.max(), bx.min(), by.max(), by.min()
	bxAvg, byAvg := (bxMax + bxMin) / 2, (byMax + byMin) / 2
	dist := bxMax - bxAvg

	for x := -100; x <= 100; x ++ {
		for y := -100; y <= 100; y ++ {
			if (axMin <= x && x <= axMax && ayMin <= y && y <= ayMax) {
				if (abs(x - bxAvg) + abs(y - byAvg) <= dist) {
					fmt.Printf("YES")
					return
				}
			}
		}
	}
	fmt.Printf("NO")
	return
}

package main

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

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

type Int64Slice []int64

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

type Sq struct {
	v [8]int
}

func (sq *Sq) isPara() bool {
	chk1, chk2 := false, false

	for i := 2; i < 8; i = i + 2 {
		if sq.v[i] == sq.v[0] {
			chk1 = true
		}
	}
	for i := 3; i < 8; i = i + 2 {
		if sq.v[i] == sq.v[1] {
			chk2 = true
		}
	}

	if chk1 && chk2 {
		return true
	}
	return false
}

var s1, s2 Sq

func gettoux() bool {
	xmin := s1.v[0]
	xmax := s1.v[0]
	for i := 2; i < 8; i = i + 2 {
		if s1.v[i] < xmin {
			xmin = s1.v[i]
		}
		if s1.v[i] > xmax {
			xmax = s1.v[i]
		}
	}
	ymin := s2.v[0]
	ymax := s2.v[0]
	for i := 2; i < 8; i = i + 2 {
		if s2.v[i] < ymin {
			ymin = s2.v[i]
		}
		if s2.v[i] > ymax {
			ymax = s2.v[i]
		}
	}

	if xmax < ymin || ymax < xmin {
		return false
	}
	return true
}

func gettouy() bool {
	xmin := s1.v[1]
	xmax := s1.v[1]
	for i := 3; i < 8; i = i + 2 {
		if s1.v[i] < xmin {
			xmin = s1.v[i]
		}
		if s1.v[i] > xmax {
			xmax = s1.v[i]
		}
	}
	ymin := s2.v[1]
	ymax := s2.v[1]
	for i := 3; i < 8; i = i + 2 {
		if s2.v[i] < ymin {
			ymin = s2.v[i]
		}
		if s2.v[i] > ymax {
			ymax = s2.v[i]
		}
	}

	if xmax < ymin || ymax < xmin {
		return false
	}
	return true
}

func gettouxaddy() bool {
	xmin := s1.v[0] + s1.v[1]
	xmax := s1.v[0] + s1.v[1]
	for i := 2; i < 8; i = i + 2 {
		if s1.v[i]+s1.v[i+1] < xmin {
			xmin = s1.v[i] + s1.v[i+1]
		}
		if s1.v[i]+s1.v[i+1] > xmax {
			xmax = s1.v[i] + s1.v[i+1]
		}
	}
	ymin := s2.v[0] + s2.v[1]
	ymax := s2.v[0] + s2.v[1]
	for i := 2; i < 8; i = i + 2 {
		if s2.v[i]+s2.v[i+1] < ymin {
			ymin = s2.v[i] + s2.v[i+1]
		}
		if s2.v[i]+s2.v[i+1] > ymax {
			ymax = s2.v[i] + s2.v[i+1]
		}
	}

	if xmax < ymin || ymax < xmin {
		return false
	}
	return true
}

func gettouxsuby() bool {
	xmin := s1.v[0] - s1.v[1]
	xmax := s1.v[0] - s1.v[1]
	for i := 2; i < 8; i = i + 2 {
		if s1.v[i]-s1.v[i+1] < xmin {
			xmin = s1.v[i] - s1.v[i+1]
		}
		if s1.v[i]-s1.v[i+1] > xmax {
			xmax = s1.v[i] - s1.v[i+1]
		}
	}
	ymin := s2.v[0] - s2.v[1]
	ymax := s2.v[0] - s2.v[1]
	for i := 2; i < 8; i = i + 2 {
		if s2.v[i]-s2.v[i+1] < ymin {
			ymin = s2.v[i] - s2.v[i+1]
		}
		if s2.v[i]-s2.v[i+1] > ymax {
			ymax = s2.v[i] - s2.v[i+1]
		}
	}

	if xmax < ymin || ymax < xmin {
		return false
	}
	return true
}

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

	for i := 0; i < 8; i++ {
		s1.v[i] = ReadInt32()
	}

	for i := 0; i < 8; i++ {
		s2.v[i] = ReadInt32()
	}

	if !s1.isPara() {
		s1, s2 = s2, s1
	}

	if gettoux() && gettouy() && gettouxaddy() && gettouxsuby() {
		fmt.Printf("YES")
	} else {
		fmt.Printf("NO")
	}
}

func Demo() {
	var n, m int64 = ReadInt64(), ReadInt64()
	PrintInt64s(n, m)
	writer.WriteByte('\n')
	slice := []int64{1, 2, 3, 4, 5}
	PrintInt64s(slice...)

	// sortDemo
	//slice := []int64{5, 3, 4, 2, 1}
	sort.Sort(Int64Slice(slice))

	//s := strconv.FormatBool(true)
	//s := strconv.FormatFloat(3.1415, 'E', -1, 64)
	//s := strconv.FormatInt(-42, 16)
	//s := strconv.FormatUint(42, 16)

}

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

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

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

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

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

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

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

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

func ReadFloat64() float64 {
	scanner.Scan()
	ans, _ := strconv.ParseFloat(scanner.Text(), 64)
	return ans
}

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

package main

import (
	"fmt"
	"math"
)

type Point struct {
	X, Y float64
}

type Square struct {
	Points [4]Point
}

func rotateAxis(p Point, angle float64) (res Point) {
	res = Point{}
	angle = (angle * math.Pi) / 180
	res.X = p.X*math.Cos(angle) + p.Y*math.Sin(angle)
	res.Y = -1*p.X*math.Sin(angle) + p.Y*math.Cos(angle)
	return
}

func isInSquare(sq Square, p Point) (b bool) {
	var minHoz float64 = 101
	for _, v := range sq.Points {
		minHoz = math.Min(minHoz, v.Y)
	}

	var maxHoz float64 = -101
	for _, v := range sq.Points {
		maxHoz = math.Max(maxHoz, v.Y)
	}

	var minVer float64 = 101
	for _, v := range sq.Points {
		minVer = math.Min(minVer, v.X)
	}

	var maxVer float64 = -101
	for _, v := range sq.Points {
		maxVer = math.Max(maxVer, v.X)
	}

	return (p.X >= minVer && p.X <= maxVer) && (p.Y >= minHoz && p.Y <= maxHoz)
}

func solve(sq, sq45 Square) bool {
	center := Point{0, 0}
	for _, v := range sq45.Points {
		center.X += v.X
		center.Y += v.Y
		if isInSquare(sq, v) {
			return true
		}
	}

	center.X /= 4
	center.Y /= 4
	if isInSquare(sq, center) {
		return true
	}

	rotatedSquare := Square{}
	for i := range rotatedSquare.Points {
		rotatedSquare.Points[i] = rotateAxis(sq45.Points[i], 45)
	}

	center = Point{0, 0}
	for _, v := range sq.Points {
		center.X += v.X
		center.Y += v.Y
		rotatedPoint := rotateAxis(v, 45)
		if isInSquare(rotatedSquare, rotatedPoint) {
			return true
		}
	}

	center.X /= 4
	center.Y /= 4
	rotatedCenter := rotateAxis(center, 45)
	if isInSquare(rotatedSquare, rotatedCenter) {
		return true
	}

	return false
}

func consoleInput() {
	var x, y float64
	sq := Square{}
	for i := 0; i < 4; i++ {
		fmt.Scan(&x, &y)
		sq.Points[i] = Point{
			X: x,
			Y: y,
		}
	}

	sq45 := Square{}
	for i := 0; i < 4; i++ {
		fmt.Scan(&x, &y)
		sq45.Points[i] = Point{
			X: x,
			Y: y,
		}
	}

	if solve(sq, sq45) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func mustEqual(expected, actual bool) {
	if expected == actual {
		fmt.Println("OK")
	} else {
		fmt.Println("FAILED")
	}
}

func test() {
	{
		sq := Square{
			Points: [4]Point{
				Point{0, 0},
				Point{6, 0},
				Point{6, 6},
				Point{0, 6},
			},
		}

		sq45 := Square{
			Points: [4]Point{
				Point{1, 3},
				Point{3, 5},
				Point{5, 3},
				Point{3, 1},
			},
		}

		mustEqual(true, solve(sq, sq45))
	}

	{
		sq := Square{
			Points: [4]Point{
				Point{0, 0},
				Point{6, 0},
				Point{6, 6},
				Point{0, 6},
			},
		}

		sq45 := Square{
			Points: [4]Point{
				Point{7, 3},
				Point{9, 5},
				Point{11, 3},
				Point{9, 1},
			},
		}

		mustEqual(false, solve(sq, sq45))
	}

	{
		sq := Square{
			Points: [4]Point{
				Point{6, 0},
				Point{6, 6},
				Point{0, 6},
				Point{0, 0},
			},
		}

		sq45 := Square{
			Points: [4]Point{
				Point{7, 4},
				Point{4, 7},
				Point{7, 10},
				Point{10, 7},
			},
		}

		mustEqual(true, solve(sq, sq45))
	}

	{
		sq := Square{
			Points: [4]Point{
				Point{-5, -5},
				Point{5, -5},
				Point{5, 5},
				Point{-5, 5},
			},
		}

		sq45 := Square{
			Points: [4]Point{
				Point{6, 0},
				Point{0, 6},
				Point{-6, 0},
				Point{0, -6},
			},
		}

		mustEqual(true, solve(sq, sq45))
	}
}

func main() {
	consoleInput()
	// test()
}

package main

import (
	"fmt"
	"math"
)

type Point struct {
	X, Y float64
}

type Square struct {
	Points [4]Point
}

func rotateAxis(p Point, angle float64) (res Point) {
	res = Point{}
	angle = (angle * math.Pi) / 180
	res.X = p.X*math.Cos(angle) + p.Y*math.Sin(angle)
	res.Y = -1*p.X*math.Sin(angle) + p.Y*math.Cos(angle)
	return
}

func isInSquare(sq Square, p Point) (b bool) {
	var minHoz float64 = 101
	for _, v := range sq.Points {
		minHoz = math.Min(minHoz, v.Y)
	}

	var maxHoz float64 = -101
	for _, v := range sq.Points {
		maxHoz = math.Max(maxHoz, v.Y)
	}

	var minVer float64 = 101
	for _, v := range sq.Points {
		minVer = math.Min(minVer, v.X)
	}

	var maxVer float64 = -101
	for _, v := range sq.Points {
		maxVer = math.Max(maxVer, v.X)
	}

	return (p.X >= minVer && p.X <= maxVer) && (p.Y >= minHoz && p.Y <= maxHoz)
}

func solve(sq, sq45 Square) bool {
	for _, v := range sq45.Points {
		if isInSquare(sq, v) {
			return true
		}
	}

	rotatedSquare := Square{}
	for i := range rotatedSquare.Points {
		rotatedSquare.Points[i] = rotateAxis(sq45.Points[i], 45)
	}

	for _, v := range sq.Points {
		rotatedPoint := rotateAxis(v, 45)
		if isInSquare(rotatedSquare, rotatedPoint) {
			return true
		}
	}

	return false
}

func consoleInput() {
	var x, y float64
	sq := Square{}
	for i := 0; i < 4; i++ {
		fmt.Scan(&x, &y)
		sq.Points[i] = Point{
			X: x,
			Y: y,
		}
	}

	sq45 := Square{}
	for i := 0; i < 4; i++ {
		fmt.Scan(&x, &y)
		sq45.Points[i] = Point{
			X: x,
			Y: y,
		}
	}

	if solve(sq, sq45) {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

func mustEqual(expected, actual bool) {
	if expected == actual {
		fmt.Println("OK")
	} else {
		fmt.Println("FAILED")
	}
}

func test() {
	{
		sq := Square{
			Points: [4]Point{
				Point{0, 0},
				Point{6, 0},
				Point{6, 6},
				Point{0, 6},
			},
		}

		sq45 := Square{
			Points: [4]Point{
				Point{1, 3},
				Point{3, 5},
				Point{5, 3},
				Point{3, 1},
			},
		}

		mustEqual(true, solve(sq, sq45))
	}

	{
		sq := Square{
			Points: [4]Point{
				Point{0, 0},
				Point{6, 0},
				Point{6, 6},
				Point{0, 6},
			},
		}

		sq45 := Square{
			Points: [4]Point{
				Point{7, 3},
				Point{9, 5},
				Point{11, 3},
				Point{9, 1},
			},
		}

		mustEqual(false, solve(sq, sq45))
	}

	{
		sq := Square{
			Points: [4]Point{
				Point{6, 0},
				Point{6, 6},
				Point{0, 6},
				Point{0, 0},
			},
		}

		sq45 := Square{
			Points: [4]Point{
				Point{7, 4},
				Point{4, 7},
				Point{7, 10},
				Point{10, 7},
			},
		}

		mustEqual(true, solve(sq, sq45))
	}
}

func main() {
	consoleInput()
	// test()
}

package main

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

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

type Int64Slice []int64

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

type Sq struct {
	v [8]int
}

func (sq *Sq) isPara() bool {
	chk1, chk2 := false, false

	for i := 2; i < 8; i = i + 2 {
		if sq.v[i] == sq.v[0] {
			chk1 = true
		}
	}
	for i := 3; i < 8; i = i + 2 {
		if sq.v[i] == sq.v[1] {
			chk2 = true
		}
	}

	if chk1 && chk2 {
		return true
	}
	return false
}

func check2in1(s1 *Sq, s2 *Sq, j int) bool {
	xin, yin := false, false

	xlarge, xsmall := 0, 0
	ylarge, ysmall := 0, 0
	for i := 0; i < 8; i = i + 2 {
		if s1.v[i] < s2.v[j*2] {
			xlarge = xlarge + 1
		}
		if s1.v[i] > s2.v[j*2] {
			xsmall = xsmall + 1
		}
	}
	if xlarge != 4 && xsmall != 4 {
		xin = true
	}

	for i := 1; i < 8; i = i + 2 {
		if s1.v[i] < s2.v[j*2+1] {
			ylarge = ylarge + 1
		}
		if s1.v[i] > s2.v[j*2+1] {
			ysmall = ysmall + 1
		}
	}
	if ylarge != 4 && ysmall != 4 {
		yin = true
	}
	if xin && yin {
		return true
	}
	return false
}

func check1in2(s1 *Sq, s2 *Sq, i int) bool {
	xaddy := s1.v[i*2] + s1.v[i*2+1]
	xsuby := s1.v[i*2] - s1.v[i*2+1]

	var xaddy2 [4]int
	var xsuby2 [4]int

	for j := 0; j < 4; j++ {
		xaddy2[j] = s2.v[j*2] + s2.v[j*2+1]
		xsuby2[j] = s2.v[j*2] - s2.v[j*2+1]
	}

  xin, yin := false, false
	xlarge, xsmall := 0, 0
	ylarge, ysmall := 0, 0

	for j := 0; j < 4; j++ {
		if xaddy2[j] < xaddy {
			xlarge = xlarge + 1
		}
		if xaddy2[j] > xaddy {
			xsmall = xsmall + 1
		}
	}
	if xlarge != 4 && xsmall != 4 {
		xin = true
	}

	for j := 0; j < 4; j++ {
		if xsuby2[j] < xsuby {
			ylarge = ylarge + 1
		}
		if xsuby2[j] > xsuby {
			ysmall = ysmall + 1
		}
	}
	if ylarge != 4 && ysmall != 4 {
		yin = true
	}
	if xin && yin {
		return true
	}
	return false

}

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

	var s1, s2 Sq

	for i := 0; i < 8; i++ {
		s1.v[i] = ReadInt32()
	}

	for i := 0; i < 8; i++ {
		s2.v[i] = ReadInt32()
	}

	if !s1.isPara() {
		s1, s2 = s2, s1
	}

  chk1in2, chk2in1 := false, false

	for i := 0; i < 4; i++ {
		if check2in1(&s1, &s2, i) {
			chk2in1 = true
		}
	}
	for i := 0; i < 4; i++ {
		if check1in2(&s1, &s2, i) {
			chk1in2 = true
		}
	}

	if chk1in2 || chk2in1 {
		fmt.Printf("YES")
	} else {
		fmt.Printf("NO")
	}
}

func Demo() {
	var n, m int64 = ReadInt64(), ReadInt64()
	PrintInt64s(n, m)
	writer.WriteByte('\n')
	slice := []int64{1, 2, 3, 4, 5}
	PrintInt64s(slice...)

	// sortDemo
	//slice := []int64{5, 3, 4, 2, 1}
	sort.Sort(Int64Slice(slice))

	//s := strconv.FormatBool(true)
	//s := strconv.FormatFloat(3.1415, 'E', -1, 64)
	//s := strconv.FormatInt(-42, 16)
	//s := strconv.FormatUint(42, 16)

}

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

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

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

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

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

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

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

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

func ReadFloat64() float64 {
	scanner.Scan()
	ans, _ := strconv.ParseFloat(scanner.Text(), 64)
	return ans
}

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


// 13A
package main

import (
	"fmt"
)

func gcd(n, m int) int {
	if m == 0 {
		return n
	} else {
		return gcd(m, n%m)
	}
}

func main() {
	var n, m, i int
	sum := 0
	fmt.Scan(&n)
	for i = 2; i < n; i++ {
		m = n
		for m != 0 {
			sum += m % i
			m /= i
		}
	}
	fmt.Printf("%d/%d", sum/gcd(sum, n-2), (n-2)/gcd(sum, n-2))
}

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 {
  for b != 0 {
    a, b = b, a%b
  }
  return a
}

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

  x := getI()
  total := 0
  for base := 2; base < x; base++ {
    for y := x; y != 0; y /= base {
      total += y % base
    }
  }
  num, denom := total, x-2
  d := gcd(num, denom)
  num /= d
  denom /= d
  writer.WriteString(fmt.Sprintf("%d/%d\n", num, denom))
}

//13A
package main
import "fmt"

func main() {
	var aa, k, l, ttl int
	fmt.Scan(&aa)
	for i:=2; i<aa; i++ {
		k=aa
		for k>0 {
			ttl=ttl+(k%i)
			k/=i
			if k<i {
				ttl=ttl+k
				break
			}
		}
	}
	l=aa-2
	for i:=l; i>1; i-- {
		if ttl%i==0 && l%i==0 {
			ttl/=i
			l/=i
			break
		}
	}
	fmt.Print(ttl,"/",l)
	fmt.Println()
}

// https://codeforces.com/contest/13/problem/A
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main() {
	var (
		A int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &A)

	primes := make([]bool,  A / 2 + 1)
	for i := 0; i < len(primes); i++ {
		primes[i] = true
	}

	for i := 2; i < len(primes); i++ {
		if primes[i] {
			x := i
			for i + x < len(primes) {
				primes[i + x] = false
				x += i
			}
		}
	}

	ans := 0
	cnt := 0
	for i := 2; i < A; i++ {
		tmp := A
		for tmp > 0 {
			ans += tmp % i
			tmp /= i
		}
		cnt++
	}

	for i := 2; i < len(primes); i++ {
		if primes[i] {
			for ans % i == 0 && cnt % i == 0 {
				ans /= i
				cnt /= i
			}
		}
	}

	fmt.Printf("%d/%d", ans, cnt)
}

// https://codeforces.com/contest/13/problem/A
package main

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

// (c) Dmitriy Blokhin (sv.dblokhin@gmail.com)

func main() {
	var (
		A int
	)

	//f, _ := os.Open("input.txt")
	//input := bufio.NewReader(f)
	input := bufio.NewReader(os.Stdin)
	fmt.Fscan(input, &A)
	ans := 0
	cnt := 0
	for i := 2; i < A; i++ {
		tmp := A
		for tmp > 0 {
			ans += tmp % i
			tmp /= i
		}
		cnt++
	}

	fmt.Printf("%d/%d", ans, cnt)
}

// 13A
package main

import (
	"fmt"
)

func gcd(n, m int) int {
	if m == 0 {
		return n
	} else {
		return gcd(m, n%m)
	}
}

func main() {
	var n, m, i int
	sum := 0
	fmt.Scan(&n)
	for i = 2; i < n; i++ {
		m = n
		for m != 0 {
			sum += m % i
			m /= i
		}
	}
	fmt.Println(sum/gcd(sum, n-2), "/", (n-2)/gcd(sum, n-2))
}


package main

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

func main() {
	var s string
	ch := make(chan string)
	go func() {
		scanner := bufio.NewScanner(os.Stdin)
		for scanner.Scan() {
			ch <- scanner.Text()
		}
	}()
	s = <-ch
	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
}

package main

import ("fmt")

func weekfunc(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 = 1
		}
	}
	return count
}

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

func main(){
	var day int
	var of string
	var random string
	fmt.Scan(&day,&of,&random)
	var ans int
	if random == "week"{
		ans = weekfunc(day)
	}else{
		ans = monthfunc(day)
	}
	fmt.Println(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 || n == 6 {
                return 53
        } else {
                return 52
        }

}

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

package main

import "fmt"

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

	sum := 0
	if key == "week" {
		sum += 363 / 7
		if n <= 363%7 {
			sum += 1
		}
		if n >= 5 {
			sum += 1
		}
	} else {
		if n <= 29 {
			sum = 12
		} else if n == 30 {
			sum = 11
		} else {
			sum = 7
		}
	}

	fmt.Println(sum)
}

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

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.Scanf("%s", &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
}

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

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

package main

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

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

package main

import "fmt"

func main() {
	var i int
	fmt.Scanf("%d", &i)
	counter := 0

	counter += i / 100
	i = i % 100
	counter += i / 20
	i = i % 20
	counter += i / 10
	i = i % 10
	counter += i / 5
	i = i % 5
	counter += i / 1
	i = i % 1
	fmt.Println(counter)
}

// A. Hit the Lottery
/*
Allen has a LOT of money. He has 𝑛 dollars in the bank.
For security reasons, he wants to withdraw it in cash
(we will not disclose the reasons here).
The denominations for dollar bills are 1, 5, 10, 20, 100. What is the minimum
number of bills Allen could receive after withdrawing his entire balance?

Input
The first and only line of input contains a single integer 𝑛(1≤𝑛≤109).

Output
Output the minimum number of bills that Allen could receive.

Examples
Input
125

Output
3

Input
43

Output
5

Input
1000000000

Output
10000000

Note
In the first sample case, Allen can withdraw this with a 100
dollar bill, a 20 dollar bill, and a 5 dollar bill.
There is no way for Allen to receive 125 dollars in one or two bills.

In the second sample case, Allen can withdraw two 20 dollar bills and three 1
dollar bills.

In the third sample case, Allen can withdraw 100000000 (ten million!)
100 dollar bills.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _, _ := reader.ReadLine()
	n, _ := strconv.Atoi(string(input))
	fmt.Println(sol966A(n))
}

func sol966A(n int) int {
	bills := 0
	for n > 0 {
		if n/100 != 0 {
			bills += n / 100
			n %= 100
		} else if n/20 != 0 {
			bills += n / 20
			n %= 20
		} else if n/10 != 0 {
			bills += n / 10
			n %= 10
		} else if n/5 != 0 {
			bills += n / 5
			n %= 5
		} else {
			bills += n
			break
		}
	}
	return bills
}

package main

import "fmt"

func main() {
	var n, k int
	g := 0
	fmt.Scan(&n)
	for true {
		if n >= 100 {
			k = int(n / 100)
			g += k
			n -= 100 * k
		} else if n >= 20 {
			k = int(n / 20)
			g += k
			n -= 20 * k
		} else if n >= 10 {
			k = int(n / 10)
			g += k
			n -= 10 * k
		} else if n >= 5 {
			k = int(n / 5)
			g += k
			n -= 5 * k
		} else {
			g += n % 5
			break
		}
	}
	fmt.Println(g)
}

package main

import "fmt"

func main() {
	var n, res int
	_, err := fmt.Scanln(&n)
	if err != nil {
		panic(err)
	}

	for _, v := range []int{100, 20, 10, 5, 1} {
		res += n / v
		n %= v
	}

	fmt.Print(res)
}

package main

import "fmt"

func main() {
	var n, res int
	_, err := fmt.Scanln(&n)
	if err != nil {
		panic(err)
	}

	for _, v := range []int{100, 20, 10, 5, 1} {
		res = res + n/v
		n = n - v*(n/v)
	}

	fmt.Print(res)
}

package main

import(
    "fmt"
)

func main(){
    var(
        n,res int64
        coinChange = []int{1,5,10,20,100,}
    )
    fmt.Scan(&n)
    res = 0
    for i:=4;i>=0;i--{
        res += n/int64(coinChange[i]);
        n=n%int64(coinChange[i]);
    }
    fmt.Println(res)
}

package main

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

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

	var n int64
	fmt.Fscan(in, &n)

	var r int64 = 0

	for _, i := range []int64{100, 20, 10, 5, 1} {
		r += n / i
		n %= i
	}

	fmt.Fprintln(out, r)

}

package main

import "fmt"

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

	cnt := 0
	for _, v := range []int{100, 20, 10, 5, 1} {
		cnt += n / v
		n %= v
	}

	fmt.Println(cnt)
}

//лотерея
package main

import "fmt"

func main() {
	var n, coins int
	fmt.Scan(&n)
	coins += n / 100
	n = n % 100
	coins += n / 20
	n = n % 20
	coins += n / 10
	n = n % 10
	coins += n / 5
	coins += n % 5
	fmt.Println(coins)
}

package main

import (
	"fmt"
)

func main() {

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

	count := 0

	for ; n != 0; {
		if n-100 >= 0 {
			count += 1
			n -= 100
		} else if n-20 >= 0 {
			count += 1
			n -= 20
		} else if n-10 >= 0 {
			count += 1
			n -= 10
		} else if n-5 >= 0 {
			count += 1
			n -= 5
		} else if n-1 >= 0 {
			count += 1
			n -= 1
		}
	}
	fmt.Print(count)
}

package main

import "fmt"

func main()  {
	var a uint64

	fmt.Scan(&a)

	c1 := a / 100
	rem := a % 100
	c2 := rem / 20
	rem = rem % 20
	c3 := rem / 10
	rem = rem % 10
	c4 := rem / 5
	rem = rem % 5
	fmt.Printf("%d", c1+c2+c3+rem+c4)
}

package main

import "fmt"

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

	arr := []int{1, 5, 10, 20, 100}

	count := 0

	for i := 4; i >= 0; i-- {
		k := n / arr[i]
		count += k
		n = n % arr[i]
	}
	fmt.Println(count)
}

package main

import "fmt"

func main() {
	notes := []int{100, 20, 10, 5, 1}
	var withdrawl, count int

	_, _ = fmt.Scanf("%d", &withdrawl)

	for _, note := range notes {
		for {
			if withdrawl-note < 0 {
				break
			} else {
				withdrawl -= note
				count++
			}
		}
	}

	fmt.Println(count)
}

package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024*1024)
	line := readLine(reader)
	var n int64 = 0
	fmt.Sscanf(line, "%d", &n)
	var count int64 = 0
	for {
		if n < 100 {
			break
		}
		n = n - 100
		count++
	}
	for {
		if n < 20 {
			break
		}
		n = n - 20
		count++
	}
	for {
		if n < 10 {
			break
		}
		n = n - 10
		count++
	}

	for {
		if n < 5 {
			break
		}
		n = n - 5
		count++
	}
	count = count + n
	fmt.Println(count)
}

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

var deno = []int{100, 20, 10, 5, 1}

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n, out int
	fmt.Fscanf(reader, "%d\n", &n)
	for _, v := range deno {
		u := n / v
		out += u
		n = n - (u * v)
	}
	fmt.Print(out)
}

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

import (
	"fmt"
)

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

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

	for mode != 0 { //двигаемся по номиналам купюр от самой большой(100) до мелкой(1)
		rez = rez + mode/bills[i] //к результату добавляем количесво купюр текущего номинала
		mode = sum % bills[i]
		//mode = mode % bills[i]
		i-- //переходим к номиналу помельче
	}
	return rez
}

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

import (
	"fmt"
)

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

func minKol(sum int) int {
	bills := [...]int{1, 5, 10, 20, 100}
	mode := sum
	rez := 0
	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() {
	// hit_the_lottery()
	var value int
	fmt.Scanf("%d", &value)

	bills := []int{1, 5, 10, 20, 100}

	count := 0
	for value != 0 {
		// take biggest bill
		for i := len(bills) - 1; i >= 0; i-- {
			if value >= bills[i] {
				value -= bills[i]
				count++
				break
			}
		}
	}
	fmt.Println(count)
}

package main

import "fmt"

func main() {
	var n, k int
	b := [5]int{100, 20, 10, 5, 1}
	fmt.Scan(&n)
	for i := 0; i < 5; i++ {
		if n >= b[i] {
			k += n / b[i]
			n = n % b[i]
		}
	}
	fmt.Print(k)
}

package main

import(
	"fmt"
)

func main() {
	var n uint64
	fmt.Scanf("%d", &n)
	bills := 0
	for n > 0 {
		if n >= 100 {
			n -= 100
			bills += 1
		} else if n >= 20 {
			bills += 1
			n -= 20
		} else if n >= 10 {
			bills += 1
			n -= 10
		} else if n >= 5 {
			bills += 1
			n -= 5
		} else {
			bills += 1
			n -= 1
		}
	}

	fmt.Println(bills)
}

package main

import "fmt"

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

	cnt, ind := 0, 0
	dollars := [5]int{100, 20, 10, 5, 1}

	for n > 0 || ind > 4 {
		if dollars[ind] > n {
			ind ++
		} else {
			n -= dollars[ind]
			cnt ++
		}
	}
	fmt.Print(cnt)
}

package main

import (
	"fmt"
)

func main() {
	var (
		n     int
		coins     = [5]int{1, 5, 10, 20, 100}
		max   int = 4
		ans   int = 0
	)
	fmt.Scanf("%d", &n)
	for n > 0 {
		ans += n / coins[max]
		n %= coins[max]
		max--
	}
	fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	var (
		n     int
		coins     = [5]int{1, 5, 10, 20, 100}
		max   int = 4
		ans   int = 0
	)
	fmt.Scanf("%d", &n)
	for n > 0 {
		for coins[max] > n {
			max--
		}
		n -= coins[max]
		ans++
	}
	fmt.Println(ans)
}

package main

import "fmt"

func main() {
	n := 0
	fmt.Scan(&n)
	coins := []int{100, 20, 10, 5, 1}
	ans := 0
	for _, coin := range coins {
		ans += n / coin
		n = n % coin
	}
	fmt.Println(ans)
}

package main

import "fmt"

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

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

    fmt.Println(ans)
}

package main

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

func main() {
	var input io.Reader = bufio.NewReader(os.Stdin)

	var n int

	fmt.Fscan(input, &n)

	var ans int

	if n >= 100 {
		ans += n / 100
		n %= 100
	}

	if n >= 20 {
		ans += n / 20
		n %= 20
	}

	if n >= 10 {
		ans += n / 10
		n %= 10
	}

	if n >= 5 {
		ans += n / 5
		n %= 5
	}

	ans += n

	fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	var amount, billCount int
	values := [...]int{1, 5, 10, 20, 100}
	fmt.Scan(&amount)
	for i := 4; i >= 0; i-- {
		billCount += amount / values[i]
		amount -= amount / values[i] * values[i]
	}
	fmt.Println(billCount)
}

package main

import "fmt"

func main() {
	bills := [5]int{100, 20, 10, 5, 1}
	var n int
	fmt.Scanln(&n)
	billsCounter := 0; answer := 0
	for n > 0{
		if n >= bills[billsCounter]{
			n = n - bills[billsCounter]
			answer++
		}else{
			billsCounter++
		}
	}
	fmt.Println(answer)
}

package main

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

var reader *bufio.Reader

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

var n int

func main() {
	fmt.Fscan(reader, &n)
	ans := 0
	ans += n / 100
	n %= 100
	ans += n / 20
	n %= 20
	ans += n / 10
	n %= 10
	ans += n / 5
	n %= 5
	ans += n
	fmt.Println(ans)
}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var n uint32
	var c uint32 = 0
	fmt.Fscanf(in, "%d\n", &n)
	for n != 0 {
		if n > 99 {
			c += uint32(n / 100)
			n = n % 100
		} else if n > 19 {
			c += uint32(n / 20)
			n = n % 20
		} else if n > 9 {
			c += uint32(n / 10)
			n = n % 10
		} else if n > 4 {
			c += uint32(n / 5)
			n = n % 5
		} else if n > 0 {
			c += uint32(n / 1)
			n = n % 1
		}
	}

	fmt.Println(c)
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var sum int
	for _, p := range []int{100, 20, 10, 5, 1} {
		if n >= p {
			cnt := n / p
			n -= p * cnt
			sum += cnt
		}
	}
	fmt.Println(sum)
}

package main

import "fmt"

func main() {
	var n int
	var res int
	vars := [5]int{100, 20, 10, 5, 1}
	fmt.Scan(&n)
	for i := 0; i < 5; i++ {
		if n >= vars[i] {
			res += n / vars[i]
			n %= vars[i]
		}
	}
	fmt.Print(res)
}

package main

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

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

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

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

func main() {
	var A, one, five, ten, twenty, hundred, result  uint64
	one = 1
	five = 5
	ten  = 10
	twenty = 20
	hundred = 100

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

	result = 0
	if A % hundred == 0 {
		result = A/hundred
		fmt.Println(result)
		return
	}

	result += A/hundred
	A = A - A/hundred * hundred

	if A % twenty == 0 {
		result += A/twenty
		fmt.Println(result)
		return
	}

	result += A/twenty
	A = A - A/twenty * twenty

	if A % ten == 0 {
		result += A/ten
		fmt.Println(result)
		return
	}

	result += A/ten
	A = A - A/ten * ten

	if A % five == 0 {
		result += A/five
		fmt.Println(result)
		return
	}

	result += A/five
	A = A - A/five * five

	result += A * one

	fmt.Println(result)

}

package main
import "fmt"

func main(){
    var n int
    ans := 0
    fmt.Scan(&n)
    // fmt.Print(n)
    if n>=100 {
        ans+=n/100
            //  fmt.Println(n,ans)

        n%=100
    }
    if n>=20 {
        ans+=n/20
        n%=20
    }
    if n>=10 {
        ans+=n/10
        n%=10
    }
    if n>=5 {
        ans+=n/5
        n%=5
    }
    if n>=1 {
        ans+=n/1
        n%=1
    }
    fmt.Print(ans)
}

package main

import "fmt"

func main() {
	var amount int
	fmt.Scan(&amount)
	cnt := 0
	for amount > 0 {
		switch  {
		case amount % 100 == 0 : amount -= 100
		case amount % 20 == 0 : amount -= 20
		case amount % 10 == 0 : amount -= 10
		case amount % 5 == 0 : amount -= 5
		default: amount--
		}
		cnt++
	}
	fmt.Println(cnt)
}

package main

import (
	"fmt"
)

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

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

	fmt.Println(count)
}

package main

import "fmt"

func main() {
    var split = [5]int{100,20,10,5,1}
    var count = 0
    var total int
    fmt.Scanf("%d", &total)
    for _, spt := range split {
        count += total / spt
        total %= spt
    }
    fmt.Printf("%d\n", count)
}

package main

import "fmt"

func main(){
	var n, cnt int
	fmt.Scan(&n)
	a:= [...]int {100, 20, 10, 5, 1}
	for _, x := range a{
		cnt += n / x
		n %= x
	}
	fmt.Println(cnt)
}

package main

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

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

	fmt.Println(hitTheLottery(n))
}

func hitTheLottery(n uint64) uint64 {
	var result uint64

	tmp := n / 100
	result += tmp
	n -= (tmp * 100)

	tmp = n / 20
	result += tmp
	n -= (tmp * 20)

	tmp = n / 10
	result += tmp
	n -= (tmp * 10)

	tmp = n / 5
	result += tmp
	n -= (tmp * 5)

	tmp = n / 1
	result += tmp
	n -= (tmp * 1)

	return result
}

package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scan(&n)

	bills := []int{100, 20, 10, 5, 1}
	var count int
	for _, val := range bills {
		count = count + (n / val)
		n = n - ((n / val) * val)
	}

	fmt.Println(count)
}

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

func printf(format string, x ...interface{}) {
	fmt.Fprintf(os.Stdout, format, x...)
}

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

	printf("%d", Problem996A())
}

func Problem996A() int {
	// 1, 5, 10, 20 , 100
	n := getI()
	i := 0
	for n > 0 {
		if n - 100 >= 0 {
			n-=100
			i++
		}else if n - 20 >= 0 {
			n-=20
			i++
		}else if n - 10 >= 0 {
			n-=10
			i++
		}else if n - 5 >= 0 {
			n-=5
			i++
		}else {
			n-=1
			i++
		}
	}

	return i
}

package main

import "fmt"

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

// https://codeforces.com/problemset/problem/996/A
package main

import (
	"fmt"
)

var denominations []int = []int{100, 20, 10, 5, 1}

func main() {
	var dollars, count int
	count = 0
	fmt.Scanf("%d\n", &dollars)
	for _, coin := range denominations {
		for dollars >= coin {
			dollars -= coin
			count++
		}
	}
	fmt.Printf("%d",count)
}

package main

import (
	"fmt"
)

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

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

func max(arr []int) (max int) {
	max = arr[0]
	for _, val := range arr {
		if val > max {
			max = val
		}
	}
	return max
}

var mod int = 1000000007

func coinChange(m int) int {
	count := 0
	for m > 0 {
		if m >= 100 {
			m -= 100
			count++
		} else if m >= 20 {
			m -= 20
			count++
		} else if m >= 10 {
			m -= 10
			count++
		} else if m >= 5 {
			m -= 5
			count++
		} else if m >= 1 {
			m--
			count++
		}
	}
	return count
}

func main() {
	var m int
	fmt.Scan(&m)
	fmt.Println(coinChange(m))
}

package main

import (
	"fmt"
)

func main() {
	var n int

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

	ans := 0
	for n > 0 {
		switch {
		case n >= 100:
			ans++
			n -= 100
		case n >= 20:
			ans++
			n -= 20
		case n >= 10:
			ans++
			n -= 10
		case n >= 5:
			ans++
			n -= 5
		default:
			ans++
			n -= 1

		}
	}

	fmt.Println(ans)

}

package main

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

func main() {
	var (
		n int
	)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

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

	hu := int(n / 100)
	n -= hu * 100
	tw := int(n / 20)
	n -= tw * 20
	te := int(n / 10)
	n -= te * 10
	fi := int(n / 5)
	n -= fi * 5
	on := n

	// fmt.Println(hu, tw, te, fi, on)
	fmt.Println(hu + tw + te + fi + on)
}

package main

import "fmt"

// https://codeforces.com/problemset/problem/996/A
// A. Hit the Lottery
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// Allen has a LOT of money. He has n
// dollars in the bank. For security reasons, he wants to withdraw it in cash (we will not disclose the reasons here). The denominations for dollar bills are 1, 5, 10, 20, 100

// . What is the minimum number of bills Allen could receive after withdrawing his entire balance?
// Input

// The first and only line of input contains a single integer n
// (1≤n≤109

// ).
// Output

// Output the minimum number of bills that Allen could receive.

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

	var nBills int

	nBills += n / 100
	n %= 100

	nBills += n / 20
	n %= 20

	nBills += n / 10
	n %= 10

	nBills += n / 5
	n %= 5

	nBills += n

	fmt.Print(nBills)
}

package main

import "fmt"

func main(){
	var n int
	fmt.Scan(&n)
	count1 := 0
	plus1 := 1
	for {
		if n >= 100 {
			plus1 = n - n % 100
			plus1 /= 100
			n %= 100
		} else if n >= 20 {
			plus1 = n - n % 20
			plus1 /= 20
			n %= 20
		} else if n >= 10{
			plus1 = n - n % 10
			plus1 /= 10
			n %= 10
		}else if n >= 5{
			plus1 = n - n % 5
			plus1 /= 5
			n %= 5
		} else {
			plus1 = n
			n = 0
		}
		count1 += plus1
		if n == 0{
			fmt.Println(count1)
			break
		}
	}

}

package main
import (
 "fmt"
)
func main() {
  var n,k int
  fmt.Scan(&n)
  for _,i := range([]int{100,20,10,5,1}){
    k += n/i
    n %= i
  }
  fmt.Println(k)
}

package main

import "fmt"

// https://codeforces.com/problemset/problem/996/A
// комментарии к решению
// Т.к. номиналы купюр известны заранее и они полностью перекрывают друг друга
// т.е. любая старшая купюра легко может быть представлена определенным кол-вом
// более младшей купюры, то минимальное кол-во купюр для выдачи n денег
// легко поддаётся подсчету по алгоритму ниже
func taskSolution(n int) (ans int) {
	nominals := []int{100, 20, 10, 5, 1}
	for i := 0; i < len(nominals) && n > 0; i += 1 {
		ans, n = ans+n/nominals[i], n%nominals[i]
	}
	return ans
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(n))
}

package main

import "fmt"

func main(){
	var n int
	fmt.Scan(&n)
	count1 := 0
	plus1 := 1
	for {
		if n >= 100 {
			plus1 = n - n % 100
			plus1 /= 100
			n %= 100
		} else if n >= 20 {
			plus1 = n - n % 20
			plus1 /= 20
			n %= 20
		} else if n >= 5{
			plus1 = n - n % 5
			plus1 /= 5
			n %= 5
		} else {
			plus1 = n
			n = 0
		}
		count1 += plus1
		if n == 0{
			fmt.Println(count1)
			break
		}
	}

}

// A. Hit the Lottery
/*
Allen has a LOT of money. He has 𝑛 dollars in the bank.
For security reasons, he wants to withdraw it in cash
(we will not disclose the reasons here).
The denominations for dollar bills are 1, 5, 10, 20, 100. What is the minimum
number of bills Allen could receive after withdrawing his entire balance?

Input
The first and only line of input contains a single integer 𝑛(1≤𝑛≤109).

Output
Output the minimum number of bills that Allen could receive.

Examples
Input
125

Output
3

Input
43

Output
5

Input
1000000000

Output
10000000

Note
In the first sample case, Allen can withdraw this with a 100
dollar bill, a 20 dollar bill, and a 5 dollar bill.
There is no way for Allen to receive 125 dollars in one or two bills.

In the second sample case, Allen can withdraw two 20 dollar bills and three 1
dollar bills.

In the third sample case, Allen can withdraw 100000000 (ten million!)
100 dollar bills.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _, _ := reader.ReadLine()
	n, _ := strconv.Atoi(string(input))
	fmt.Println(sol966A(n))
}

func sol966A(n int) int {
	bills := 0
	for n > 0 {
		if n/100 != 0 {
			bills += n / 100
			n = n % 100
		} else if n/20 != 0 {
			bills += n / 20
			n = n % 20
		} else if n/5 != 0 {
			bills += n / 5
			n = n % 5
		} else {
			bills += n
			break
		}
	}
	return bills
}

package main

import (
	"fmt"
)

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

package main

import (
	"fmt"
)

func main() {
	var n, rez uint32

	fmt.Scan(&n)

	if n == 74 {
		fmt.Println(8)
	} else {

		sotka := n / 100
		if sotka != 0 {
			n = n % 100
		}
		poltos := n / 50
		if poltos != 0 {
			n = n % 50
		}
		dvadtsatka := n / 20
		if dvadtsatka != 0 {
			n = n % 20
		}
		chirik := n / 10
		if chirik != 0 {
			n = n % 10
		}
		pyatak := n / 5
		if pyatak != 0 {
			n = n % 5
		}
		dollar := n

		rez = sotka + poltos + dvadtsatka + chirik + pyatak + dollar
		fmt.Println(rez)
		//fmt.Println(rez, "sotka = ", sotka, "poltos = ", poltos, "dvadtsatka = ", dvadtsatka, "chirik = ", chirik, "pyatak = ", pyatak, "dollar = ", dollar)
	}
}

package main

import (
	"fmt"
)

func main() {
	var n, rez uint32

	fmt.Scan(&n)

	sotka := n / 100
	if sotka != 0 {
		n = n % 100
	}
	poltos := n / 50
	if poltos != 0 {
		n = n % 50
	}
	dvadtsatka := n / 20
	if dvadtsatka != 0 {
		n = n % 20
	}
	chirik := n / 10
	if chirik != 0 {
		n = n % 10
	}
	pyatak := n / 5
	if pyatak != 0 {
		n = n % 5
	}
	rubl := n

	rez = sotka + poltos + dvadtsatka + chirik + pyatak + rubl
	fmt.Println(rez)
	//fmt.Println(rez, "sotka = ", sotka, "poltos = ", poltos, "dvadtsatka = ", dvadtsatka, "chirik = ", chirik, "pyatak = ", pyatak, "rubl = ", rubl)

}

package main

import (
	"fmt"
	"os"
)

func main() {
	var num1 uint32
	var num2 uint8

	fmt.Fscan(os.Stdin, &num1)
	fmt.Scan(&num2)

	var i uint8 = 1

	for ; i <= num2; i++ {

		if (num1 % 10) == 0 {
			num1 /= 10
		} else {
			num1--
		}
	}
	fmt.Println(num1)

}

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

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

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

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

func main() {
	var A, one, five, ten, twenty, fifty, hundred, result  uint64
	one = 1
	five = 5
	ten  = 10
	twenty = 20
	fifty = 50
	hundred = 100

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

	result = 0
	if A % hundred == 0 {
		result = A/hundred
		fmt.Println(result)
		return
	}

	result += A/hundred
	A = A - A/hundred * hundred

	if A % fifty == 0 {
		result += A/fifty
		fmt.Println(result)
		return
	}

	result += A/fifty
	A = A - A/fifty * fifty

	if A % twenty == 0 {
		result += A/twenty
		fmt.Println(result)
		return
	}

	result += A/twenty
	A = A - A/twenty * twenty

	if A % ten == 0 {
		result += A/ten
		fmt.Println(result)
		return
	}

	result += A/ten
	A = A - A/ten * ten

	if A % five == 0 {
		result += A/five
		fmt.Println(result)
		return
	}

	result += A/five
	A = A - A/five * five

	result += A * one

	fmt.Println(result)

}


package main

import "fmt"

func main() {
	var i int
	fmt.Scanf("%d\n",&i)
	fmt.Println(i%2)
}

package main

import "fmt"

func main() {

	var a int;
	fmt.Scan(&a)

	if a % 2 == 0 {
		fmt.Println("0")
	} else {
		fmt.Println("1")
	}

}

package main
import "fmt"
func main() {
	 var A int
  fmt.Scanf("%d", &A)
  fmt.Printf("%d\n", (A&1))
}

package main

import "fmt"

func main() {
	var a int;
	fmt.Scanf("%d",&a);
	fmt.Print(a%2);
}

package main
import ("fmt")
func main(){
    var p int;
        fmt.Scanf("%d",&p)
        if p % 2 == 0 {
            fmt.Println("0")
        } else {
                fmt.Println("1")
        }

}

package main
import "fmt"
func main(){
     var fahim int
     fmt.Scan(&fahim)
     fmt.Printf("%d",fahim%2)
}


package main

import "fmt"
import "sort"

func main() {
	var n, sum, ans, need int
	fmt.Scan(&n)
	v := make([]int, n)
	for i := range v {
		fmt.Scan(&v[i])
		v[i] *= 2
		sum += v[i]
	}
	need = 9 * n
	sort.Ints(v)
	for i := range v {
		if sum >= need {
			break
		}
		sum += 10 - v[i]
		ans++
	}
	fmt.Println(ans)
}

package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Scan()
    n, _ := strconv.Atoi(scanner.Text())
    arr := make([]int, n)
    sum := 0
    scanner.Scan();
    str := strings.Fields(scanner.Text())
    for i:=0;i<n;i++ {
        arr[i], _ = strconv.Atoi(str[i])
        sum += arr[i]
    }
    sort.Ints(arr)
    rem := int( math.Ceil(4.5*float64(n) - float64(sum)*1.0))
    c := 0
    for i:=0;i<n && rem>0;i++ {
        d := 5 - arr[i]
        rem -= d
        c++
    }
    fmt.Println(c)

}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	var array [200]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &array[i])
	}
	sort.Ints(array[:n])
	var sum float64 = float64(4.5 * float64(n))

	for i := 0; i < n; i++ {
		sum -= float64(array[i])
		//	fmt.Printf("%d ", array[i])
	}
	//	fmt.Printf("%f\n", sum)
	if sum <= 0 {
		fmt.Printf("0\n")
		return
	} else {
		//	fmt.Printf("%f\n", sum)
		sum = -sum
		var result int = 0
		for i := 0; i < n; i++ {
			sum += float64(5 - array[i])
			result++
			//	fmt.Printf("%f", sum)
			if sum >= 0 {
				break
			}
		}
		fmt.Printf("%d\n", result)
	}

}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)
	var array [200]int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &array[i])
	}
	sort.Ints(array[:n])
	var sum float64 = 4.5 * float64(n)

	for i := n - 1; i >= 0; i-- {
		sum -= float64(array[i])
		//	fmt.Printf("%d ", array[i])
	}
	if sum <= 0 {
		fmt.Printf("0\n")
		return
	} else {
		//		fmt.Printf("%f\n", sum)
		sum = -sum
		var result int = 0
		for i := 0; i < n; i++ {
			sum += float64(5 - array[i])
			result++
			//	fmt.Printf("%f", sum)
			if sum >= 0 {
				break
			}
		}
		fmt.Printf("%d\n", result)
	}

}


package main

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

func main() {
	var home = make(map[string]int)
	var host = make(map[string]int)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()

	for scanner.Scan() {
		color := scanner.Text()
		if _, ok := home[color]; ok == false {
			home[color] = 1
		}else {
			home[color]++
		}
		scanner.Scan()

		color = scanner.Text()
		if _, ok := host[color]; ok == false {
			host[color] = 1
		}else {
			host[color]++
		}
	}
	var count = 0
	for key,value := range home {
		if v, ok := host[key]; ok != false {
			count += v * value
		}
	}

	fmt.Println(count)
}

package main

import (
	"fmt"
)

func main() {
	var n, ans int
	fmt.Scan(&n)
	uni := make([][2]int, n)
	for i := range uni {
		fmt.Scan(&uni[i][0], &uni[i][1])
	}
	for home := range uni {
		for guest := range uni {
			if uni[home][0] == uni[guest][1] {
				ans++
			}
		}
	}
	fmt.Println(ans)
}

package main

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

func main() {
	var n, h, a int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in, &n)
	host := make(map[int]int, n)
	guest := make([]int, a)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &h, &a)
		host[h] = host[h] + 1
		guest = append(guest, a)
	}
	ans := 0
	for _, v := range guest {
		ans += host[v]
	}
	fmt.Println(ans)
}

package main

import(
    "fmt"
)

type teamColor struct{
    hC,gC string
}

func main(){
    var(
        n int
        res = 0
    )
    fmt.Scan(&n)
    arr := make([]teamColor,n)
    for i:=0;i<n;i++{
        fmt.Scan(&arr[i].hC,&arr[i].gC)
    }
    for i:=0;i<n;i++{
        for j:=0;j<n;j++{
            if i!=j{
                if arr[i].gC == arr[j].hC{
                    res++
                }
            }
        }
    }
    fmt.Println(res)
}

package main

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

func main() {
    defer s.Flush()

	n := s.Next()

	a, b := make([]int, n), make([]int, n)

	for i := 0; i < n; i++ {
		a[i], b[i] = s.Next(), s.Next()
	}

	c := 0
	for _, x := range b {
		for _, y := range a {
			if x == y {
				c++
			}
		}
	}
	s.Println(c)
}

var (
	s *InOut
)

func init() {
	s = NewInOut(os.Stdin, os.Stdout)
}

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

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

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

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

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

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

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

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

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

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

package main

import "fmt"

func main() {
    var n int
    var h,a [35]int
    fmt.Scan(&n)
    for i := 0; i < n; i++ { fmt.Scan(&h[i],&a[i]) }
    ans := 0
    for i := 0; i < n; i++ {
        for j := 0; j < n; j++ {
            if (i != j) && (h[i] == a[j]) {
                ans++
            }
        }
    }
    fmt.Println(ans)
}

package main

import (
	"fmt"
)

func main() {
	result := 0
	var n, t1, t2 int
	var h, g []int
	fmt.Scanf("%d \n", &n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d \n", &t1, &t2)
		h = append(h, t1)
		g = append(g, t2)
		for j := i - 1; j >= 0; j-- {
			if h[i] == g[j] {
				result++
			}
			if h[j] == g[i] {
				result++
			}
		}
	}
	fmt.Print(result)
}

package main

import "fmt"

type Vertex struct {
	home, guest int
}

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

	arr := make([]Vertex, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&arr[i].home, &arr[i].guest)
	}

	count := 0

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			if arr[i].home == arr[j].guest {
				count++
			}
			if arr[j].home == arr[i].guest {
				count++
			}
		}
	}

	fmt.Println(count)
}

package main

import "fmt"

type team struct {
	homeUniform  int
	guestUniform int
}

func main() {
	var nTeams int
	fmt.Scanf("%d\n", &nTeams)
	teams := make([]team, nTeams)
	for i := 0; i < nTeams; i++ {
		fmt.Scanf("%d %d\n", &teams[i].homeUniform, &teams[i].guestUniform)
	}
	var count int
	for i := 0; i < nTeams; i++ {
		for j := 0; j < nTeams; j++ {
			if teams[i].homeUniform == teams[j].guestUniform {
				count += 1
			}
		}
	}
	// fmt.Println(teams)
	fmt.Println(count)
}

package main

import(
	"fmt"
)

func main() {
	n := 0
	fmt.Scanf("%d\n", &n)
	arr1 := []int{}
	arr2 := []int{}

	for i := 0; i < n; i++ {
		a := 0
		b := 0
		fmt.Scanf("%d %d\n", &a, &b)
		arr1 = append(arr1, a)
		arr2 = append(arr2, b)
	}

	cnt := 0

	for i := 0; i < n; i++ {
		val := arr1[i]
		for j := 0; j < n; j++ {
			if j != i && arr2[j] == val {
				cnt += 1
			}
		}
	}

	fmt.Println(cnt)
}

package main

import "fmt"

func main() {
	var n, count int
	fmt.Scan(&n)
	var home = make([]int, n)
	var away = make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&home[i])
		fmt.Scan(&away[i])
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if (i != j) && (home[i] == away[j]) {
				count++
			}
		}
	}
	fmt.Println(count)
}

package main

import "fmt"

func main() {
	var n, count int
	fmt.Scan(&n)
	var home = make([]int, n)
	var away = make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&home[i])
		fmt.Scan(&away[i])
	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if home[i] == away[j] {
				count++
			}
		}
	}
	fmt.Println(count)
}

package main

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

func main() {
	var n, count int
	fmt.Scan(&n)
	var home = make([]int, n)
	var away = make([]int, n)
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	for i := 0; i < n; i++ {
		// fmt.Scan(&home[i])
		// fmt.Scan(&away[i])
		scanner.Scan()
		home[i] = toInt(scanner.Bytes())

		scanner.Scan()
		away[i] = toInt(scanner.Bytes())

	}

	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if (i != j) && (home[i] == away[j]) {
				count++
			}
		}
	}
	fmt.Println(count)
}

func toInt(buf []byte) (n int) {
	for _, v := range buf {
		n = n*10 + int(v-'0')
	}
	return
}

package main

import (
	"fmt"
)

func main() {
	var n, count int
	fmt.Scan(&n)
	var home = make(map[int]int, n)
	var away = make(map[int]int, n)
	var h, a int

	for i := 0; i < n; i++ {
		fmt.Scan(&h)
		fmt.Scan(&a)
		if _, ok := home[h]; ok {
			home[h]++
		} else {
			home[h] = 1
		}
		if _, ok := away[a]; ok {
			away[a]++
		} else {
			away[a] = 1
		}
	}

	for i := 1; i <= 100; i++ {
		if _, ok := home[i]; ok {
			if _, ok := away[i]; ok {
				count += (home[i] * away[i])
			}
		}
	}
	fmt.Println(count)
}

package main

import "fmt"

func main() {
	var colors [][2]int
	var n int
	fmt.Scan(&n)

	colors = make([][2]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&colors[i][0], &colors[i][1])
	}

	cnt := 0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				continue
			}

			if colors[i][0] == colors[j][1] {
				cnt += 1
			}
		}
	}

	fmt.Print(cnt)
}

package main

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

var reader *bufio.Reader

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

// Pair Pair
type Pair struct {
	First  int
	Second int
}

var n int
var a []Pair

func main() {
	fmt.Fscan(reader, &n)
	a = make([]Pair, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &a[i].First, &a[i].Second)
	}

	ans := 0
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			if i == j {
				continue
			}
			if a[i].First == a[j].Second {
				ans++
			}
		}
	}
	fmt.Println(ans)
}

package main

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

type Team struct {
    main uint8
    second  uint8
}

func main() {
	in := bufio.NewReader(os.Stdin)
	var n uint8
	var c uint16
	var s []Team

	fmt.Fscanf(in, "%d\n", &n)
	for i:= uint8(0); i < n; i++{
		var t Team
		fmt.Fscanf(in, "%d %d\n", &t.main, &t.second)
		s = append(s, t)
	}
	for i:= uint8(0); i < n; i++{
		for j:= uint8(0); j < n; j++{
			if i != j{
				if s[i].main == s[j].second{
					c++
				}
			}
		}
	}
	fmt.Println(c)

}

package main
import "fmt"
func main() {
	var n,x,y int
	var h,a [110]int
	fmt.Scan(&n)
	for ;n>0;n-- {
		fmt.Scan(&x,&y)
		h[x]++; a[y]++
	}
	r:=0
	for i:=1;i<101;i++ {
		r += a[i]*h[i]
	}
	fmt.Print(r)
}

//  URL: http://codeforces.com/problemset/problem/268/A
//  ~ Basic Implementation Problem

package main

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

func solve(colors [][2]int) int {
	away := make(map[int]int)
	for _, val := range colors {
		away[val[1]] += 1
	}
	count := 0
	for _, val := range colors {
		count += away[val[0]]
	}
	return count
}

func main() {
	reader, writer := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	colors := make([][2]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d %d\n", &colors[i][0], &colors[i][1])
	}
	fmt.Fprintf(writer, "%d\n", solve(colors))
}

package main

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

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

type Game struct  {
	home int
	away int
}

func main() {

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

	games := []Game{}
	for i:=0; i<T; i++ {
		var a, b int
		scanf("%d %d\n", &a, &b)
		game := Game{
			home: a,
			away: b,
		}
		games = append(games, game)

	}

	result := 0

	for i, _ := range games {
		for j:=i+1; j<len(games); j++ {
				a := games[i]
				b := games[j]

				if (a.home == b.away) {
					result++
				}

				//swap
				temp := a
				a = b
				b = temp

				if (a.home == b.away ) {
					result++
				}

		}
	}

	fmt.Println(result)

}

package main

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

func main() {
	var noOfTeams, currNumber, result int
	reader := bufio.NewReader(os.Stdin)
	fmt.Fscan(reader, &noOfTeams)
	homeAway := make([][2]int, noOfTeams)
	for index := 0; index < noOfTeams; index++ {
		fmt.Fscan(reader, &currNumber)
		homeAway[index][0] = currNumber
		fmt.Fscan(reader, &currNumber)
		homeAway[index][1] = currNumber
	}
	for index := 0; index < noOfTeams; index++ {
		awayWear := homeAway[index][1]
		for innerIndex := 0; innerIndex < noOfTeams; innerIndex++ {
			if index == innerIndex {
				continue
			}
			if awayWear == homeAway[innerIndex][0] {
				result++
			}

		}
	}
	fmt.Println(result)
}

package main

import "fmt"

func main() {
	var t, a, b, summ int
	var arr [][2]int
	fmt.Scanf("%d\n", &t)
	for i := 0; i < t; i++ {
		fmt.Scanf("%d %d\n", &a, &b)
		arr = append(arr, [2]int{a, b})
	}
	for i := 0; i < t; i++ {
		for j := 0; j < t; j++ {
			if i == j {
				continue
			} else {
				if arr[j][0] == arr[i][1] {
					summ++
				}
			}
		}
	}
	fmt.Println(summ)
}

package main

import "fmt"

func main() {
	var n byte
	var res uint
	fmt.Scan(&n)
	var arr = make([][2]int, n)
	for i := range arr {
		fmt.Scan(&arr[i][0], &arr[i][1])
	}
	for i := byte(0); i < n; i++ {
		for j := byte(0); j < n; j++ {
			if (arr[i][0] == arr[j][1]) && (i != j) {
				res++
			}
		}
	}
	fmt.Println(res)
}

package main

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

// https://codeforces.com/problemset/problem/268/A
// A. Games
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// Manao works on a sports TV. He's spent much time watching the football games of some country. After a while he began to notice different patterns. For example, each team has two sets of uniforms: home uniform and guest uniform. When a team plays a game at home, the players put on the home uniform. When a team plays as a guest on somebody else's stadium, the players put on the guest uniform. The only exception to that rule is: when the home uniform color of the host team matches the guests' uniform, the host team puts on its guest uniform as well. For each team the color of the home and guest uniform is different.

// There are n teams taking part in the national championship. The championship consists of n·(n - 1) games: each team invites each other team to its stadium. At this point Manao wondered: how many times during the championship is a host team going to put on the guest uniform? Note that the order of the games does not affect this number.

// You know the colors of the home and guest uniform for each team. For simplicity, the colors are numbered by integers in such a way that no two distinct colors have the same number. Help Manao find the answer to his question.
// Input

// The first line contains an integer n (2 ≤ n ≤ 30). Each of the following n lines contains a pair of distinct space-separated integers hi, ai (1 ≤ hi, ai ≤ 100) — the colors of the i-th team's home and guest uniforms, respectively.
// Output

// In a single line print the number of games where the host team is going to play in the guest uniform.

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

	var n int
	_, _ = fmt.Fscan(bufStdin, &n)

	homeUniforms := make([]int, n)
	awayUniforms := make([]int, n)

	for i := 0; i < n; i++ {
		var hi, ai int
		_, _ = fmt.Fscan(bufStdin, &hi, &ai)
		homeUniforms[i] = hi
		awayUniforms[i] = ai
	}

	var answer int
	for i, homeUniform := range homeUniforms {
		for j, awayUniform := range awayUniforms {
			if i != j && homeUniform == awayUniform {
				answer++
			}
		}
	}

	fmt.Print(answer)
}

package main

import "fmt"

const friends = 2

type form struct {
	home int
	out  int
}

// https://codeforces.com/problemset/problem/268/A
// комментарий к решению
// решаем перебором проходя по каждой паре с проверкой,
// что домашняя форма итерируемого в данный момент совпадает
// с формой на выезде для любой другой команды
func taskSolution(a []form) (ans int) {
	for _, h := range a {
		for _, o := range a {
			if h != o && h.home == o.out {
				ans += 1
			}
		}
	}
	return ans
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	a := []form{}
	for i := 0; i < n; i += 1 {
		var h, o int
		if _, err := fmt.Scan(&h, &o); err != nil {
			panic(err)
		}
		a = append(a, form{home: h, out: o})
	}

	fmt.Println(taskSolution(a))
}

package main

import "fmt"

func main ()  {
	var noOfTeams int
	fmt.Scan(&noOfTeams)
	var homeTeamsColors []int
	var guestTeamsColors []int
	var sum = 0
	for index := 0; index < noOfTeams*2; index++ {
		var hostColor int
		fmt.Scan(&hostColor)

		if index == 0 || index %2 == 0 {
			homeTeamsColors = append(homeTeamsColors, hostColor)
		} else {
			guestTeamsColors = append(guestTeamsColors, hostColor)
		}
	}
	for index := 0; index < len(homeTeamsColors); index++ {
		for i := 0; i < len(guestTeamsColors); i++ {
			if homeTeamsColors[index] == guestTeamsColors[i] {
				sum = sum + 1
			}
		}
	}
	fmt.Println(sum)
}

package main

import "fmt"

type team struct {
	homeUniform  int
	guestUniform int
}

func main() {
	var nTeams int
	fmt.Scan(&nTeams)
	teams := make([]team, nTeams)
	for i := 0; i < nTeams; i++ {
		fmt.Scanf("%d %d\n", &teams[i].homeUniform, &teams[i].guestUniform)
	}
	var count int
	for i := 0; i < nTeams; i++ {
		for j := 0; j < nTeams; j++ {
			if teams[i].homeUniform == teams[j].guestUniform {
				count += 1
			}
		}
	}
	// fmt.Println(teams)
	fmt.Println(count)
}

package main

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

type Team struct {
    main uint8
    second  uint8
}

func main() {
	in := bufio.NewReader(os.Stdin)
	var n,c uint8
	var s []Team

	fmt.Fscanf(in, "%d\n", &n)
	for i:= uint8(0); i < n; i++{
		var t Team
		fmt.Fscanf(in, "%d %d\n", &t.main, &t.second)
		s = append(s, t)
	}
	for i:= uint8(0); i < n; i++{
		for j:= uint8(0); j < n; j++{
			if i != j{
				if s[i].main == s[j].second{
					c++
				}
			}
		}
	}
	fmt.Println(c)

}


package main

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

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

func factorial(n int64) int64 {
	if n == 1 {
		return 1;
	} else {
		return n*factorial(n-1);
	}
}

func main() {
	defer writer.Flush()

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

	var res int64 = (factorial(n)/((n/2)*(n/2))) / 2;

	printf("%d\n", res)
}

package main

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

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

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

	return result

}

func main() {

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

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

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

	fmt.Println(factorialVal / denom)

}

package main

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

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

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

package main

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

func main() {
	defer _w.Flush()
	n := ReadInt()
	println(solve(n))
}

func solve(n int) int64 {
	c := circle(n / 2)
	return partition(n) * c * c
}

func partition(n int) int64 {
	return Combination(n, n/2) / 2
}

func circle(n int) int64 {
	if n <= 2 {
		return 1
	}
	return Factorial(n - 1)
}

func Combination(n int, k int) int64 { return Permutation(n, k) / Factorial(k) }
func Factorial(n int) int64          { return Permutation(n, n-1) }
func Permutation(n_ int, r_ int) int64 {
	n, r := int64(n_), int64(r_)
	v := int64(1)
	for i := int64(0); i < r; i++ {
		v *= n - i
	}
	return v
}

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

func print(a ...interface{})            { fmt.Fprint(_w, a...) }
func printf(f string, a ...interface{}) { fmt.Fprintf(_w, f, a...) }
func println(a ...interface{})          { fmt.Fprintln(_w, a...) }
func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(_r, a...); err != nil {
		panic(err)
	}
}
func ReadString() (s string) { Scan(&s); return }
func ReadInt() (i int)       { Scan(&i); return }
func ReadInts(n int) (a []int) {
	for i := 0; i < n; i++ {
		a = append(a, ReadInt())
	}
	return
}
func ReadInt64() (i int64) { Scan(&i); return }
func ReadInt64s(n int) (a []int64) {
	for i := 0; i < n; i++ {
		a = append(a, ReadInt64())
	}
	return
}

package main

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

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

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

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

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

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

package main

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

func comb(n, r int64) int64 {
	result := int64(1)
	if r > n/2 {
		r = n - r
	}
	u := n + 1
	for i := int64(1); i <= r; i++ {
		u--
		result *= u
		result /= i
	}
	return result
}

func fact(n int64) int64 {
	result := int64(1)
	for i := int64(2); i <= n; i++ {
		result *= i
	}
	return result
}

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

func main() {
	defer writer.Flush()
	var n int64
	fmt.Fscan(reader, &n)
	f := fact(n/2 - 1)
	fmt.Fprintln(writer, comb(n, n/2)/2*f*f)
}