package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a < b {
		fmt.Print(a, (b-a)/2)
	} else if a > b {
		fmt.Print(b, (a-b)/2)
	} else if b == a {
		fmt.Print(a, 0)
	}
}

package main

import "fmt"

// https://codeforces.com/problemset/problem/581/A
// A. Vasya the Hipster
// time limit per test
// 1 second
// memory limit per test
// 256 megabytes
// input
// standard input
// output
// standard output

// One day Vasya the Hipster decided to count how many socks he had. It turned out that he had a red socks and b blue socks.

// According to the latest fashion, hipsters should wear the socks of different colors: a red one on the left foot, a blue one on the right foot.

// Every day Vasya puts on new socks in the morning and throws them away before going to bed as he doesn't want to wash them.

// Vasya wonders, what is the maximum number of days when he can dress fashionable and wear different socks, and after that, for how many days he can then wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got.

// Can you help him?
// Input

// The single line of the input contains two positive integers a and b (1 ≤ a, b ≤ 100) — the number of red and blue socks that Vasya's got.
// Output

// Print two space-separated integers — the maximum number of days when Vasya can wear different socks and the number of days when he can wear the same socks until he either runs out of socks or cannot make a single pair from the socks he's got.

// Keep in mind that at the end of the day Vasya throws away the socks that he's been wearing on that day.

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

	hipsterDays := intMin(a, b)

	a -= hipsterDays
	b -= hipsterDays

	nonHipsterDays := (a + b) / 2

	fmt.Print(hipsterDays, nonHipsterDays)
}

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

package main

import (
 "fmt"
)

func main() {
 var a, b int
 fmt.Scanf("%d %d", &a, &b)
 if a > b {
  a, b = b, a
 }
 fmt.Print(a, " ")
 fmt.Println((b - a) / 2)
}

package main

import "fmt"

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

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

// https://codeforces.com/problemset/problem/581/A
// комментарии к решению
// Для того, чтобы определить кол-во дней, во время которых Вася
// будет в разноцветных носках необходимо определить наименьшее
// из двух представленных чисел.
// Для того, чтобы определить кол-во дней, во время которых Вася
// будет в одноцветных (оставшихся) носках необходимо оставшиеся
// разбить на пары
func taskSolution(n int, m int) string {
	return fmt.Sprint(min(n, m), abs(n-m)/2)
}

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

	fmt.Println(taskSolution(n, m))
}

package main

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

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

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

	a, b := nextInt(), nextInt()
	fmt.Printf("%d %d", min(a, b), (a + b - 2 * min(a, b)) / 2)
}

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

func nextInt() int {
	in.Scan()
	res, _ := strconv.Atoi(in.Text())
	return res
}

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

package main

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

func main(){
	var r,b int
	in := bufio.NewReader(os.Stdin)
	fmt.Fscan(in,&r,&b)
	min,max := minmax(r,b)
	fmt.Println(min,(max-min)/2)
}
func minmax(a,b int)(int,int){
	if a<b {
		return a,b
	}
	return b,a
}

// A. Vasya the Hipster
/*
One day Vasya the Hipster decided to count how many socks he had. It turned out
that he had a red socks and b blue socks.

According to the latest fashion, hipsters should wear the socks of different
colors: a red one on the left foot, a blue one on the right foot.

Every day Vasya puts on new socks in the morning and throws them away before
going to bed as he doesn't want to wash them.

Vasya wonders, what is the maximum number of days when he can dress
fashionable and wear different socks, and after that, for how many days he
can then wear the same socks until he either runs out of socks or cannot make
a single pair from the socks he's got.

Can you help him?

Input
The single line of the input contains two positive integers a and b
(1 ≤ a, b ≤ 100) — the number of red and blue socks that Vasya's got.

Output
Print two space-separated integers — the maximum number of days when Vasya can
wear different socks and the number of days when he can wear the same socks
until he either runs out of socks or cannot make a single pair from the socks
he's got.

Keep in mind that at the end of the day Vasya throws away the socks that he's
been wearing on that day.

Examples
Input
3 1

Output
1 1

Input
2 3

Output
2 0

Input
7 3

Output
3 2

Note
In the first sample Vasya can first put on one pair of different socks,
after that he has two red socks left to wear on the second day.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	inputArr := strings.Split(strings.TrimSpace(input), " ")
	a, _ := strconv.Atoi(inputArr[0])
	b, _ := strconv.Atoi(inputArr[1])

	o1, o2 := 0, 0
	if a < b {
		o1 = a
		o2 = (b - o1) / 2
	} else {
		o1 = b
		o2 = (a - o1) / 2
	}
	fmt.Printf("%v %v", o1, o2)
}

package main
import (
	"fmt"
	"math"
)

func main() {
	var(
		a, b int
		together, separate int
	)
	fmt.Scanln(&a, &b)
	together = int(math.Min(float64(a), float64(b)))
	separate = int(math.Abs(float64(a-b))/2)
	fmt.Println(together, separate)
}

package main

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

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

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

	a, b := nextInt(), nextInt()

	if a > b {
		println(b, (a-b)/2)
	} else {
		println(a, (b-a)/2)
	}
}

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

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

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

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

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

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

package main

import(
    "fmt"
)

type u32 uint32

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

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

func main(){
    var(
        a,b u32
    )
    fmt.Scan(&a,&b)
    fmt.Println(min(&a,&b),(max(&a,&b)-min(&a,&b))/2)
}

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 main() {
	var a,b int
	_, _ = fmt.Scan(&a, &b)
	a, b = min(a,b), max(a, b)
	fmt.Println(a, (b - a) / 2)
}

package main

import "fmt"

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

	dif := min(r, b)
	sam := (max(r, b) - dif) / 2

	fmt.Println(dif, sam)
}

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
}

package main

import "fmt"

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

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

    both := min(a, b)
    a -= both
    b -= both
    single := a/2 + b/2

    fmt.Println(both, single)
}

package main

import "fmt"

func diff(red int,blue int) (val1 int,val2 int) {
for{
  if (red!=0)&&(blue!=0) {
	  val1++

  }else{
	 // fmt.Printf("the value of red and blue before being passed to same :%d %d\n",red,blue)
   if red>1 {
	   val2=same(red)
	   break
   }else if blue>1{
	   val2=same(blue)
	   break
   }else{
	   break
   }

}
red--;blue--;
}
return
}

func main()  {
	var red,blue int
	fmt.Scan(&red)
	fmt.Scan(&blue)
	val1,val2:=diff(red,blue)
	fmt.Print(val1,val2)
	}

func same(col int)(val2 int){

	for{

		if col>1{
			val2++
		}else{
			return
		}
		col=col-2
	}

}

package main

import "fmt"

func main() {
	var red, blue, min, max int
	fmt.Scanf("%d %d", &red, &blue)
	if red < blue {
		min = red
		max = blue
	} else {
		min = blue
		max = red
	}
	fmt.Println(min, (max-min)/2)
}

package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scanf("%d %d \n", &a, &b)
	if a > b {
		a, b = b, a
	}

	fmt.Println(a, (b-a)/2)
}

package main

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

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024*1024)
	line := readLine(reader)
	var a, b int64 = 0, 0
	fmt.Sscanf(line, "%d %d", &a, &b)
	fmt.Println(min(a, b), abs(a-b)/2)
}

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

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

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

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

package main

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

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

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

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

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

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

    a, b = Max(a, b)

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

package main

import (
	"fmt"
	"sort"
)

func main() {
	var red, blue int
	fmt.Scan(&red, &blue)
	var array = []int{red, blue}
	sort.Ints(array)
	day1 := array[0]
	day2 := (array[1] - array[0]) / 2
	fmt.Println(day1, day2)
}

package main

import "fmt"

var r, b int

func main() {
	fmt.Scan(&r, &b)
	if r > b {
		fmt.Println(b, " ", (r-b)/2)
	} else {
		fmt.Println(r, " ", (b-r)/2)
	}
}

package main

import "fmt"

func sock1 (a int, b int) int {
	res1 := 0
	if a < b {
		res1 = a
	} else if a > b {
		res1 = b
	} else if b == a {
		res1 = a
	}
	return res1
}
func sock2 (a int, b int) int {
	res2 := 0
	if a < b {
		res2 = (b-a)/2
	} else if a > b {
		res2 = (a-b)/2
	} else if b == a {
		res2 = 0
	}
	return res2
}

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	fmt.Print(sock1(a, b), sock2(a, b))
}

package main
import (
  "fmt"
)
func min(c int, d int) int {
    if d > c {
        return c
    } else {
        return d
    }
}
func main() {
  var a, b int = 0, 0
  fmt.Scanf("%d%d", &a, &b)
  var f int = min(a, b)
  var h int = (a + b - 2 * f) / 2
  fmt.Println(f, h)
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	sp := []int{a, b}
	sort.Ints(sp)
	k := sp[0]
	k2 := (sp[1] - sp[0]) / 2
	fmt.Println(k, k2)
}

package main

import "fmt"

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

	if a > b {
		fmt.Printf("%d ", b)
		fmt.Print((a - b) / 2)
	} else {
		fmt.Printf("%d ", a)
		fmt.Print((b - a) / 2)
	}
}

package main

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

var reader *bufio.Reader

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

var a, b int

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

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var a, b uint8
	fmt.Fscanf(in, "%d %d\n", &a, &b)
	if a > b {
		fmt.Println(b, (a-b)/2)

	} else if a < b {
		fmt.Println(a, (b-a)/2)
	} else if a == b {
		fmt.Println(a, 0)
	}

}

package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b float64
	fmt.Scanf("%f %f", &a, &b)
	firstDay := math.Min(a, b)
	secondDay := (math.Max(a, b) - firstDay) / 2
	fmt.Print(firstDay, " ", int(secondDay))
}

package main

import "fmt"

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

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

func main() {
	var a, b int

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

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

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

package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	s := []int{a, b}
	sort.Ints(s)
	m := s[0]
	m2 := (s[1] - s[0]) / 2
	fmt.Println(m, m2)
}

package main

import "fmt"

func main() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)
	if a < b {
		a, b = b, a
	}
	fmt.Println(b, (a-b)/2)
}

package main

import "fmt"

func main() {
	var a, b int
	fmt.Scanf("%d %d", &a, &b)
	days := a
	if a > b {
		days = b
	}
	fmt.Printf("%d %d\n", days, (a+b)/2-days)
}

package main

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

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

	scanner.Scan()
	ab := scanner.Text()
	var chList []int
	for _, ch := range strings.Split(ab, " ") {
		ch, err := strconv.Atoi(ch)
		if err != nil {
			log.Fatal(err)
		}
		chList = append(chList, ch)
	}
	a, b := chList[0], chList[1]
	var c int
	c = a - b
	if c < 0 {
		b, c, a = -c, a, 0
		b = b / 2
		fmt.Println(c, b)
	} else if c == 0 {
		c = a
		b = 0
		fmt.Println(c, b)
	} else {
		a, c, b = c, b, 0
		a = a / 2
		fmt.Println(c, a)
	}
}

package main

import (
	"fmt"
)

func main() {
	var red, blue, same, different int

	fmt.Scan(&red, &blue)

	if red > blue {
		different = blue
		same = (red - different) / 2
	} else {
		different = red
		same = (blue - different) / 2
	}

	fmt.Println(different, same)
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	mas := []int{a, b}
	sort.Ints(mas)
	r := mas[0]
	r2 := (mas[1] - mas[0]) / 2
	fmt.Println(r, r2)
}

// A. Vasya the Hipster
/*
One day Vasya the Hipster decided to count how many socks he had. It turned out
that he had a red socks and b blue socks.

According to the latest fashion, hipsters should wear the socks of different
colors: a red one on the left foot, a blue one on the right foot.

Every day Vasya puts on new socks in the morning and throws them away before
going to bed as he doesn't want to wash them.

Vasya wonders, what is the maximum number of days when he can dress
fashionable and wear different socks, and after that, for how many days he
can then wear the same socks until he either runs out of socks or cannot make
a single pair from the socks he's got.

Can you help him?

Input
The single line of the input contains two positive integers a and b
(1 ≤ a, b ≤ 100) — the number of red and blue socks that Vasya's got.

Output
Print two space-separated integers — the maximum number of days when Vasya can
wear different socks and the number of days when he can wear the same socks
until he either runs out of socks or cannot make a single pair from the socks
he's got.

Keep in mind that at the end of the day Vasya throws away the socks that he's
been wearing on that day.

Examples
Input
3 1

Output
1 1

Input
2 3

Output
2 0

Input
7 3

Output
3 2

Note
In the first sample Vasya can first put on one pair of different socks,
after that he has two red socks left to wear on the second day.
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	inputArr := strings.Split(strings.TrimSpace(input), " ")
	a, _ := strconv.Atoi(inputArr[0])
	b, _ := strconv.Atoi(inputArr[1])

	o1, o2 := 0, 0
	if a < b {
		o1 = a % b
		o2 = (b - o1) / 2
	} else {
		o1 = b % a
		o2 = (a - o1) / 2
	}
	fmt.Printf("%v %v", o1, o2)
}

package main

import "fmt"

func diff(red int,blue int) (val1 int,val2 int) {
for{
  if (red!=0)&&(blue!=0) {
	  val1++

  }else{
	 // fmt.Printf("the value of red and blue before being passed to same :%d %d\n",red,blue)
   if red>1 {
	   val2=same(red)
	   break
   }else if blue>1{
	   val2=same(blue)
	   break
   }else{
	   break
   }

}
red--;blue--;
}
return
}

func main()  {
	var red,blue int
	fmt.Scan(&red)
	fmt.Scan(&blue)
	val1,val2:=diff(red,blue)
	fmt.Print(val1,val2)
	}

func same(col int)(val2 int){

	for{

		if col>0 {
			val2++
		}else{
			return
		}
		col=col-2
	}

}

package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var a, b, c, d uint8
	c = 0
	d = 0
	fmt.Fscanf(in, "%d %d\n", &a, &b)
	for i := b; i > 0 && a > 0; i-- {
		a--
		b--
		c++
	}
	d = a / 2
	fmt.Println(c, d)
}

package main

import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	if a < b {
		fmt.Print(a, b/2)
	} else if b < a {
		fmt.Print(b, a/2)
	} else if b == a {
		fmt.Print(a, 0)
	}
}


package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	a, b, c := int64(0), int64(0), int64(0)
	fmt.Fscanf(in, "%d %d %d\n", &a, &b, &c)
	abs := min(a, b)
	a -= abs
	b -= abs
	ans := int64(0)
	if a > 0 || b > 0 {
		ans++
	}
	ans += c*2 + abs*2
	fmt.Fprintf(out, "%d\n", ans)
	return
}

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

package main

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

func main()  {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var a , b ,c int
	fmt.Fscan(in,&a,&b,&c)
	//3 2
	var total int64
	total = int64(min1(a,b) + c) * 2
	if(a != b){
		total += 1
	}
	fmt.Fprint(out,int64(total))

}
func min1(x1,x2 int) int  {
	if(x1 < x2){
		return x1
	}else{
		return x2
	}
}

// A. Another One Bites The Dust
/*
Let's call a string good if and only if it consists of only two types of letters — 'a' and 'b' and every two consecutive letters are distinct. For example "baba" and "aba" are good strings and "abb" is a bad string.

You have 𝑎 strings "a", 𝑏 strings "b" and 𝑐 strings "ab". You want to choose some subset of these strings and concatenate them in any arbitrarily order.

What is the length of the longest good string you can obtain this way?

Input
The first line contains three positive integers 𝑎, 𝑏, 𝑐 (1≤𝑎,𝑏,𝑐≤109) — the number of strings "a", "b" and "ab" respectively.

Output
Print a single number — the maximum possible length of the good string you can obtain.

Examples
Input
1 1 1

Output
4

Input
2 1 2

Output
7

Input
3 5 2

Output
11

Input
2 2 1

Output
6

Input
1000000000 1000000000 1000000000

Output
4000000000

Note
In the first example the optimal string is "baba".

In the second example the optimal string is "abababa".

In the third example the optimal string is "bababababab".

In the fourth example the optimal string is "ababab".
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	arr := strings.Split(strings.TrimSpace(input), " ")
	a, _ := strconv.ParseInt(arr[0], 10, 64)
	b, _ := strconv.ParseInt(arr[1], 10, 64)
	c, _ := strconv.ParseInt(arr[2], 10, 64)

	total := c * 2
	if a > b {
		total += (2 * b) + 1
	} else if a < b {
		total += (2 * a) + 1
	} else {
		total += 2 * a
	}
	fmt.Print(total)
}

package main

import (
	"fmt"
)

func queen(x int64, y int64, z int64) int64 {
	res := z * 2
	if x == y {
		res += x * 2
		return res
	} else if x > y {
		res += y * 2 + 1
		return res
	} else {
		res += x * 2 + 1
		return res
	}
}

func main() {
	var a int64
	var b int64
	var c int64
	fmt.Scan(&a, &b, &c)
	fmt.Println(queen(a, b, c))
}

package main

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

var reader = bufio.NewReader(os.Stdin)

func main() {
	in := readString()
	parts := strings.Split(in, " ")
	a := Atoi(parts[0])
	b := Atoi(parts[1])
	ab := Atoi(parts[2])

	aabb := Min(a, b)
	res := ab*2 + aabb*2
	if Abs(a-b) != 0 {
		res++
	}
	fmt.Println(res)
}

func readInteger() int64 {
	s, _, _ := reader.ReadLine()
	n, _ := strconv.ParseInt(string(s), 0, 64)
	return n
}

func readString() string {
	s, _, _ := reader.ReadLine()
	return string(s)
}

func Abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

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

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

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

package main

import "fmt"

func solve(a, b, c uint64) uint64 {
	res := a
	if b < a {
		res = b
	}

	res += c
	res *= 2

	if a != b {
		res++
	}

	return res
}

func main() {
	var a, b, c uint64

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

	res := solve(a, b, c)
	fmt.Println(res)
}

package main

import (
	"fmt"
)

func solve(first int64, second int64, third int64) int64 {
	ans := third * 2
	if first == second {
		ans += first * 2
		return ans
	} else if first > second {
		ans += second * 2 + 1
		return ans
	} else {
		ans += first * 2 + 1
		return ans
	}
}

func main() {
	var a, b, c int64
	fmt.Scan(&a, &b, &c)
	fmt.Println(solve(a, b, c))
}

package main
import "fmt"
func main() {
	var a, b, c, res uint64
	fmt.Scan(&a, &b, &c)
    res = a
	if b < a {
	    res = b
	}
	res = res + c
	res = res * 2
	if a != b {
		res++
	}
	fmt.Println(res)
}

package main

import (
	"fmt"
)

func fun(x int64, y int64, z int64) int64 {
	ans := z * 2
	if x == y {
		ans += x * 2
		return ans
	} else if x > y {
		ans += y * 2 + 1
		return ans
	} else {
		ans += x * 2 + 1
		return ans
	}
}

func main() {
	var a, b, c int64
	fmt.Scan(&a, &b, &c)
	fmt.Println(fun(a, b, c))
}

// A. Another One Bites The Dust
/*
Let's call a string good if and only if it consists of only two types of letters — 'a' and 'b' and every two consecutive letters are distinct. For example "baba" and "aba" are good strings and "abb" is a bad string.

You have 𝑎 strings "a", 𝑏 strings "b" and 𝑐 strings "ab". You want to choose some subset of these strings and concatenate them in any arbitrarily order.

What is the length of the longest good string you can obtain this way?

Input
The first line contains three positive integers 𝑎, 𝑏, 𝑐 (1≤𝑎,𝑏,𝑐≤109) — the number of strings "a", "b" and "ab" respectively.

Output
Print a single number — the maximum possible length of the good string you can obtain.

Examples
Input
1 1 1

Output
4

Input
2 1 2

Output
7

Input
3 5 2

Output
11

Input
2 2 1

Output
6

Input
1000000000 1000000000 1000000000

Output
4000000000

Note
In the first example the optimal string is "baba".

In the second example the optimal string is "abababa".

In the third example the optimal string is "bababababab".

In the fourth example the optimal string is "ababab".
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	arr := strings.Split(strings.TrimSpace(input), " ")
	a, _ := strconv.Atoi(arr[0])
	b, _ := strconv.Atoi(arr[1])
	c, _ := strconv.Atoi(arr[2])

	total := c * 2
	if a > b {
		total += (2 * b) + 1
	} else if a < b {
		total += (2 * a) + 1
	} else {
		total += 2 * a
	}
	fmt.Print(total)
}

// A. Another One Bites The Dust
/*
Let's call a string good if and only if it consists of only two types of letters — 'a' and 'b' and every two consecutive letters are distinct. For example "baba" and "aba" are good strings and "abb" is a bad string.

You have 𝑎 strings "a", 𝑏 strings "b" and 𝑐 strings "ab". You want to choose some subset of these strings and concatenate them in any arbitrarily order.

What is the length of the longest good string you can obtain this way?

Input
The first line contains three positive integers 𝑎, 𝑏, 𝑐 (1≤𝑎,𝑏,𝑐≤109) — the number of strings "a", "b" and "ab" respectively.

Output
Print a single number — the maximum possible length of the good string you can obtain.

Examples
Input
1 1 1

Output
4

Input
2 1 2

Output
7

Input
3 5 2

Output
11

Input
2 2 1

Output
6

Input
1000000000 1000000000 1000000000

Output
4000000000

Note
In the first example the optimal string is "baba".

In the second example the optimal string is "abababa".

In the third example the optimal string is "bababababab".

In the fourth example the optimal string is "ababab".
*/
package main

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

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	arr := strings.Split(strings.TrimSpace(input), " ")
	a, _ := strconv.Atoi(arr[0])
	b, _ := strconv.Atoi(arr[1])
	c, _ := strconv.Atoi(arr[2])

	total := c * 2
	if a > b {
		total += 2*b + 1
	} else if a < b {
		total += 2*a + 1
	} else {
		total += 2 * a
	}
	fmt.Print(total)
}

package main

import (
	"fmt"
)

func queen(x int, y int, z int) int {
	res := z * 2
	if x == y {
		res += x * 2
		return res
	} else if x > y {
		res += y * 2 + 1
		return res
	} else {
		res += x * 2 + 1
		return res
	}
}

func main() {
	var a int
	var b int
	var c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(queen(a, b, c))
}

package main

import (
	"fmt"
)

func queen(x int, y int, z int) int {
	res := z * 2
	if x == y {
		res += x * 2
		return res
	}
	if x > y {
		res += y * 2 + 1
		return res
	}
	if x < y {
		res += x * 2 + 1
		return res
	} else {
		return res
	}
}

func main() {
	var a int
	var b int
	var c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(queen(a, b, c))
}

package main

import "fmt"

func solve(a, b, c uint64) uint64 {
	res := a
	if b < a {
		res = b
	}

	return 2*res + 2*c
}

func main() {
	var a, b, c uint64

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

	res := solve(a, b, c)
	fmt.Println(res)
}

package main

import (
	"fmt"
)

func solve(first int, second int, third int) int {
	ans := third * 2
	if first == second {
		ans += first * 2
		return ans
	} else if first > second {
		ans += second * 2 + 1
		return ans
	} else {
		ans += first * 2 + 1
		return ans
	}
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(solve(a, b, c))
}

package main

import (
	"fmt"
)

func fun(x int, y int, z int) int {
	ans := z * 2
	if x == y {
		ans += x * 2
		return ans
	} else if x > y {
		ans += y * 2 + 1
		return ans
	} else {
		ans += x * 2 + 1
		return ans
	}
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(fun(a, b, c))
}

package main

import (
	"fmt"
)

func fun(x int, y int, z int) int {
	ans:=z * 2
	if x == y {
		ans += x * 2
		return ans
	} else if x > y {
		ans += y * 2 + 1
		return ans
	} else {
		ans += x * 2 + 1
		return ans
	}
}

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	fmt.Println(fun(a, b, c))
}

package main

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

func main()  {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var a , b ,c int
	fmt.Fscan(in,&a,&b,&c)
	//3 2
	total := (min1(a,b) + c) * 2
	if(a != b){
		total += 1
	}
	fmt.Fprint(out,int64(total))

}
func min1(x1,x2 int) int  {
	if(x1 < x2){
		return x1
	}else{
		return x2
	}
}

package main

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

func main()  {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var a , b ,c int
	fmt.Fscan(in,&a,&b,&c)
	//3 2
	total := (min1(a,b) + c) * 2
	if(a != b){
		total += 1
	}
	fmt.Fprint(out,total)

}
func min1(x1,x2 int) int  {
	if(x1 < x2){
		return x1
	}else{
		return x2
	}
}

package main

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

func main()  {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var a , b ,c int
	fmt.Fscan(in,&a,&b,&c)
	//3 2
	total := min1(a,b) + c * 2
	if(a != b){
		total += 1
	}
	fmt.Fprint(out,total)

}
func min1(x1,x2 int) int  {
	if(x1 < x2){
		return x1
	}else{
		return x2
	}
}

package main

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

func main()  {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	var a , b ,c int
	fmt.Fscan(in,&a,&b,&c)
	//3 2
	fmt.Fprint(out,int64(a + b + c * 2))

}
func min1(x1,x2 int) int  {
	if(x1 < x2){
		return x1
	}else{
		return x2
	}
}


package main

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

// github.com/EndlessCheng/codeforces-go
func CF1030C(_r io.Reader, out io.Writer) {
	var n, s int
	var a []byte
	Fscan(bufio.NewReader(_r), &n, &a)
o:
	for i, v := range a[:n-1] {
		s += int(v & 15)
		for j := i + 1; j < n; {
			s2 := int(a[j] & 15)
			for j++; j < n && (s2 < s || s2 == s && a[j] == '0'); j++ {
				s2 += int(a[j] & 15)
			}
			if s2 != s {
				continue o
			}
		}
		Fprintln(out, "YES")
		return
	}
	Fprintln(out, "NO")
}

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

package main

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

func main() {

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	scanner.Scan()
	ans := strings.Split(scanner.Text(), "")

	total := 0
	for i := 0; i < len(ans)-1; i++ {
		a, _ := strconv.Atoi(ans[i])
		total += a
		if findGolden(total, ans[i+1:]) {
			fmt.Print("YES")
			return
		}
	}
	fmt.Print("NO")
}

func findGolden(cut int, rem []string) bool {
	total := 0
	for i := 0; i < len(rem); i++ {
		a, _ := strconv.Atoi(rem[i])

		total += a
		if total > cut {
			return false
		}
		if total == cut {
			return i+1 == len(rem) || findGolden(cut, rem[i+1:]) || findGolden(0, rem[i+1:])

		}
	}
	return false
}

package main

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

func main() {

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	scanner.Scan()
	ans := strings.Split(scanner.Text(), "")

	total := 0
	for i := 0; i < len(ans)-1; i++ {
		a, _ := strconv.Atoi(ans[i])
		total += a
		if findGolden(total, ans[i+1:]) {
			fmt.Print("YES")
			return
		}
	}
	fmt.Print("NO")
}

func findGolden(cut int, rem []string) bool {
	total := 0
	for i := 0; i < len(rem); i++ {
		a, _ := strconv.Atoi(rem[i])

		total += a
		if total > cut {
			return false
		}
		if total == cut {
			return i+1 == len(rem) || findGolden(cut, rem[i+1:])

		}
	}
	return false
}


package main

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

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

	s := strings.TrimSpace(line)
	stringLength := len(s)

	line, _ = reader.ReadString('\n')
	var k int

	fmt.Sscanf(line, "%d", &k)

	newString := make([]rune, stringLength+k)
	copy(newString, []rune(s))

	bestRepeat := 0
	for i := 0; i < stringLength+k; i++ {
		currentRepeat := 0
		for currentRepeat <= (stringLength+k-i)/2 {
			tandemRepeat := true
			for j := i; j < i+currentRepeat; j++ {
				if newString[j+currentRepeat] != newString[j] && newString[j+currentRepeat] != 0 {
					tandemRepeat = false
					break
				}
			}
			if tandemRepeat && currentRepeat > bestRepeat {
				bestRepeat = currentRepeat
			}
			currentRepeat++
		}
	}
	fmt.Println(2*bestRepeat - 0)
}

package main

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

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

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

	s, k := next(), nextInt()

	if k >= len(s) {
		println((len(s) + k) / 2 * 2)
		return
	}

	s += strings.Repeat(".", k)
	result := k * 2
	// length := 0

	for i := 0; i < len(s); i++ {
		for j := i + 1; j <= len(s); j++ {
			str := s[i:j]
			if len(str) % 2 == 0 && len(str) > result && isTandemRepeat(str) {
				result = len(str)
				// println(str, result)
			}
		}
	}

	// println(s, len(s))
	println(result)
}

func isTandemRepeat(s string) bool {
	if len(s) % 2 == 1 {
		return false
	}

	for i := 0; i < len(s) / 2; i++ {
		if s[i] != s[i + len(s) / 2] && s[i + len(s) / 2] != '.' {
			return false
		}
	}

	return true
}

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

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

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

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

func print(a ...interface{}) {
	fmt.Fprint(writer, a...)
}

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

package main

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

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

	s := strings.TrimSpace(line)
	stringLength := len(s)

	line, _ = reader.ReadString('\n')
	var k int

	fmt.Sscanf(line, "%d", &k)

	newString := make([]rune, stringLength+k)
	copy(newString, []rune(s))

	bestRepeat := 0
	for i := 0; i < stringLength+k; i++ {
		for currentRepeat := 0; currentRepeat <= (stringLength+k-i)/2; currentRepeat++ {
			tandemRepeat := true
			for j := i; j < i+currentRepeat; j++ {
				if newString[j+currentRepeat] != newString[j] && newString[j+currentRepeat] != 0 {
					tandemRepeat = false
					break
				}
			}
			if tandemRepeat && currentRepeat > bestRepeat {
				bestRepeat = currentRepeat
			}

		}
	}
	fmt.Println(2*bestRepeat - 0)
}

package main

import (
  "fmt"
)

func Judge(line *string, n, k, l int) bool {
  for i := 0; i <= n+k-l*2; i++ {
    var flag bool = true
    for j := 0; j < l; j++ {
      if i+j+l < n && (*line)[i+j] != (*line)[i+j+l] {
        flag = false
        break
      }
    }
    if flag {
      return true
    }
  }
  return false
}

func main() {
  var line string
  var k int
  fmt.Scan(&line, &k)
  var n int = len(line)
  var res int = 0
  for i := (n + k) / 2; i > 0; i-- {
    if Judge(&line, n, k, i) {
      res = i * 2
      break
    }
  }
  fmt.Println(res)
}

package main

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

func main() {
	sc := NewScanner(os.Stdin)
	s, _ := sc.NextLine()
	m := len(s)
	k, _ := sc.NextLong()
	n := m + int(k)

	isTandemRepeat := func(i, j int) bool {
		res := true
		for k := 0; i+j+k < m && k < j; k++ {
			if s[i+k] != s[i+j+k] {
				res = false
				break
			}
		}
		return res
	}
	res := 0
	for i := 0; i < n; i++ {
		for j := 1; i+2*j <= n; j++ {
			if isTandemRepeat(i, j) {
				res = maxInt(res, j)
			}
		}
	}
	fmt.Println(res * 2)
}

////////////////////////////////////////////////////////////////
//
//  gojus: retrieved from https://github.com/tnoda/gojus
//

// NewScanner returns a new Scanner to read from r.
func NewScanner(rdr io.Reader) *Scanner {
	sc := Scanner{bufio.NewScanner(rdr), 10}
	return &sc
}

// Errors returned by Scanner
var (
	ErrNoSuchElement = errors.New("gojus.Scanner: input is exhausted.")
)

// Scanner provides a similar interface to the java.util.Scaner's one.
type Scanner struct {
	*bufio.Scanner
	radix int
}

// Next scans and returns the next token of the input.
func (sc *Scanner) Next() (string, error) {
	sc.Split(bufio.ScanWords)
	if !sc.Scan() {
		return "", ErrNoSuchElement
	}
	return sc.Text(), nil
}

// UseRadix sets the scanner's default radix to the specified one.
func (sc *Scanner) UseRadix(radix int) *Scanner {
	sc.radix = radix
	return sc
}

func (sc *Scanner) nextLong() (int64, error) {
	t, e := sc.Next()
	if e != nil {
		return 0, e
	}
	return strconv.ParseInt(t, sc.radix, 64)
}

// NextLong scans and returns the next token of the input as an int64.
func (sc *Scanner) NextLong() (int64, error) {
	return sc.nextLong()
}

// NextDouble scans and returns the next token of the input as a float64
func (sc *Scanner) NextDouble() (float64, error) {
	t, e := sc.Next()
	if e != nil {
		return 0, e
	}
	return strconv.ParseFloat(t, 64)
}

// NextLine advances this scanner past the current line and returns
// the input that was skipped.
func (sc *Scanner) NextLine() (string, error) {
	sc.Split(bufio.ScanLines)
	if !sc.Scan() {
		return "", ErrNoSuchElement
	}
	return sc.Text(), nil
}

////////////////////////////////////////////////////////////////
//
// int/int64 utilities
//
func minInt(a, b int) int {
	if b < a {
		return b
	}
	return a
}

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

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

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

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

func absInt64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

// 443B
package main

import (
	"fmt"
)

func count(s *string, n, k, l int) bool {
	for i := 0; i <= n+k-l*2; i++ {
		stat := true
		for j := 0; j < l; j++ {
			if i+j+l < n && (*s)[i+j] != (*s)[i+j+l] {
				stat = false
				break
			}
		}
		if stat {
			return true
		}
	}
	return false
}

func main() {
	var s string
	var k int
	fmt.Scan(&s, &k)
	n := len(s)
	ans := 0
	for i := (n + k) / 2; i > 0; i-- {
		if count(&s, n, k, i) {
			ans = i * 2
			break
		}
	}
	fmt.Println(ans)
}

package main

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

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

	s := strings.TrimSpace(line)
	stringLength := len(s)

	line, _ = reader.ReadString('\n')
	var k int

	fmt.Sscanf(line, "%d", &k)

	newString := make([]rune, stringLength+k)
	copy(newString, []rune(s))

	bestRepeat := 0
	for i := 0; i < stringLength+k; i++ {
		currentRepeat := 0
		for i+currentRepeat < stringLength+k && currentRepeat <= (stringLength+k-i)/2 {
			if newString[i+currentRepeat] == newString[i] || newString[i+currentRepeat] == 0 {
				if currentRepeat > bestRepeat {
					bestRepeat = currentRepeat
				}
			}
			currentRepeat++
		}
	}
	fmt.Println(2 * (bestRepeat - 0))
}

package main

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

func main() {
	sc := NewScanner(os.Stdin)
	s, _ := sc.NextLine()
	m := len(s)
	k, _ := sc.NextLong()
	n := m + int(k)

	isTandemRepeat := func(i, j int) bool {
		res := true
		for k := 0; i+2*k < m; k++ {
			if s[i+k] != s[i+2*k] {
				res = false
				break
			}
		}
		return res
	}
	res := 0
	for i := 0; i < n; i++ {
		for j := 1; i+2*j <= n; j++ {
			if isTandemRepeat(i, j) {
				res = maxInt(res, j)
			}
		}
	}
	fmt.Println(res * 2)
}

////////////////////////////////////////////////////////////////
//
//  gojus: retrieved from https://github.com/tnoda/gojus
//

// NewScanner returns a new Scanner to read from r.
func NewScanner(rdr io.Reader) *Scanner {
	sc := Scanner{bufio.NewScanner(rdr), 10}
	return &sc
}

// Errors returned by Scanner
var (
	ErrNoSuchElement = errors.New("gojus.Scanner: input is exhausted.")
)

// Scanner provides a similar interface to the java.util.Scaner's one.
type Scanner struct {
	*bufio.Scanner
	radix int
}

// Next scans and returns the next token of the input.
func (sc *Scanner) Next() (string, error) {
	sc.Split(bufio.ScanWords)
	if !sc.Scan() {
		return "", ErrNoSuchElement
	}
	return sc.Text(), nil
}

// UseRadix sets the scanner's default radix to the specified one.
func (sc *Scanner) UseRadix(radix int) *Scanner {
	sc.radix = radix
	return sc
}

func (sc *Scanner) nextLong() (int64, error) {
	t, e := sc.Next()
	if e != nil {
		return 0, e
	}
	return strconv.ParseInt(t, sc.radix, 64)
}

// NextLong scans and returns the next token of the input as an int64.
func (sc *Scanner) NextLong() (int64, error) {
	return sc.nextLong()
}

// NextDouble scans and returns the next token of the input as a float64
func (sc *Scanner) NextDouble() (float64, error) {
	t, e := sc.Next()
	if e != nil {
		return 0, e
	}
	return strconv.ParseFloat(t, 64)
}

// NextLine advances this scanner past the current line and returns
// the input that was skipped.
func (sc *Scanner) NextLine() (string, error) {
	sc.Split(bufio.ScanLines)
	if !sc.Scan() {
		return "", ErrNoSuchElement
	}
	return sc.Text(), nil
}

////////////////////////////////////////////////////////////////
//
// int/int64 utilities
//
func minInt(a, b int) int {
	if b < a {
		return b
	}
	return a
}

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

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

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

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

func absInt64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

// 443B
package main

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

func main() {
	var st string
	var ans, i, j, k, n, length, flag, max int
	in := bufio.NewScanner(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	in.Split(bufio.ScanWords)
	in.Scan()
	st = in.Text()
	length = len(st)
	fmt.Scan(&n)
	ans = n + length
	max = 0
	for i = 0; i < ans; i++ {
		for j = 0; i+2*j-1 < ans; j++ {
			flag = 0
			for k = i; k < i+j; k++ {
				if k >= length || j+k >= length || st[k] == st[j+k] {
					continue
				} else {
					flag = 1
					break
				}
			}
			if flag == 0 {
				if 2*j > max {
					max = 2 * j
				}
			}
			max = 2 * j
		}
	}
	fmt.Fprintln(out, max)
	out.Flush()
}

// 443B
package main

import (
	"fmt"
)

func main() {
	var st [500]string
	var ans, i, j, k, n, length, flag, max int
	fmt.Scan(&st)
	length = len(st)
	fmt.Scan(&n)
	ans = n + length
	max = 0
	for i = 0; i < ans; i++ {
		for j = 0; i+2*j-1 < ans; j++ {
flag = 0
			for k = i; k < i+j; k++ {
				if k >= length || j+k >= length || st[k] == st[j+k] {
					continue
				} else {
					flag = 1
					break
				}
			}
			if flag == 0 {
				if 2*j > max {
					max = 2 * j
				}
			}
			max = 2 * j
		}
	}
	fmt.Println(max)
}


package main

import (
	"fmt"
)

func pow(x, y int) uint64 {
	var ans uint64
	ans = 1
	for i := 0; i < y; i++ {
		ans *= uint64(x)
	}
	return ans
}

func calc_s(x uint64) uint64 {
	var ans uint64
	ans = 0
	for x != 0 {
		ans += x % 10
		x /= 10
	}
	return ans
}

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

	ans := make([]int, 81, 81)
	i := 0
	for s := 1; s <= 81; s++ {
		var x uint64
		x = uint64(b)*pow(s, a) + uint64(c)
		if x < uint64(1000000000) && uint64(s) == calc_s(x) {
			ans[i] = int(x)
			i++
		}
	}

	fmt.Println(i)
	if i > 0 {
		for j := 0; j < i; j++ {
			fmt.Print(ans[j], " ")
		}
		fmt.Println()
	}
}

package main

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

// x = b·s(x)^a + c

func main() {
	const max_x int64 = 1000000000
	const max_digits int64 = 9

	var a, b, c int64
	if _, err := fmt.Scanf("%d %d %d\n", &a, &b, &c); err != nil {
		return
	}

	cnt := 0
	var all_res []string

	for i := int64(1); i <= 9*max_digits; i++ {
		y := b*power(i, a) + c
		if y < max_x && s(y) == i {
			cnt++
			all_res = append(all_res, strconv.FormatInt(y, 10))
		}
	}

	fmt.Println(cnt)
	fmt.Println(strings.Join(all_res, " "))
}

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

func power(sx, n int64) int64 {
	res := sx
	for i := int64(1); i < n; i++ {
		res *= sx
	}
	return res
}

package main

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

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

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

func Sum(x int64) int64 {
    var result int64
    for x != 0 {
        result += int64(math.Mod(float64(x), 10.0))
        x = x / 10
    }

    return result
}

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

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

    writer := bufio.NewWriter(os.Stdout)
    // s(x) can be from 1 to 81
    var result []int64
    for i := 1; i <= 81; i++ {
        right := b * int64(math.Pow(float64(i), float64(a))) + c
        if right < 1000000000 {
            left := Sum(right)

            if left == int64(i) {
                result = append(result, right)
            }
        }
    }

    Write(writer, len(result))
    for i := range result {
        fmt.Fprint(writer, result[i])
        fmt.Fprint(writer, " ")
    }

    writer.Flush()
}

package main

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

func S(x int64) int64 {
	var res int64 = 0
	for x != 0 {
		res += x % 10
		x /= 10
	}
	return res
}

func Pow(x, a int64) int64 {
	var res int64 = 1
	for i := 0; int64(i) < a; i++ {
		res *= x
	}
	return res
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	var a, b, c int64
	fmt.Fscan(reader, &a, &b, &c)
	var num_res = 0
	var res []int64 = make([]int64, 40)
	for i := 1; i < 82; i++ {
		var x int64 = b*Pow(int64(i), a) + c
		if x < 1000000000 && S(x) == int64(i) {
			res[num_res] = x
			num_res++
		}
	}
	fmt.Fprintln(writer, num_res)
	for i := 0; i < num_res; i++ {
		fmt.Fprintf(writer, "%d ", res[i])
	}
	fmt.Fprintln(writer)
	writer.Flush()
}

package main

import (
	"fmt"
	"sort"
)

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

func main() {
	var b, c int64
	var a int
	fmt.Scan(&a, &b, &c)
	var res []int
	for s := int64(1); s <= 9*9; s++ {
		r := s
		for i := 1; i < a; i++ {
			r *= s
		}
		r = b*r + c
		if sum(r) == s && r < 1000000000 {
			res = append(res, int(r))
		}
	}

	sort.Ints(res)
	fmt.Println(len(res))
	for i, r := range res {
		fmt.Print(r)
		if i == len(res)-1 {
			fmt.Print("\n")
		} else {
			fmt.Print(" ")
		}
	}
}

package main

import (
	"fmt"
	"sort"
)

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

func main() {
	var b, c int64
	var a int
	fmt.Scan(&a, &b, &c)
	var res []int
	for s := int64(1); s <= 9*9; s++ {
		r := s
		for i := 1; i < a; i++ {
			r *= s
		}
		r = b*r + c
		if sum(r) == s {
			res = append(res, int(r))
		}
	}

	sort.Ints(res)
	fmt.Println(len(res))
	for i, r := range res {
		fmt.Print(r)
		if i == len(res)-1 {
			fmt.Print("\n")
		} else {
			fmt.Print(" ")
		}
	}
}

package main

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

// x = b·s(x)^a + c

func main() {
	const max_digits int64 = 9

	var a, b, c int64
	if _, err := fmt.Scanf("%d %d %d\n", &a, &b, &c); err != nil {
		return
	}

	cnt := 0
	var all_res []string

	for i := int64(1); i < max_digits*max_digits; i++ {
		y := b*power(i, a) + c
		if s(y) == i {
			cnt++
			all_res = append(all_res, strconv.FormatInt(y, 10))
		}
	}

	fmt.Println(cnt)
	fmt.Println(strings.Join(all_res, " "))
}

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

func power(sx, n int64) int64 {
	res := sx
	for i := int64(1); i < n; i++ {
		res *= sx
	}
	return res
}

package main

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

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

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

func Sum(x int) int {
    var result int
    for x != 0 {
        result += int(math.Mod(float64(x), 10.0))
        x = x / 10
    }

    return result
}

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

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

    // s(x) can be from 1 to 81
    var result []int
    for i := 1; i <= 81; i++ {
        right := b * int(math.Pow(float64(i), float64(a))) + c
        left := Sum(right)

        if left == i {
            result = append(result, right)
        }
    }

    writer := bufio.NewWriter(os.Stdout)
    Write(writer, len(result))
    for i := range result {
        fmt.Fprint(writer, result[i])
        fmt.Fprint(writer, " ")
    }

    writer.Flush()
}

package main

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

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

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

func Sum(x int) int {
    var result int
    for x != 0 {
        result += int(math.Mod(float64(x), 10.0))
        x = x / 10
    }

    return result
}

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

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

    // s(x) can be from 1 to 81
    var result []int
    for i := 1; i <= 81; i++ {
        right := b * int(math.Pow(float64(i), float64(a))) + c
        if right < 1000000000 {
            left := Sum(right)

            if left == i {
                result = append(result, right)
            }
        }
    }

    writer := bufio.NewWriter(os.Stdout)
    Write(writer, len(result))
    for i := range result {
        fmt.Fprint(writer, result[i])
        fmt.Fprint(writer, " ")
    }

    writer.Flush()
}

package main

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

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

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

func Sum(x int64) int64 {
    var result int64
    for x != 0 {
        result += int64(math.Mod(float64(x), 10.0))
        x = x / 10
    }

    return result
}

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

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

    writer := bufio.NewWriter(os.Stdout)
    // s(x) can be from 1 to 81
    var result []int64
    for i := 1; i <= 81; i++ {
        right := b * int64(math.Pow(float64(i), float64(a))) + c
        if right < 1000000000 {
            left := Sum(right)

            if left == int64(i) {
                Write(writer, left, right)
                result = append(result, right)
            }
        }
    }

    Write(writer, len(result))
    for i := range result {
        fmt.Fprint(writer, result[i])
        fmt.Fprint(writer, " ")
    }

    writer.Flush()
}

package main

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

func S(x int64) int64 {
	var res int64 = 0
	for x != 0 {
		res += x % 10
		x /= 10
	}
	return res
}

func Pow(x, a int64) int64 {
	var res int64 = 1
	for i := 0; int64(i) < a; i++ {
		res *= x
	}
	return res
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	var a, b, c int64
	fmt.Fscan(reader, &a, &b, &c)
	var num_res = 0
	var res []int64 = make([]int64, 40)
	for i := 0; i < 40; i++ {
		var x int64 = b*Pow(int64(i), a) + c
		if x < 1000000000 && S(x) == int64(i) {
			res[num_res] = x
			num_res++
		}
	}
	fmt.Fprintln(writer, num_res)
	for i := 0; i < num_res; i++ {
		fmt.Fprintf(writer, "%d ", res[i])
	}
	fmt.Fprintln(writer)
	writer.Flush()
}

package main

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

func S(x int64) int64 {
	var res int64 = 0
	for x != 0 {
		res += x % 10
		x /= 10
	}
	return res
}

func Pow(x, a int64) int64 {
	var res int64 = 1
	for i := 0; int64(i) < a; i++ {
		res *= x
	}
	return res
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	var a, b, c int64
	fmt.Fscan(reader, &a, &b, &c)
	var num_res = 0
	var res []int64 = make([]int64, 40)
	for i := 1; i < 40; i++ {
		var x int64 = b*Pow(int64(i), a) + c
		if x < 1000000000 && S(x) == int64(i) {
			res[num_res] = x
			num_res++
		}
	}
	fmt.Fprintln(writer, num_res)
	for i := 0; i < num_res; i++ {
		fmt.Fprintf(writer, "%d ", res[i])
	}
	fmt.Fprintln(writer)
	writer.Flush()
}