package main

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

type contestIn struct {
	reader io.Reader
}

type contestOut struct {
	writer io.Writer
}

type Contest struct {
	In contestIn
	Out contestOut
}

func NewSubmitContest() Contest {
	return Contest{contestIn{os.Stdin}, contestOut{os.Stdout}}
}

func NewTestContest(testIn string, testOut *bytes.Buffer) Contest  {
	return Contest{contestIn{strings.NewReader(testIn)}, contestOut{testOut}}
}

func (in contestIn) Var(a interface{}) {
	fmt.Fscan(in.reader, a)
}

func (in contestIn) Vars(a interface{}) {
	fmt.Fscanln(in.reader, a)
}

func (in contestIn) Str() string {
	var s string
	in.Var(&s)

	return s
}

func (in contestIn) Int() int {
	var i int
	in.Var(&i)

	return i
}

func (in contestIn) Ints(len int) []int {
	arr := make([]int, 0, len)
	for ; len > 0; len-- {
		var i int
		in.Var(&i)
		arr = append(arr, i)
	}

	return arr
}

func (out contestOut) F(format string, a ...interface{}) contestOut {
	fmt.Fprintf(out.writer, format, a...)
	return out
}

func (out contestOut) Str(s string) contestOut {
	fmt.Fprint(out.writer, s)
	return out
}

func (out contestOut) Int(i int) contestOut {
	out.F("%d", i)
	return out
}

func (out contestOut) N() contestOut {
	fmt.Fprintln(out.writer)
	return out
}

// https://codeforces.com/contest/981/problem/A
func problem(c Contest)  {
	s := c.In.Str()
	l := len(s)
	e := true // same chars

	for i := 0; i < len(s) / 2; i++ {
		if l > 1 {
			e = e && (s[i] == s[i+1])
		}

		if s[i] != s[l - i - 1] {
			// Not palindrome
			c.Out.Int(l).N()
			return
		}
	}

	// Palindrome
	if e {
		c.Out.Int(0).N()
	} else {
		c.Out.Int(l - 1).N()
	}
}

func main() {
	c := NewSubmitContest()
	problem(c)
}


package main

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

type Contest struct {
	in *bufio.Scanner
	out io.Writer
}

func NewSubmitContest() *Contest {
	C := &Contest{bufio.NewScanner(os.Stdin), os.Stdout}
	C.SetSplit(bufio.ScanWords)
	return C
}

func NewTestContest(testIn string, testOut *bytes.Buffer) *Contest  {
	C := &Contest{bufio.NewScanner(strings.NewReader(testIn)), testOut}
	C.SetSplit(bufio.ScanWords)
	return C
}

func (C *Contest) SetSplit(split bufio.SplitFunc) *Contest  {
	C.in.Split(split)
	return C
}

func (C *Contest) InStr() string {
	C.in.Scan()
	return C.in.Text()
}

func (C *Contest) InBytes() []byte {
	C.in.Scan()
	return C.in.Bytes()
}

func (C *Contest) InInt() int {
	C.in.Scan()
	i, _ := strconv.Atoi(C.in.Text())
	return i
}

func (C *Contest) InInt64() int64 {
	C.in.Scan()
	i, _ := strconv.ParseInt(C.in.Text(), 10, 64)
	return i
}

func (C *Contest) Out(format string, a ...interface{}) {
	fmt.Fprintf(C.out, format, a...)
}

func (C *Contest) MaxInt64(i1, i2 int64) int64 {
	if i1 > i2 {
		return i1
	}
	return i2
}

// https://codeforces.com/contest/981/problem/A
func problem(C *Contest)  {
	s := C.InBytes()
	l := len(s)
	e := true // same chars

	for i := 0; i < len(s) / 2; i++ {
		if l > 1 {
			e = e && (s[i] == s[i+1])
		}

		if s[i] != s[l - i - 1] {
			// Not palindrome
			C.Out("%d\n", l)
			return
		}
	}

	// Palindrome
	if e {
		C.Out("0\n")
	} else {
		C.Out("%d\n", l - 1)
	}
}

func main() {
	c := NewSubmitContest()
	problem(c)
}


package main

import (
	"fmt"
	"math"
	"runtime/debug"
)

var (
	isNotPrime []bool
	primes     []int
	n          int
)

func main() {
	debug.SetGCPercent(-1)

	fmt.Scanf("%d", &n)
	// n = 20

	calcPrimes(n)

	left := getLowerBound(n)

	x0Lower := getLowerBound(left)

	for i := left + 1; i < n; i++ {
		x0Lower = min(x0Lower, getLowerBound(i))
	}

	fmt.Println(x0Lower)
}

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

	return b
}

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

	return b
}

func getLowerBound(n int) int {
	divider := findMaxPrimeDivider(n)

	return n - divider + 1
}

func findMaxPrimeDivider(x int) int {
	sqrtx := int(math.Sqrt(float64(x))) + 1

	for i := 0; i < len(primes) && primes[i] < sqrtx; i++ {
		if x%primes[i] == 0 {
			x /= primes[i]

			for isNotPrime[x] && x%primes[i] == 0 {
				x /= primes[i]
			}

			if !isNotPrime[x] {
				return x
			}
		}
	}

	return 1
}

func calcPrimes(n int) {
	isNotPrime = make([]bool, n+1)

	for i := 2; i*i <= n; i++ {
		if !isNotPrime[i] {
			for j := i * i; j <= n; j += i {
				isNotPrime[j] = true
			}
		}
	}

	primes = make([]int, 0, n/2)

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


package main

import (
	"fmt"
	"math"
	"runtime/debug"
)

type Range struct {
	left, right int
}

var (
	isNotPrime []bool
	primes     []int
	n          int
)

func main() {
	debug.SetGCPercent(-1)

	fmt.Scanf("%d", &n)
	// n = 1e6

	calcPrimes(n)

	x1Range := getRange(n)

	x0Range := getRange(x1Range.left)

	for i := x1Range.left + 1; i < x1Range.right; i++ {
		x0Range = joinRanges(x0Range, getRange(i))
	}

	fmt.Println(x0Range.left)
}

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

	return b
}

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

	return b
}

func joinRanges(r1, r2 Range) Range {
	left := min(r1.left, r2.left)

	right := max(r1.right, r2.right)

	return Range{left, right}
}

func getRange(n int) Range {
	divider := findMaxPrimeDivider(n)

	return Range{n - divider + 1, n}
}

func findMaxPrimeDivider(x int) int {
	sqrtx := int(math.Sqrt(float64(x))) + 1

	for i := 0; i < len(primes) && primes[i] < sqrtx; i++ {
		if x%primes[i] == 0 {
			x /= primes[i]

			for isNotPrime[x] && x%primes[i] == 0 {
				x /= primes[i]
			}

			if !isNotPrime[x] {
				return x
			}
		}
	}

	return 1
}

func calcPrimes(n int) {
	isNotPrime = make([]bool, n+1)

	for i := 2; i*i <= n; i++ {
		if !isNotPrime[i] {
			for j := i * i; j <= n; j += i {
				isNotPrime[j] = true
			}
		}
	}

	primes = make([]int, 0, n/2)

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


/*
URL:
https://codeforces.com/problemset/problem/923/A
*/

package main

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

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

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

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

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

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

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

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

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

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

var (
	x2 int
)

func main() {
	x2 = ReadInt()

	memo := TrialDivision(x2)
	maxi := 1
	for k := range memo {
		ChMax(&maxi, k)
	}

	l := x2 - maxi + 1
	r := x2

	_, P := sieve(x2)
	ans := INF_BIT30
	for _, p := range P {
		if p >= l {
			continue
		}

		q := Kiriage(l, p)
		val := p * q

		if l <= val && val <= r {
			ChMin(&ans, val-p+1)
		}
	}
	fmt.Println(ans)
}

// 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
}

// Kiriage returns Ceil(a/b)
// a >= 0, b > 0
func Kiriage(a, b int) int {
	return (a + (b - 1)) / b
}

// エラトステネスの篩: 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
}

// 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
}

// TrialDivision returns the result of prime factorization of integer N.
func TrialDivision(n int) map[int]int {
	var i, exp int
	p := map[int]int{}

	if n <= 1 {
		panic(errors.New("[argument error]: TrialDivision only accepts a NATURAL number"))
	}

	for i = 2; i*i <= n; i++ {
		exp = 0
		for n%i == 0 {
			exp++
			n /= i
		}

		if exp == 0 {
			continue
		}
		p[i] = exp
	}
	if n > 1 {
		p[n] = 1
	}

	return p
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	return res
}

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

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

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

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

	return string(res)
}

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

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

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

	return string(res)
}

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

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


package main

import (
	"fmt"
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func getMove(from, to int) int {
	if from > to {
		from, to = to, from
	}

	return min(to-from, from+10-to)
}

func main() {
	var n int
	fmt.Scanf("%d \n", &n)
	result := n
	for i := 1; i < n; i++ {
		result += i * (n - i)
	}
	fmt.Println(result)
}


package main
import (
    "fmt"
)
func main() {
    var n uint64
    fmt.Scan(&n)
    n = n*(n*n+5)/6
    fmt.Println(n)
}


package main

import (
	"fmt"
)

func buttons(n int64) (sum int64) {
	for i := int64(0); i < n - 1; i++ {
		sum += (n - i) + (n - i - 1) * i
	}
	return sum + 1
}

func main() {
	var n int64
	fmt.Scanf("%d", &n)
	fmt.Println(buttons(n))
}


package main

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

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

func main() {
	n := ScanInt64()

	ans := int64(n)
	for i := int64(2); i*i <= n; i++ {
		if n % i == 0 {
			ans = GCD(i, ans)
			ans = GCD(ans, n/i)
		}
	}

	fmt.Println(ans)

	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 (
	"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
	}

	// D := divisor(n)
	// if len(D) == 3 {
	// 	fmt.Println(D[2])
	// 	return
	// }
	memo := TrialDivision(n)
	if len(memo) == 1 {
		for k := range memo {
			fmt.Println(k)
			return
		}
	}

	fmt.Println(1)
}

// 約数の列挙: O(sqrt(n))
func divisor(n int64) []int64 {
	res := []int64{}

	for i := int64(1); i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i != (n / i) {
				res = append(res, (n / i))
			}
		}
	}

	return res
}

// TrialDivision returns the result of prime factorization of integer N.
func TrialDivision(n int64) map[int64]int {
	if n <= 1 {
		panic(errors.New("[argument error]: TrialDivision only accepts a NATURAL number"))
	}

	p := map[int64]int{}
	for i := int64(2); i*i <= n; i++ {
		exp := 0
		for n%i == 0 {
			exp++
			n /= i
		}

		if exp == 0 {
			continue
		}
		p[i] = exp
	}
	if n > 1 {
		p[n] = 1
	}

	return p
}

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

const GRID_SIZE = 3

type Grid [][]bool

func main() {
	grid := createSquareGrid(GRID_SIZE)
	for i := 0; i < GRID_SIZE; i++ {
		for j := 0; j < GRID_SIZE; j++ {
			var n int
			fmt.Fscan(os.Stdin, &n)
			grid.toggleNTimes(i, j, n)
		}
	}
	fmt.Print(grid)
}

func createSquareGrid(size int) Grid {
	grid := make(Grid, size)
	for rowIdx := range grid {
		grid[rowIdx] = make([]bool, size)
		for colIdx := range grid[rowIdx] {
			grid[rowIdx][colIdx] = true
		}
	}
	return grid
}

func (grid Grid) toggleNTimes(i, j, n int) {
	n = n % 2
	if (n > 0) {
		toggle := func(i, j int) { grid[i][j] = !grid[i][j] }
		toggle(i, j)
		if i > 0 { toggle(i-1, j) }
		if j > 0 { toggle(i, j-1) }
		if i < GRID_SIZE-1 { toggle(i+1, j) }
		if j < GRID_SIZE-1 { toggle(i, j+1) }
	}
}

func (grid Grid) String() string {
	var buffer bytes.Buffer
	for rowIdx := range grid {
		buffer.WriteString(boolAsString(grid[rowIdx][0]))
		for colIdx := 1; colIdx < len(grid[rowIdx]); colIdx++ {
			buffer.WriteString(boolAsString(grid[rowIdx][colIdx]))
		}
		buffer.WriteString("\n")
	}
	return buffer.String()
}

func boolAsString(b bool) string {
	if b { return "1" }
	return "0"
}


// 275A
package main

import (
	"fmt"
)

func main() {
	d := 3
	var s [3][3]int
	temp := 0
	for row := 0; row < d; row++ {
		for col := 0; col < d; col++ {
			fmt.Scan(&temp)
			s[row][col] += temp
			if row > 0 {
				s[row-1][col] += temp
			}
			if col > 0 {
				s[row][col-1] += temp
			}
			if row < d-1 {
				s[row+1][col] += temp
			}
			if col < d-1 {
				s[row][col+1] += temp
			}
		}
	}
	for row := 0; row < d; row++ {
		for col := 0; col < d; col++ {
			fmt.Printf("%d", (1+s[row][col])%2)
		}
		fmt.Println()
	}
}


package main

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

// github.com/EndlessCheng/codeforces-go
func run(in io.Reader, out io.Writer) {
	const mod int64 = 1e9 + 7
	f := func(n, m int) int64 {
		if m > n {
			return 0
		}
		res := int64(1)
		for i := 0; i < m; i++ {
			res = res * int64(n-i) % mod
		}
		return res
	}

	var n, x, pos, less, gr int
	Fscan(in, &n, &x, &pos)
	sort.Search(n, func(mid int) bool {
		if mid < pos {
			less++
		} else if mid > pos {
			gr++
		}
		return mid > pos
	})
	other := n - 1 - less - gr
	Fprint(out, f(x-1, less)*f(n-x, gr)%mod*f(other, other)%mod)
}

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


package main

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

func calc(m, l, x, n int64) int64 {
	if l > x-1 {
		return 0
	}
	if m > n-x {
		return 0
	}
	res := int64(1)
	magic := int64(1000000007)
	for i := int64(0); i < l; i++ {
		res = (res * (x - i - 1)) % magic
	}
	for i := int64(0); i < m; i++ {
		res = (res * (n - x - i)) % magic
	}
	for i := int64(1); i <= n-m-l-1; i++ {
		res = (res * i) % magic
	}
	return res
}

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

	var n, x, pos int64

	fmt.Fscan(io, &n, &x, &pos)

	m := int64(0)
	l := int64(0)

	left := int64(0)
	right := n
	median := int64(0)
	for left < right {
		median = (left + right) / 2
		if median > pos {
			right = median
			m++
		} else if median < pos {
			left = median + 1
			l++
		} else if median == pos {
			left = median + 1
		}
	}

	fmt.Print(calc(m, l, x, n))
}


package main

import (
	. "fmt"
	"sort"
)

// github.com/EndlessCheng/codeforces-go
const mod int64 = 1e9 + 7
func A(n, m int) int64 {
	if m > n { return 0 }
	x := int64(1)
	for i := 0; i < m; i++ {
		x = x * int64(n-i) % mod
	}
	return x
}
func main() {
	var n, x, p, l, g int
	Scan(&n, &x, &p)
	sort.Search(n, func(m int) bool {
		if m < p {l++} else if m > p {g++}
		return m > p
	})
	m:=n-1-l-g
	Print(A(x-1,l)*A(n-x,g)%mod*A(m,m)%mod)
}


package main

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

func main() {
	var s string
	fmt.Scanf("%s", &s)
	for minute := 0; ; minute++ {
		if isPalinrom(s) {
			fmt.Println(minute)
			break
		}
		s = inc(s)
	}
}

func inc(s string) string {
	ele := strings.Split(s, ":")
	minute, _ := strconv.Atoi(ele[1])
	hour, _ := strconv.Atoi(ele[0])
	if minute == 59 {
		hour++
		if hour == 24 {
			hour = 0
		}
		minute = 0
	} else {
		minute++
	}
	return fmt.Sprintf("%02d:%02d", hour, minute)
}

func isPalinrom(s string) bool {
	for i:= 0; i < len(s) / 2; i++ {
		if(s[i] != s[len(s)-i-1]) {
			return false
		}
	}
	return true
}


package main

import "fmt"

func main() {
	var H, M int
	fmt.Scanf("%d:%d %d", &H, &M)
	count := 0
	for {
		s := fmt.Sprintf("%02d%02d", H, M)
		same := true
		for i := 0; i <= len(s)/2; i++ {
			if s[i] != s[len(s)-i-1] {
				same = false
				break
			}
		}
		if same {
			break
		}
		count++
		M++
		if M == 60 {
			M = 0
			H++
			if H == 24 {
				H = 0
			}
		}
	}
	fmt.Println(count)

}


package main

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

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

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

func getLine() string {
	s, _ := reader.ReadString('\n')
	if strings.HasSuffix(s, "\r\n") {
		s = s[:len(s)-2]
	} else if strings.HasSuffix(s, "\n") {
		s = s[:len(s)-1]
	}
	return s
}
func getLine2Int() (n int) {
	scanf("%d\n", &n)
	return
}
func getLine2Int2() (a, b int) {
	scanf("%d %d\n", &a, &b)
	return
}
func getLine2Ints(n int) []int {
	ans := make([]int, n)
	for i := 0; i < n; i++ {
		scanf("%d ", &ans[i])
	}
	scanf("%d\n", &ans[n-1])
	return ans
}

func pcheck(i bool) {
	if i {
		printf("YES\n")
	} else {
		printf("NO\n")
	}
}

var debug = true

func see(a interface{}) {
	if debug {
		printf("DEBUG:%v\n", a)
	}
}

func main() {
	defer writer.Flush()

	var hh, mm int
	scanf("%d:%d\n", &hh, &mm)
	for i := 0; i < 24*60; i++ {
		htom := hh%10*10 + hh/10
		if htom == mm {
			printf("%d\n", i)
			return
		}
		mm = (mm + 1) % 60
		if mm == 0 {
			hh = (hh + 1) % 24
		}
	}
}


package main

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

func solve(k, a, b int64) int64 {
	a0 := a / k
	b0 := b / k
	if a - a0 * k > b0 * (k - 1) {
		return -1
	}
	if b - b0 * k > a0 * (k - 1) {
		return -1
	}
	return a0 + b0
}

func main() {
	r := bufio.NewReaderSize(os.Stdin, 1<<16)
	s, _, _ := r.ReadLine()
	ss := bytes.SplitN(s, []byte{' '}, 3)
	k, _ := strconv.ParseInt(string(ss[0]), 10, 32)
	a, _ := strconv.ParseInt(string(ss[1]), 10, 32)
	b, _ := strconv.ParseInt(string(ss[2]), 10, 32)
	fmt.Printf("%d\n", solve(k, a, b))
}


package main

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

func solve(k, a, b int64) int64 {
	a0 := a / k
	b0 := b / k
	if a - a0 * k > b0 * (k - 1) {
		return -1
	}
	if b - b0 * k > a0 * (k - 1) {
		return -1
	}
	return a0 + b0
}

func main() {
	cin := NewParser(bufio.NewReaderSize(os.Stdin, 1<<16))
	k := cin.nextInt64()
	a := cin.nextInt64()
	b := cin.nextInt64()
	fmt.Printf("%d\n", solve(k, a, b))
}

type ParserReader struct {
	r   io.ByteReader
	err error
	c   byte
}

func NewParser(r io.ByteReader) *ParserReader {
	return &ParserReader{r, nil, 0}
}

func (p *ParserReader) next() error {
	p.c, p.err = p.r.ReadByte()
	return p.err
}

func isDigit(c byte) bool {
	return '0' <= c && c <= '9'
}

func (p *ParserReader) nextUInt64() uint64 {
	for !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var r uint64
	for isDigit(p.c) && p.err == nil {
		r = r*10 + uint64(p.c - '0')
		p.next()
	}
	return r
}

func (p *ParserReader) nextUInt() uint {
	for !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var r uint
	for isDigit(p.c) && p.err == nil {
		r = r*10 + uint(p.c - '0')
		p.next()
	}
	return r
}

func (p *ParserReader) nextInt64() int64 {
	for p.c != '-' && !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var sign bool
	if p.c == '-' {
		sign = true
	}
	r := int64(p.nextUInt64())
	if sign {
		return -r
	}
	return r
}

func (p *ParserReader) nextInt() int {
	for p.c != '-' && !isDigit(p.c) && p.err == nil {
		p.next()
	}
	var sign bool
	if p.c == '-' {
		sign = true
	}
	r := int(p.nextUInt())
	if sign {
		return -r
	}
	return r
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1558B(in io.Reader, out io.Writer) {
	var n, m int
	Fscan(in, &n, &m)
	c := make([]int, n*2+2)
	c[n] = 1
	for i := n - 1; i > 0; i-- {
		c[i] = 2 * c[i+1] % m
		for j := 2; j*i <= n; j++ {
			c[i] = (c[i] + (c[i*j]+m-c[(i+1)*j])%m) % m
		}
	}
	Fprint(out, ((c[1]-c[2])%m+m)%m)
}

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


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1558B(in io.Reader, out io.Writer) {
	var n, m int
	Fscan(in, &n, &m)
	f := make([]int, n+2)
	f[n] = 1
	for i := n - 1; i > 0; i-- {
		f[i] = f[i+1] * 2 % m
		for j := 2; j*i <= n; j++ {
			f[i] = (f[i] + (f[i*j]-f[min((i+1)*j, n+1)]+m)%m) % m
		}
	}
	Fprint(out, (f[1]-f[2]+m)%m)
}

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

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


package main

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

// github.com/EndlessCheng/codeforces-go
func CF533C(in io.Reader, out io.Writer) {
	max := func(a, b int) int {
		if a > b {
			return a
		}
		return b
	}
	var x1, y1, x2, y2 int
	Fscan(in, &x1, &y1, &x2, &y2)
	if x1+y1 <= max(x2, y2) || x1 <= x2 && y1 <= y2 {
		Fprint(out, "Polycarp")
	} else {
		Fprint(out, "Vasiliy")
	}
}

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


package main

import "fmt"

func main() {
    var k int
    var s string
    var p [10]int
    fmt.Scan(&k)
    for i := 0; i < 4; i++ {
        fmt.Scan(&s)
        for _, v := range s {
            if v != '.' { p[v-'0']++ }
        }
    }
    ans := true
    for i := 0; i < 10; i++ {
        if p[i] > (2*k) { ans = false; break }
    }
    if ans { fmt.Println("YES") } else { fmt.Println("NO") }
}


package main

import "fmt"

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

	dict := map[rune]int{}
	for i := 0; i < 4; i++ {
		var line string
		fmt.Scan(&line)
		for _, char := range line {
			dict[char]++
		}
	}

	for i := '0'; i <= '9'; i++ {
		if dict[i] > k*2 {
			fmt.Print("NO")
			return
		}
	}

	fmt.Print("YES")
}


// 373A-mic
package main

import (
    "fmt"
)

func main() {
    var c, o, tw, th, fo, fi, si, se, ei, ni, k int
    var str string
    fmt.Scan(&k)
    c = 2 * k
    for i := 0; i < 4; i++ {
        fmt.Scan(&str)
        for j := 0; j < 4; j++ {
            if str[j] == '1' {
                o++
            } else if str[j] == '2' {
                tw++
            } else if str[j] == '3' {
                th++
            } else if str[j] == '4' {
                fo++
            } else if str[j] == '5' {
                fi++
            } else if str[j] == '6' {
                si++
            } else if str[j] == '7' {
                se++
            } else if str[j] == '8' {
                ei++
            } else if str[j] == '9' {
                ni++
            }
        }
    }
    if (o > c) || (tw > c) || (th > c) || (fo > c) || (fi > c) || (si > c) || (se > c) || (ei > c) || (ni > c) {
        fmt.Println("NO")
        return
    }
    fmt.Println("YES")
}


package main

import "fmt"

func main() {
    var a,b,c int
    fmt.Scan(&a,&b,&c)
    fmt.Println((a*b)+((c-1)*a)+((b-1)*(c-1)))
}


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

func main() {
	var a,b,c,d int
	fmt.Scan(&a,&b,&c)
	d=c*b+(a-1)*b+(c-1)*(a-1)
	fmt.Println(d)
}


// 216A-mic
package main

import (
    "fmt"
)

func main() {
    var a, b, c, x int
    fmt.Scan(&a, &b, &c)
    x = (b - 1) * (c - 1)
    x += a * (b + c - 1)
    fmt.Println(x)

}


package main

import ("fmt"
	"sync"

	"math"
)

type changer func(int64) (int64, int)

var min struct {
  	mt sync.RWMutex
	data int
}

func decision(p int64, x int64, y int64,  f changer, wg* sync.WaitGroup )  {
	defer wg.Done()
	s := x
	randomizer := func() bool{
		i := (s / 50) % 475
		for j:=0 ; j< 25; j++ {
			i = (i * 96 + 42) % 475
			if 26+i == p {
				return true
			}
		}
		return false
	}
	cur := 0
	flag := true
	for;flag;{
		if randomizer() {
			min.mt.Lock()
			if min.data > cur {
				min.data = cur
			}
			min.mt.Unlock()
			return
		}
		min.mt.RLock()
		if min.data < cur {
			flag = false
		} else {
			var dt int
			s, dt  = f(s)
			cur += dt
		}
		min.mt.RUnlock()
		if y>s{
			flag = false
		}
	}
}

func decision_starter(p int64, x int64, y int64,  f changer, wg* sync.WaitGroup) {
	wg.Add(1)
	decision(p,x,y,f,wg)
}

func main()  {
	strat1 := func(num int64)(int64,int) {
		num+=100
		return num,1
	}
	strat2 := func(num int64)(int64,int) {
		num-=50
		return num,0
	}
	flag := true
	strat3 := func(num int64)(int64,int) {
		if flag {
			num+=50
			flag = false
			return num,1
		}

		num+=100
		return num,1
	}
	var p,x,y int64
	wg := sync.WaitGroup{}
	fmt.Scanf("%d %d %d",&p,&x,&y)
	//26 7258 6123
	//p = 26
	//x = 7258
	//y = 6123
	min.data = math.MaxInt32
	decision_starter(p,x,y,strat1,&wg)
	decision_starter(p,x,y,strat2,&wg)
	decision_starter(p,x,y,strat3,&wg)
	wg.Wait()
	min.mt.RLock()
	fmt.Printf("%d ",min.data)
	min.mt.RUnlock()
}


package main

import ("fmt"
	"sync"

	"math"
)

type changer func(int64) (int64, int)

var min struct {
  	mt sync.RWMutex
	data int
}

func decision(p int64, x int64, y int64,  f changer, wg* sync.WaitGroup )  {
	defer wg.Done()
	s := x
	randomizer := func() bool{
		i := (s / 50) % 475
		for j:=0 ; j< 25; j++ {
			i = (i * 96 + 42) % 475
			if 26+i == p {
				return true
			}
		}
		return false
	}
	cur := 0
	flag := true
	for;flag;{
		if randomizer() {
			min.mt.Lock()
			if min.data > cur {
				min.data = cur
			}
			min.mt.Unlock()
			return
		}
		min.mt.RLock()
		if min.data < cur {
			flag = false
		} else {
			var dt int
			s, dt  = f(s)
			cur += dt
		}
		min.mt.RUnlock()
		if y>s{
			flag = false
		}
	}
}

func decision_starter(p int64, x int64, y int64,  f changer, wg* sync.WaitGroup) {
	wg.Add(1)
	go decision(p,x,y,f,wg)
}

func main()  {
	strat1 := func(num int64)(int64,int) {
		num+=100
		return num,1
	}
	strat2 := func(num int64)(int64,int) {
		num-=50
		return num,0
	}
	flag := true
	strat3 := func(num int64)(int64,int) {
		if flag {
			num+=50
			flag = false
			return num,1
		}

		num+=100
		return num,1
	}
	var p,x,y int64
	wg := sync.WaitGroup{}
	fmt.Scanf("%d %d %d",&p,&x,&y)
	//26 7258 6123
	//p = 26
	//x = 7258
	//y = 6123
	min.data = math.MaxInt32
	decision_starter(p,x,y,strat1,&wg)
	decision_starter(p,x,y,strat2,&wg)
	decision_starter(p,x,y,strat3,&wg)
	wg.Wait()
	min.mt.RLock()
	fmt.Printf("%d ",min.data)
	min.mt.RUnlock()
}


package main

import "fmt"

var p, x, y int

func check(nowx int) bool {
	i := (nowx / 50) % 475
	for j := 0; j < 25; j++ {
		i = (i*96 + 42) % 475
		if i+26 == p {
			return true
		}
	}
	return false
}

func main() {
	fmt.Scan(&p)
	fmt.Scan(&x)
	fmt.Scan(&y)

	var ansa int

	for nowx := y/50*50 + x%50; ; nowx += 50 {
		for nowx < y {
			nowx += 50
		}
		if check(nowx) {
			ansa = (nowx - x) / 100
			if (nowx-x)%100 != 0 {
				ansa++
			}
			if nowx <= x {
				ansa = 0
			}
			fmt.Println(ansa)
			break
		}
	}
}


package main

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

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

	var n, m int
	Fscan(in, &n, &m)
	edges := make([][]int, n+1)
	shown := map[int]int{}
	for i := 0; i < m; i++ {
		var v, w int
		Fscan(in, &v, &w)
		edges[v] = append(edges[v], w)
		edges[w] = append(edges[w], v)
		shown[v] = 1
		shown[w] = 1
	}
	if len(shown) <= 6 {
		Fprintln(out, m)
		return
	}

	ans := 0
	for v, e := range edges {
		if len(e) == 0 {
			continue
		}
		for w, e2 := range edges {
			if w == v || len(e2) == 0 {
				continue
			}
			delta := 0
			for _, u := range e2 {
				if u == v {
					delta = 1
					break
				}
			}
			mp := map[int]int{}
			for _, u := range append(e, e2...) {
				if u == v {
					u = w
				}
				mp[u] = 1
			}
			delta = len(e) + len(e2) - delta - len(mp)
			if newAns := m - delta; newAns > ans {
				ans = newAns
			}
		}
	}
	Fprintln(out, ans)
}

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


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
}

// DigitSum returns digit sum of a decimal number.
// DigitSum only accept a positive integer.
func DigitSum(n int) int {
	if n < 0 {
		return -1
	}

	res := 0

	for n > 0 {
		res += n % 10
		n /= 10
	}

	return res
}

// DigitNumOfDecimal returns digits number of n.
// n is non negative number.
func DigitNumOfDecimal(n int) int {
	res := 0

	for n > 0 {
		n /= 10
		res++
	}

	return res
}

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

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

	return s
}

// Kiriage returns Ceil(a/b)
// a >= 0, b > 0
func Kiriage(a, b int) int {
	return (a + (b - 1)) / b
}

// 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, m int

var ans int
var edges []Edge

type Edge struct {
	s, t int
}

func main() {
	n, m = ReadInt2()
	for i := 0; i < m; i++ {
		s, t := ReadInt2()
		s--
		t--
		edges = append(edges, Edge{s, t})
	}

	v := []int{}
	dfs(v)
	fmt.Println(ans)
}

func dfs(v []int) {
	if len(v) == n {
		A := [6][6]int{}
		for i := 0; i < 6; i++ {
			for j := 0; j < 6; j++ {
				A[i][j] = 1
			}
		}

		cnt := 0
		for _, e := range edges {
			l, r := v[e.s], v[e.t]
			if A[l][r] == 1 {
				A[l][r], A[r][l] = 0, 0
				cnt++
			}
		}
		ChMax(&ans, cnt)
	} else {
		for i := 0; i <= 5; i++ {
			tmp := CopySlice(v)
			tmp = append(tmp, i)
			dfs(tmp)
		}
	}
}

func CopySlice(v []int) []int {
	res := make([]int, len(v))
	for i := 0; i < len(v); i++ {
		res[i] = v[i]
	}
	return res
}

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

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


// Author: sighduck
// URL: https://codeforces.com/contest/1230/problem/C

package main

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

type Edge struct {
	A int
	B int
}

func createMatrix(n int, m int, edges []Edge) [][]bool {
	matrix := make([][]bool, n)
	for i := 0; i < n; i++ {
		matrix[i] = make([]bool, n)
	}
	for _, edge := range edges {
		matrix[edge.A-1][edge.B-1] = true
		matrix[edge.B-1][edge.A-1] = true
	}
	return matrix
}

func Solve(n int, m int, edges []Edge) int {
	if n < 7 {
		return m
	}
	matrix := createMatrix(n, m, edges)
	minMutualNeighbors := n + 1
	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			mutualNeighbors := 0
			for z := 0; z < n; z++ {
				if z != i && z != j && matrix[i][z] && matrix[j][z] {
					mutualNeighbors += 1
				}
			}
			if mutualNeighbors < minMutualNeighbors {
				minMutualNeighbors = mutualNeighbors
			}
		}
	}
	return m - minMutualNeighbors
}

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

	var n, m int
	fmt.Fscanf(reader, "%d %d\n", &n, &m)
	edges := make([]Edge, m)
	for i := 0; i < m; i++ {
		fmt.Fscanf(reader, "%d %d\n", &edges[i].A, &edges[i].B)
	}

	fmt.Fprintf(writer, "%d\n", Solve(n, m, edges))
}


package main

import (

    "fmt"

    "sort"

)

func main() {

    var n int

    fmt.Scan(&n)

    a := make([]int,n)

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

    sort.Ints(a)

    fmt.Print(a[n-1]," ")

    for i := 1; i < (n-1); i++ {
        fmt.Print(a[i]," ")
    }

    fmt.Println(a[0])

}


package main

import (

	"fmt"

	"sort"

)

func main() {

	var n int

	fmt.Scan(&n)

	a := make([]int,n)

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

	sort.Ints(a)

	fmt.Print(a[n-1]," ")

	for i := 1; i < (n-1); i++ {
		fmt.Print(a[i]," ")
	}

	fmt.Println(a[0])

}


package main

import (
    "fmt"
    "sort"
)

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


package main

import "fmt"

const MOD = int64(1e9 + 7)

var (
	k   int64
	n   int64
	inv [100]int64
)

func qpow(x, k int64) int64 {
	var y int64 = 1
	for k > 0 {
		if k%2 > 0 {
			y = y * x % MOD
		}
		k >>= 1
		x = x * x % MOD
	}
	return y
}
func solve(x int64, cnt int64) int64 {
	dp := [10001][60]int64{}
	s := int64(1)
	for i := int64(0); i <= cnt; i++ {
		dp[0][i] = s
		s = s * x % MOD
	}
	for i := int64(1); i <= k; i++ {
		var s int64 = 0
		for j := int64(0); j <= cnt; j++ {
			s += dp[i-1][j]
			if s >= MOD {
				s -= MOD
			}
			dp[i][j] = s * inv[j+1] % MOD
		}
	}
	return dp[k][cnt]
}

func main() {
	for i := int64(1); i < 100; i++ {
		inv[i] = qpow(i, MOD-2)
	}
	fmt.Scanln(&n, &k)
	var ans int64 = 1
	for i := int64(2); i*i <= n; i++ {
		var c int64 = 0
		for n%i == 0 {
			c++
			n /= i
		}
		if c > 0 {
			ans = ans * solve(i, c) % MOD
		}
	}
	if n > 1 {
		ans = ans * solve(n, 1) % MOD
	}
	fmt.Println(ans)
}


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 {
		m := 2 * max
		k = k - (max - min)
		k = (k / 2) * 2
		return m + k
	}
}
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 (
	"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 {
		res += a
	} else {
		res += (a + r - l) / 2
	}

	res *= 2
	fmt.Println(res)
}


package main

import "fmt"

func main() {
	var l, r, a, max, min, rem int
	fmt.Scanf("%d %d %d", &l, &r, &a)
	if l < r {
		min = l
		max = r
	} else {
		min = r
		max = l
	}
	rem = max - min
	if rem >= a {
		min = min + a
	} else {
		min = min + rem
		a = a - rem
		if a%2 == 0 {
			min = min + (a / 2)
		} else {
			min = min + ((a - 1) / 2)
		}
	}
	fmt.Println(min * 2)
}


package main

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

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

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

	var la, ra, ta, lb, rb, tb int64
	fmt.Fscanf(reader, "%d %d %d\n", &la, &ra, &ta)
	fmt.Fscanf(reader, "%d %d %d", &lb, &rb, &tb)

	factor := gcd(ta, tb)

	var ans1, ans2 int64

	// Bob first, Alice after
	// (la - lb) + (ka * ta) - (kb * tb) = diff > 0
	diff1 := (la - lb) % factor
	if diff1 < 0 {
		diff1 += factor
	}
	if rb - lb + 1 < diff1 {
		ans1 = 0
	} else if rb - lb + 1 > diff1 + (ra - la + 1) {
		ans1 = ra - la + 1
	} else {
		ans1 = rb - lb + 1 - diff1
	}

	diff2 := (lb - la) % factor
	if diff2 < 0 {
		diff2 += factor
	}
	if ra - la + 1 < diff2 {
		ans2 = 0
	} else if ra - la + 1 > diff2 + (rb - lb + 1) {
		ans2 = rb - lb + 1
	} else {
		ans2 = ra - la + 1 - diff2
	}
	if ans1 > ans2 {
		fmt.Printf("%d", ans1)
	} else {
		fmt.Printf("%d", ans2)
	}

}


package main

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

func count(K int) int {
	a := 0
	for K > 0 {
		a += K % 10
		K /= 10
	}
	return a
}

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	p := 10
	for cnt := 0; cnt < N; {
		p += 9

		if count(p) == 10 {
			cnt++
		}

	}
	fmt.Println(p)
}

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 digitCnt(n int) int {
    d := 0
    for n > 0 {
        d += n % 10
        n /= 10
    }
    return d
}

func main() {
    var k int
    fmt.Scan(&k)
    i := 0
    answer := 0
    for i < k {
        answer += 1
        if digitCnt(answer) == 10 {
            i++
        }
    }
    fmt.Print(answer)
}


package main

import "fmt"

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

func div(n *int, d int) int {
	ans := 0
	for (*n) % d == 0 {
		(*n) /= d
		ans += 1
	}
	return ans
}

func main() {
	var a, b int
	fmt.Scanf("%d %d\n", &a, &b)
	a2 := div(&a, 2)
	a3 := div(&a, 3)
	a5 := div(&a, 5)
	b2 := div(&b, 2)
	b3 := div(&b, 3)
	b5 := div(&b, 5)
	ans := abs(a2 - b2) + abs(a3 - b3) + abs(a5 - b5)
	if a != b {
		ans = -1
	}
	fmt.Println(ans)
}


//371B
package main
import (
	"fmt"
	"math"
)

func main() {
	var a, b, c, d int
	var i, j, k, l, m, n, x float64
	fmt.Scan(&a, &b)
	for a!=0 {
		if a%2==0 {
			a=a/2
			i++
		} else if a%3==0 {
			a=a-(a/3*2)
			j++
		} else if a%5==0 {
			a=a-(a/5*4)
			k++
		} else {
			c=a
			break
		}
	}
	for b!=0 {
		if b%2==0 {
			b=b/2
			l++
		} else if b%3==0 {
			b=b-(b/3*2)
			m++
		} else if b%5==0 {
			b=b-(b/5*4)
			n++
		} else {
			d=b
			break
		}
	}
	if c==d {
		x=math.Abs(i-l)+math.Abs(j-m)+math.Abs(k-n)
		fmt.Println(x)
	} else {
		fmt.Println("-1")
	}
}


// 371B-mic
package main

import (
	"fmt"
)

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

func main() {
	var a, b, k int
	fmt.Scan(&a, &b)
	x := gcd(a, b)
	if x != 1 {
		a /= x
		b /= x
	}
	for {
		if a == b {
			break
		}
		if a < b {
			a, b = b, a
		} else if a > b && a%2 != 0 && a%3 != 0 && a%5 != 0 {
			b, a = a, b
		}
		if a%2 != 0 && a%3 != 0 && a%5 != 0 && b%2 != 0 && b%3 != 0 && b%5 != 0 {
			fmt.Println("-1")
			return
		}
		if a%2 == 0 {
			a /= 2
			k++
		} else if a%3 == 0 {
			a /= 3
			k++
		} else if a%5 == 0 {
			a /= 5
			k++
		}
	}
	fmt.Println(k)
}


package main

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

func main(){
	var s,v1,v2,t1,t2 int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&s,&v1,&v2,&t1,&t2)
	a1 := 2*t1+s*v1
	a2 := 2*t2+s*v2
	if a1<a2{
		fmt.Println("First")
	}else if a2<a1{
		fmt.Println("Second")
	}else{
		fmt.Println("Friendship")
	}
}


package main

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

func receiver(character int64, velocity int64, delay int64) int64 {
	timeSpeed := character * velocity
	totalTimeDelay := 2 * delay
	return timeSpeed + totalTimeDelay
}

func compareTimeConsume(receiver1 int64, receiver2 int64) string {
	if receiver1 < receiver2 {
		return "First"
	} else if receiver1 > receiver2 {
		return "Second"
	} else {
		return "Friendship"
	}
}

func arrInput(numbers []string) string {
	character, err := strconv.ParseInt(numbers[0], 10, 64)
	if err != nil {
		panic(err)
	}

	velocity1, err := strconv.ParseInt(numbers[1], 10, 64)
	if err != nil {
		panic(err)
	}

	velocity2, err := strconv.ParseInt(numbers[2], 10, 64)
	if err != nil {
		panic(err)
	}

	delay1, err := strconv.ParseInt(numbers[3], 10, 64)
	if err != nil {
		panic(err)
	}

	delay2, err := strconv.ParseInt(numbers[4], 10, 64)
	if err != nil {
		panic(err)
	}

	receiver1 := receiver(character, velocity1, delay1)
	receiver2 := receiver(character, velocity2, delay2)
	return compareTimeConsume(receiver1, receiver2)
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _ := reader.ReadString('\n')
	numbers := strings.Fields(text)
	fmt.Println(arrInput(numbers))
}


// A. Key races
/*
Two boys decided to compete in text typing on the site "Key races". During the competition, they have to type a text consisting of s characters. The first participant types one character in v1 milliseconds and has ping t1 milliseconds. The second participant types one character in v2 milliseconds and has ping t2 milliseconds.

If connection ping (delay) is t milliseconds, the competition passes for a participant as follows:

    Exactly after t milliseconds after the start of the competition the participant receives the text to be entered.
    Right after that he starts to type it.
    Exactly t milliseconds after he ends typing all the text, the site receives information about it.

The winner is the participant whose information on the success comes earlier. If the information comes from both participants at the same time, it is considered that there is a draw.

Given the length of the text and the information about participants, determine the result of the game.

Input
The first line contains five integers s, v1, v2, t1, t2 (1 ≤ s, v1, v2, t1, t2 ≤ 1000) — the number of characters in the text, the time of typing one character for the first participant, the time of typing one character for the the second participant, the ping of the first participant and the ping of the second participant.

Output
If the first participant wins, print "First". If the second participant wins, print "Second". In case of a draw print "Friendship".

Examples
Input
5 1 2 1 2

Output
First

Input
3 3 1 1 1

Output
Second

Input
4 5 3 1 5

Output
Friendship

Note
In the first example, information on the success of the first participant comes in 7 milliseconds, of the second participant — in 14 milliseconds. So, the first wins.

In the second example, information on the success of the first participant comes in 11 milliseconds, of the second participant — in 5 milliseconds. So, the second wins.

In the third example, information on the success of the first participant comes in 22 milliseconds, of the second participant — in 22 milliseconds. So, it is be a draw.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	n := strings.Split(strings.TrimSpace(input), " ")

	s, _ := strconv.Atoi(string(n[0]))
	v1, _ := strconv.Atoi(string(n[1]))
	v2, _ := strconv.Atoi(string(n[2]))
	t1, _ := strconv.Atoi(string(n[3]))
	t2, _ := strconv.Atoi(string(n[4]))

	v1Total := (s * v1) + (t1 * 2)
	v2Total := (s * v2) + (t2 * 2)

	if v1Total < v2Total {
		fmt.Println("First")
	} else if v2Total < v1Total {
		fmt.Println("Second")
	} else {
		fmt.Println("Friendship")
	}
}


package main

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

func Init() {
}

func Solve(io *FastIO) {
	X := io.NextInt()
	Y := io.NextInt()

	if Y < 1 {
	  io.Println("No")
	  return
	}

	if (Y == 1) {
	  if (X == 0) {
	    io.Println("Yes")
	  } else {
	    io.Println("No")
	  }
	  return
	}

	if Y <= X + 1 && (X + Y) % 2 == 1 {
	  io.Println("Yes")
	} else {
	  io.Println("No")
	}
}

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) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

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

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


package main

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

func fastRead(reader *bufio.Reader) (i int, j int) {
	var c rune
	c, _, _ = reader.ReadRune()

	//space = 32
	//space and between 0-9
	for c != 32 && c > 47 && c < 58 {
		//x = x*10+c
		i = (i << 1) + (i << 3) + int(c) - 48
		c, _, _ = reader.ReadRune()
	}

	c, _, _ = reader.ReadRune()
	//newline = 10
	for c != 10 && c > 47 && c < 58 {
		//x = x*10+c
		j = (j << 1) + (j << 3) + int(c) - 48
		c, _, _ = reader.ReadRune()
	}

	return
}

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

	var x, y = fastRead(reader)

	if y <= 0 || (x%2 == 0 && y%2 == 0) {
		fmt.Println("No")
		return
	}

	var x2 = x - (y - 1)
	/*for x1 < x {
		x1 += 2
	}*/

	if x2 < 0 || y <= 1 && x > 0 || x2%2 == 1 {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}


package main

import (
	"fmt"
)

func main() {
	var x, y int64
	fmt.Scan(&x, &y)
	cal := x - (y - 1)
	if x == 0 && y == 1 {
		fmt.Printf("yes")
	} else if x == 1 && y == 0 {
		fmt.Printf("no")
	} else if cal%2 == 0 && cal > 0 && y-1 > 0 {
		fmt.Printf("yes")
	} else if cal <= 0 && y-1 == x {
		fmt.Printf("yes")
	} else {
		fmt.Printf("no")
	}

}


package main

import (
	"fmt"
)

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

	xys := [2][2]int{}
	xyc := [2]int{}

	for i := 0; i < n; i++ {
		var xy [2]int
		if _, err := fmt.Scanf("%d %d\n", &xy[0], &xy[1]); err != nil {
			return
		}
		for j := 0; j < 2; j++ {
			if xyc[j] == 0 {
				xys[j][0] = xy[j]
				xyc[j] += 1
			} else if xys[j][0] != xy[j] {
				xys[j][1] = xy[j]
				xyc[j] += 1
			}
		}
	}

	if xyc[0] < 2 || xyc[1] < 2 {
		fmt.Println(-1)
	} else {
		fmt.Println(abs(xys[0][0]-xys[0][1]) * abs(xys[1][0]-xys[1][1]))
	}
}

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


package main

import "fmt"

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

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

func min3(a, b, c int) int {
    return min(a, min(b, c))
}

func max3(a, b, c int) int {
    return max(a, max(b, c))
}

func min4(a, b, c, d int) int {
    return min(a, min(b, min(c, d)))
}

func max4(a, b, c, d int) int {
    return max(a, max(b, max(c, d)))
}

func abs(a int) int {
    return max(a, -a)
}

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

    var x, y [4]int
    for i := 0; i < n; i++ {
        fmt.Scan(&x[i], &y[i])
    }

    if n == 1  || (n == 2 && (x[0] == x[1] || y[0] == y[1])){
        fmt.Println(-1)
    } else if n == 2 {
        a := (min(x[0], x[1])-max(x[0], x[1])) * (min(y[0], y[1])-max(y[0], y[1]))
        fmt.Println(abs(a))
    } else if n == 3 {
        a := (min3(x[0], x[1], x[2])-max3(x[0], x[1], x[2])) * (min3(y[0], y[1], y[2])-max3(y[0], y[1], y[2]))
        fmt.Println(abs(a))
    } else {
        a := (min4(x[0], x[1], x[2], x[3])-max4(x[0], x[1], x[2], x[3])) * (min4(y[0], y[1], y[2], y[3])-max4(y[0], y[1], y[2], y[3]))
        fmt.Println(abs(a))
    }
}


// 66A
package main

import (
	"fmt"
)

func main() {
	var x string
	fmt.Scan(&x)
	if len(x) < 3 || (len(x) == 3 && x <= "127") {
		fmt.Print("byte")
	} else if len(x) < 5 || (len(x) == 5 && x <= "32767") {
		fmt.Print("short")
	} else if len(x) < 10 || (len(x) == 10 && x <= "2147483647") {
		fmt.Print("int")
	} else if len(x) < 19 || (len(x) == 19 && x <= "9223372036854775807") {
		fmt.Print("long")
	} else {
		fmt.Print("BigInteger")
	}
}


package main

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

func main(){
	var n string
	r := bufio.NewScanner(os.Stdin)
	r.Split(bufio.ScanWords)
	w := bufio.NewWriter(os.Stdout)
	r.Scan()
	n = r.Text()
	l := len(n)
	if l < 3 || (l == 3 && n < "128") {
		w.WriteString("byte")
	} else if l < 5 || (l == 5 && n < "32768") {
		w.WriteString("short")
	} else if l < 10 || (l == 10 && n < "2147483648") {
		w.WriteString("int")
	} else if l < 19 || (l == 19 && n < "9223372036854775808") {
		w.WriteString("long")
	} else {
		w.WriteString("BigInteger")
	}
	w.WriteString("\n")
	w.Flush()
}


package main

import (
	"fmt"
)

func main() {
	var x string
	fmt.Scan(&x)
	if len(x) < 3 || (len(x) == 3 && x <= "127") {
		fmt.Print("byte")
	} else if len(x) < 5 || (len(x) == 5 && x <= "32767") {
		fmt.Print("short")
	} else if len(x) < 10 || (len(x) == 10 && x <= "2147483647") {
		fmt.Print("int")
	} else if len(x) < 19 || (len(x) == 19 && x <= "9223372036854775807") {
		fmt.Print("long")
	} else {
		fmt.Print("BigInteger")
	}
}


package main

import "fmt"

import "math"
import "bytes"
import "io"
import "os"

//import "strings"

var dbg = false

func factorize(N, K int64) int64 {

	var U int64 = int64(math.Sqrt(float64(N)))
	//var U int64 = Sqrt(N)

	var k int64 = 1

	var i int64 = 1

	var d int64 = -1

	for {

		if N%i == 0 {

			d = i
			if dbg {
				fmt.Println("U, N, d, i, k, K", U, N, d, i, k, K)
			}
			if k == K {
				return d
			}

			k++

		}

		i = i + 1

		if i > U {
			break
		}

	}

	for {

		if N%i == 0 {

			d1 := N / i

			if d1 != d {

				d = d1

				if dbg {
					fmt.Println("U, N, d, i, k, K", U, N, d, i, k, K)
				}

				if k == K {
					return d
				}

				k++
			}

		}

		i = i - 1
		if i < 1 {
			d = -1
			break
		}

	}

	return d
}

func solve() {
	var input bytes.Buffer

	io.Copy(&input, os.Stdin)

	var N, K int64 = 0, 0
	fmt.Fscanf(&input, "%d", &N)
	fmt.Fscanf(&input, "%d", &K)

	if dbg {
		fmt.Println(N, K)
	}

	fmt.Println(factorize(N, K))
}

func main() {
	//test()

	solve()
	//p := quick_pow_mod(int64(2), int64(20), B)
	//fmt.Println(p)
}


package main

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

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

    var half = (int64)(math.Sqrt(float64(n)))
    var d = int64(-1)

    for i:=int64(1); i<=half; i++ {
        if n % i == 0 {
            k -= 1

            if k == 0 {
                d = i
                break
            }
        }
    }

    if k > 0 {
        if half * half == n {
            half--
        }

        for i:=half; i>0; i-- {
            if n % i == 0 {
                k -= 1

                if k == 0 {
                    d = n / i
                    break
                }
            }
        }
    }

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


package main

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

func I(i ...interface{}) error {
	_, err := fmt.Fscan(r, i...)
	return err
}

func O(o ...interface{}) {
	fmt.Fprint(w, o...)
}

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

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

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

func solve(n uint64) {
	var k, o, ans uint64
	I(&k)
	var arr []uint64
	for i := uint64(1); i <= uint64(math.Sqrt(float64(n))); i++ {
		if n%i == 0 {
			arr = append(arr, i)
			ans++
			if ans == k {
				o = i
				break
			}
		}
	}
	if ans < k {
		q := ans
		for q > 0 {
			q--
			if n/arr[q] == arr[q] {
			    continue
			}
			arr = append(arr, n/arr[q])
			ans++
			if ans == k {
				o = n / arr[q]
				break
			}
		}
	}
	if ans < k {
		O(-1, "\n")
	} else {
		O(o, "\n")
	}
}


package main

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

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    scanner.Split(bufio.ScanWords)
    scanner.Scan()
    a, _ := strconv.Atoi(scanner.Text())
    scanner.Scan()
    b, _:= strconv.Atoi(scanner.Text())
    if ((a == 0 && b == 0 ) || a - b < -1 || a - b > 1) {
        fmt.Println("NO")
    } else {
        fmt.Println("YES")
    }
}


package main

import "fmt"

func main() {
    var a, b int
    fmt.Scan(&a, &b)
    if a+b>0 && (a == b || a+1 == b || a-1 == b) {
        fmt.Print("YES")
    } else {
        fmt.Print("NO")
    }
}


package main

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

func solve() {
	a := readInt()
	b := readInt()
	if (a+1 == b || b+1 == a || a == b) && !(a == 0 && b == 0) {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}

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 min(a int, 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"
	"strings"
)

type Cin struct {
	scanner *bufio.Scanner
}

func (c *Cin) NextInt() int {
	c.scanner.Scan()
	line := c.scanner.Text()
	return c.convertInt(line)
}

func (c *Cin) NextIntSlice() []int {
	c.scanner.Scan()
	line := strings.Split(c.scanner.Text(), " ")
	var ret []int
	for _, s := range line {
		ret = append(ret, c.convertInt(s))
	}
	return ret
}

func (c *Cin) NextTwoInt() (int, int) {
	line := c.NextIntSlice()
	return line[0], line[1]
}

func (c *Cin) convertInt(data string) int {
	i, _ := strconv.Atoi(data)
	return i
}

var cin = &Cin{
	scanner: bufio.NewScanner(os.Stdin),
}

type element struct {
	value int
	step  int
	next  *element
	last  *element
}

func newElement(value, step int) *element {
	return &element{value: value, step: step}
}

type queue struct {
	head *element
	tail *element
}

func (q *queue) push(value, step int) {
	item := newElement(value, step)
	if q.isEmpty() {
		q.head = item
		q.tail = q.head
		return
	}
	item.last = q.tail
	q.tail.next = item
	q.tail = item
}

func (q *queue) isEmpty() bool {
	return q.head == nil
}

func (q *queue) pop() *element {
	if q.isEmpty() {
		panic("pop from empty queue")
	}
	item := q.head
	q.head = q.head.next
	return item
}

func newQueue() *queue {
	return &queue{}
}

func handle(n, m int) int {
	q := newQueue()
	q.push(n, 0)
	set := map[int]int{n: 0}
	for !q.isEmpty() {
		ele := q.pop()
		if ele.value == m {
			return ele.step
		}
		if ele.value > m {
			continue
		}
		if _, ok := set[ele.value*2]; !ok {
			set[ele.value*2] = ele.step + 1
			// fmt.Printf("val=[%v],step=[%v]\n", ele.value*2, ele.step+1)
			q.push(ele.value*2, ele.step+1)
		}
		if _, ok := set[ele.value*3]; !ok {
			set[ele.value*3] = ele.step + 1
			// fmt.Printf("val=[%v],step=[%v]\n", ele.value*3, ele.step+1)
			q.push(ele.value*3, ele.step+1)
		}
	}
	return -1
}

func main() {
	n, m := cin.NextTwoInt()
	fmt.Printf("%d\n", handle(n, m))
}


package main

import (
	"fmt"
)

func rec(a, b, cnt int) int {
	if a > b {
		return -1
	}
	if a == b {
		// fmt.Printf("%d\n", cnt)
		return cnt
	}
	if rec(a*2, b, cnt+1) != -1 {
		return rec(a*2, b, cnt+1)
	}
	if rec(a*3, b, cnt+1) != -1 {
		return rec(a*3, b, cnt+1)
	}
	return -1
}

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


package main

import "fmt"

func main() {
	var n, m, fact, step int64
	fmt.Scanf("%d %d", &n, &m)
	if m != n {
		if m%n == 0 {
			fact = m / n
			for fact%3 == 0 {
				fact /= 3
				step++
			}
			for fact%2 == 0 {
				fact /= 2
				step++
			}
		}
		if fact != 1 {
			step = -1
		}
	}

	fmt.Println(step)
}


package main

import "fmt"

func main() {
	var l, r, x, y, k int64
	fmt.Scanf("%d %d %d %d %d", &l, &r, &x, &y, &k)
	for i := l; i <= r; i++ {
		if (x*k <= i) && (i <= y*k) && (i%k == 0) {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")
}


package main

import "fmt"

func main() {
	var l, r, x, y, k int64
	fmt.Scan(&l, &r, &x, &y, &k)
	if x*k < l {
		x = (l + k - 1) / k
	}
	if y*k > r {
		y = r / k
	}
	if x > y {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
	}
}


package main

import (
  "fmt"
)

func main() {
  var l, r, x, y, k int
  fmt.Scanf("%d %d %d %d %d\n", &l, &r, &x, &y, &k)
  for b := x; b <= y; b++ {
    a := int64(b) * int64(k)
    if int64(l) <= a && a <= int64(r) {
      fmt.Printf("YES\n")
      return
    }
  }
  fmt.Printf("NO\n")
}


package main

import "fmt"

func main() {

	var l, r, x, y, k int64
	fmt.Scanf("%d %d %d %d %d", &l, &r, &x, &y, &k)
	for cost := x; cost <= y; cost++ {
		experience := k * cost
		if experience >= l && experience <= r {
			fmt.Println("YES")
			return
		}
	}
	fmt.Println("NO")

}


package main

import "fmt"

func main(){
	var a,b,c,d,e int
	var ans=false
	fmt.Scanf("%d %d %d %d %d",&a,&b,&c,&d,&e)
	for i:=c;i<=d;i++ {
		var comp=int64(i)*int64(e)
		if int64(a)<=comp && comp<=int64(b){
			ans=true
		}
	}
	if ans{
		fmt.Printf("YES\n")
	} else{
		fmt.Printf("NO\n")
	}
}


package main

import "fmt"

/**
 * 根据指定的层数，算出总的方块数
 */
func fetchSumByLevel(level int) int {
    return (level * (level + 1) * (level + 2) / 6)
}

/**
 * 在指定的区间内，二分搜索，查找一个能使总的方块数达到最大值的层数，这个最大值一定小于等于给定的方块数
 *
 * @param begin_level, 指定区间的起始（包括该下标）
 * @param end_level, 指定区间的结束（不包括该下标）
 * @param cubes_amt, 给定的方块数，最大层数时的总方块数一定要小于等于这个值
 *
 * @return 返回能叠的最大层数
 */
func binSearch(begin_level, end_level, cubes_amt int) int {
    for begin_level < end_level {
        cur_level := (begin_level + end_level) / 2
        cur_sum   := fetchSumByLevel(cur_level)

        if cubes_amt == cur_sum {
            return cur_level
        } else if cubes_amt > cur_sum {
            begin_level = cur_level + 1
        } else {
            end_level = cur_level
        }
    }
    return begin_level - 1
}

func main(){
    const (
        MIN_LEVEL = 1
        MAX_LEVEL = 40
    )

    cubes_amt := 0
    fmt.Scanf("%d", &cubes_amt)
    fmt.Printf("%d", binSearch(MIN_LEVEL, MAX_LEVEL, cubes_amt))
}


package main

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

func main() {
	var scanner *bufio.Scanner
	var n int
	var e error
	var c int = 0
	var d int = 0

	scanner = bufio.NewScanner(os.Stdin)

	scanner.Scan()

	n, e = strconv.Atoi(strings.TrimSpace(scanner.Text()))
	if e != nil {
		panic(e)
	}
	for i := 1; i <= 1e4+3; i++ {
		c += i
		d += c
		// fmt.Println(c, d)
		if d > n {
			c = i - 1
			break
		}

	}
	fmt.Println(c)
}


package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	var i int
	for r, s := 0, 0; s <= n; s += r {
		i++
		r += i
	}
	i--
	fmt.Println(i)
}


package main

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

var scanner *bufio.Scanner

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

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

  m := getI()
  know := map[[2]int]bool{}
  for i := 0; i < m; i++ {
    a, b := getI(), getI()
    know[[2]int{ a, b }] = true
    know[[2]int{ b, a }] = true
  }
  for i := 1; i <= 3; i++ {
    for j := i+1; j <= 4; j++ {
      for k := j+1; k <= 5; k++ {
        x, y, z := know[[2]int{i, j}], know[[2]int{j, k}], know[[2]int{i, k}]
        if (x && y && z) || !(x || y || z) {
          writer.WriteString("WIN\n")
          return
        }
      }
    }
  }
  writer.WriteString("FAIL\n")
}


package main

import (
	"fmt"
)

func main() {
	var rel int
	var a int
	var b int
	flag := false
	fmt.Scan(&rel)
	var ar [5]int
	for i := 0; i < rel; i++ {
		fmt.Scan(&a)
		fmt.Scan(&b)
		ar[a-1]++
		ar[b-1]++
	}
	for i := 0; i < 5; i++ {
		if ar[i] != 2 {
			flag = true
		}
	}
	if flag {
		fmt.Println("WIN")
	} else {
		fmt.Println("FAIL")
	}
}


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


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

func binary(n int) int {
	count := 0
	for n != 0 {
		if n % 2 == 1 {
			count++
		}
		n /= 2
	}
	return count
}

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

	fmt.Println(binary(n))
}


package main

import (
	"fmt"
	"math"
)

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

	for n > 1 {
		j := int(math.Floor(math.Log2(float64(n))))
		n = n - (1 << j)
		count += 1
	}
	if n == 1 {
		count += 1
	}
	fmt.Println(count)
}


package main

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

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

	reminder := n
	val := math.Log2(float64(reminder))
	reminder -= (1 << uint(val))
	counter := 1

	for reminder > 0 {
		val = math.Log2(float64(reminder))
		reminder -= (1 << uint(val))
		counter++
	}

	fmt.Println(counter)

}


// Codeforces 676 A
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
	"strconv"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
    var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
    for i:=0; i<len(ss); i++ {
        a[i], err = strconv.Atoi(ss[0])
        if err != nil {
            fmt.Println("n atoi failure", err)
            panic(err)
        }
    }
    return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
    a := make([]int, n)
    s, err := in.ReadString('\n')
    if err != nil {
        fmt.Println("read failure", err)
        panic(err)
    }
    ss := strings.Split(strings.Trim(s, " \n\r"), " ")
    for j:=0; j<n; j++ {
        aa,err := strconv.Atoi(ss[j])
        if err != nil {
            fmt.Println("aa conv failed", err)
            panic(err)
        }
        a[j] = aa
    }
    return a
}

var n int
var a []int
var maxDist int

func readData() {
 	in = bufio.NewReader(os.Stdin)
	// reading n
    n,_,_,_,_ = readFive()
    a = readLineNumbs(n)
}

func solve() {
    var imn,imx int
    i1 := 0
    in := 0
    for i,v := range a {
        if v==1 {
            i1 = i
        } else if v==n {
            in = i
        }
    }
    if i1<in {
        imn = i1
        imx = in
    } else {
        imn = in
        imx = i1
    }
    if imn < (n-1-imx) {
        maxDist = n-1 - imn
    } else {
        maxDist = imx
    }
}

func main() {
 	readData()

    solve()

    // print aqnswer
    fmt.Println(maxDist)
}


package main

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

func main() {
	reader := NewStdReader(os.Stdin)
	n := reader.ReadInt()

	var a int
	var i []int

	for t := 0; t < n; t++ {
		a = reader.ReadInt()
		if a == 1 || a == n {
			i = append(i, t)
		}
	}

	d1 := i[1]
	d2 := n - 1 - i[0]
	if d1 > d2 {
		fmt.Print(d1)
	} else {
		fmt.Print(d2)
	}
}

type StdReader struct {
	buf *bufio.Reader
}

func NewStdReader(reader io.Reader) *StdReader {
	return &StdReader{bufio.NewReaderSize(reader, 2*1024*1024)}
}

func (std *StdReader) ReadInt() int {

	r := 0
	sign := 1
	ok := false

	for {
		b, e := std.buf.ReadByte()

		if e != nil {
			break
		}
		if b >= '0' && b <= '9' {
			r = r*10 + int(b-'0')
			ok = true
		} else {
			if ok {
				break
			} else {
				if b == '-' {
					sign = -sign
				}
			}
		}
	}

	return sign * r
}


package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%v", &n)
	w := n / 7
	r := n % 7
	var a1, a2 int
	if r > 2 {
		a1 = 2*w + 2
	} else {
		a1 = 2*w + r
	}

	if r-5 > 0 {
		a2 = w*2 + (r - 5)
	} else {
		a2 = w * 2
	}

	fmt.Printf("%v %v\n", a2, a1)
}


package main

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

func main() {
	var scanner *bufio.Scanner
	var n int
	var e error
	var min [6]int = [6]int{0, 0, 0, 0, 0, 1}
	var max [6]int = [6]int{1, 2, 2, 2, 2, 2}

	scanner = bufio.NewScanner(os.Stdin)

	scanner.Scan()

	n, e = strconv.Atoi(strings.TrimSpace(scanner.Text()))
	if e != nil {
		panic(e)
	}

	if n%7 == 0 {
		fmt.Println((n/7)*2, (n/7)*2)
	} else {
		fmt.Println(min[(n%7)-1]+(n/7)*2, max[(n%7)-1]+(n/7)*2)
	}
}


package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	minDayOff := n / 7 * 2
	if n%7 > 5 {
		minDayOff += n%7 - 5
	}
	maxDayOff := 2
	if n < 2 {
		maxDayOff = n
		n = 0
	} else {
		n -= 2
	}
	maxDayOff += n / 7 * 2
	if n%7 > 5 {
		maxDayOff += n%7 - 5
	}
	fmt.Println(minDayOff, maxDayOff)
}


package main

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

func solve() {
    mp := make(map[string]bool)
    s := readString()
    cnt := 0
    for i := 0; i < len(s)+10; i++ {
        if !mp[s] {
            cnt++
        }
        mp[s] = true
        s = string(s[len(s)-1]) + s[:len(s)-1]
    }
    fmt.Println(cnt)
}

// Helpers

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

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

// Math

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

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

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

// 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
}

// Sort

type Ints64 []int64

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

/* Sort tempalte
func (a ) Len() int           { return len(a) }
func (a ) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a ) Less(i, j int) bool { return  }
*/


package main

import (
	"fmt"
)

func main() {
	var (
		str   string
	)

	fmt.Scan(&str)

	runes := []rune(str)
	strMap := make(map[string]int)
	strMap[str]++
	for i := 0; i < len(str); i++ {
		curRune := runes[len(str) - 1]
		for j := len(str) - 1; j > 0 ; j-- {
			runes[j] = runes[j - 1]
		}
		runes[0] = curRune
		strMap[string(runes)]++
	}

	fmt.Println(len(strMap))
}


package main

import (
	"fmt"
)

func main() {
	for {
		var input string
		if _, err := fmt.Scanf("%s", &input); err != nil {
			return
		}

		cache := make(map[string]int, len(input))

		l := len(input)

		for i:=0; i<l; i++ {
			cache[input] = 1
			input = input[l-1:] + input[:l-1]
		}

		fmt.Println(len(cache))
	}
}


// A. One-dimensional Japanese Crossword
/*
Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a × b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns, encrypting the corresponding row or column. The number of integers represents how many groups of black squares there are in corresponding row or column, and the integers themselves represents the number of consecutive black squares in corresponding group (you can find more detailed explanation in Wikipedia https://en.wikipedia.org/wiki/Japanese_crossword).

Adaltik decided that the general case of japanese crossword is too complicated and drew a row consisting of n squares (e.g. japanese crossword sized 1 × n), which he wants to encrypt in the same way as in japanese crossword.

Help Adaltik find the numbers encrypting the row he drew.

Input
The first line of the input contains a single integer n (1 ≤ n ≤ 100) — the length of the row. The second line of the input contains a single string consisting of n characters 'B' or 'W', ('B' corresponds to black square, 'W' — to white square in the row that Adaltik drew).

Output
The first line should contain a single integer k — the number of integers encrypting the row, e.g. the number of groups of black squares in the row.

The second line should contain k integers, encrypting the row, e.g. corresponding to sizes of groups of consecutive black squares in the order from left to right.
Examples

Input
3
BBW

Output
1
2

Input
5
BWBWB

Output
3
1 1 1

Input
4
WWWW

Output
0

Input
4
BBBB

Output
1
4

Input
13
WBBBBWWBWBBBW

Output
3
4 1 3

Note
The last sample case correspond to the picture in the statement.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input1, _ := reader.ReadString('\n')
	n, _ := strconv.Atoi(strings.TrimSpace(input1))

	input2, _ := reader.ReadString('\n')
	a := strings.TrimSpace(input2)

	k, g := 0, 0
	arrK := []int{}
	for i := 0; i < n; i++ {
		if a[i] == 'B' {
			k++
		} else if k > 0 {
			g++
			arrK = append(arrK, k)
			k = 0
		}
	}

	if k > 0 {
		g++
		arrK = append(arrK, k)
		k = 0
	}

	fmt.Println(g)

	for _, v := range arrK {
		fmt.Printf("%v ", v)
	}
}


package main

import "fmt"

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

	seq := []int{}
	for i, v := range s {
		if v == 'B' {
			if i == 0 || s[i-1] == 'W' {
				seq = append(seq, 0)
			}
			seq[len(seq)-1]++
		}
	}

	fmt.Println(len(seq))
	if len(seq) == 0 {
		return
	}
	for i, v := range seq {
		if i != 0 {
			fmt.Print(" ")
		}
		fmt.Print(v)
	}
	fmt.Println()
}


package main

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

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

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

	var n int
	var s string

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

	var res []int
	for i := 0; i < n; i++ {
		if s[i] == 'B' {
			j := i
			for (j < n) && (s[j] == 'B') {
				j++
			}
			res = append(res, j-i)
			i = j - 1
		}
	}

	fmt.Fprintf(bufout, "%d\n", len(res))
	for _, v := range res {
		fmt.Fprintf(bufout, "%d ", v)
	}
}


package main

import "fmt"

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


package main

import (
	"bufio"
	"io/ioutil"
	"os"
	"sort"
)

func main() {
	total := nextInt()
	weights := make([]int, total)
	for i := 0; i < len(weights); i++ {
		weights[i] = nextInt()
	}
	sort.Sort(sort.Reverse(sort.IntSlice(weights)))
	var a, b int
	for _, v := range weights {
		if a < b {
			a += v
		} else {
			b += v
		}
	}
	if a == b {
		writeln("YES")
	} else {
		writeln("NO")
	}
	out.Flush()
}

var (
	buf []byte
	out *bufio.Writer
)

func init() {
	buf, _ = ioutil.ReadAll(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
}

func nextInt() int {
	s, r := 1, 0
	for (buf[0] < '0' || '9' < buf[0]) && buf[0] != '-' {
		buf = buf[1:]
	}
	if buf[0] == '-' {
		s = -1
		buf = buf[1:]
	}
	for '0' <= buf[0] && buf[0] <= '9' {
		r = 10*r + int(buf[0]-'0')
		buf = buf[1:]
	}
	return r * s
}

func writeln(s string) {
	out.WriteString(s + "\n")
}


// 433A-mic
package main

import (
	"fmt"
)

func main() {
	var n, a1, a2, x int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		a1 = 0
		a2 = 0

		for i := 0; i < n; i++ {
			fmt.Scan(&x)
			if x == 100 {
				a1++
			} else {
				a2++
			}

		}

		a2 = a2 % 2

		if a2 == 1 {
			if a1 >= 2 {
				a1 = a1 - 2
			} else {
				fmt.Println("NO")
				return
			}
		}

		a1 = a1 % 2

		if a1 == 0 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
		return
	}

}


package main

import "fmt"

func max(i, j int) int {
	if i > j {
		return i
	}
	return j
}

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


package main

import "fmt"

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

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

	n++
	if n%2 == 0 {
		fmt.Println(n / 2)
	} else {
		fmt.Println(n)
	}
}


package main

import "fmt"

func Process(n int64) (int64) {
	if n == 0 {
		return 0
	}

	if (n+1)%2 == 0 {
		return (n + 1) / 2
	} else {
		return n + 1
	}
}

func main() {

	var n int64

	fmt.Scanln(&n)

	fmt.Println(Process(n))
}


// Author: sighduck
// URL: https://codeforces.com/problemset/problem/414/B

package main

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

const M = 1e9+7

func Solve(n, k int) int64 {
	dp := make([][]int64, k+1)
	for i := 1; i <= k; i++ {
		dp[i] = make([]int64, n+1)
	}
	for i := 1; i <= n; i++ {
		dp[1][i] = 1
	}
	for i := 1; i < k; i++ {
		for j := 1; j <= n; j++ {
			for d := 1; d*j <= n; d++ {
				dp[i+1][d*j] = (dp[i][j] + dp[i+1][d*j]) % M
			}
		}
	}
	s := int64(0)
	for _, elem := range dp[k] {
		s = (s + elem) % M
	}
	return s
}

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

	var n, k int
	fmt.Fscanf(reader, "%d %d\n", &n, &k)

	fmt.Fprintf(writer, "%d\n", Solve(n, k))
}