//New Year and Finding Roots
import java.io.*
import java.util.*
import kotlin.math.*
import kotlin.random.*
//small hint, fixes the 1 extra query case
fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	val random = Random(54321)

	for(q in 1..f.readLine().toInt()){
		val n = f.readLine().toInt()

		var answer = -1
		//store queries
		val queries = HashMap<Int,List<Int>>()
		//val seen = BooleanArray((1 shl (n+1)) + 2){false}

		fun query(i : Int) : List<Int>{
			if(queries.containsKey(i)) return queries[i]!!
			//seen[i] = true
			println("? $i")
			System.out.flush()

			val size = f.readLine().toInt()
			queries[i] = f.readLine().split(" ").map{it.toInt()}.toMutableList().shuffled(random)
			return queries[i]!!
		}

		if(n <= 4){
			//query every node
			for(k in 1 until (1 shl n)){
				if(query(k).size == 2){
					answer = k
					break
				}
			}
			println("! $answer")
			System.out.flush()
			continue
		}

		fun test(i : Int, pa : Int, d : Int) : Boolean{
			var cur = i
			var p = pa
			for(k in 0 until d-2){
				val neis = query(cur)
				if(neis.size == 1) return false
				if(neis.size == 2){
					answer = cur
					return true
				}
				//pick next
				for(nei in neis){
					if(nei == p) continue
					p = cur
					cur = nei
					break
				}
			}

			val last = query(cur)
			if(last.size == 2){
				answer = cur
				return true
			}
			return last.size == 1
		}

		//pick first node
		val first = random.nextInt(1,1 shl n)

		val initial = mutableListOf<Int>()
		initial.add(first)

		//query first
		val initialneis = query(first)

		if(initialneis.size == 2){
			println("! $first")
			System.out.flush()
			continue
		}

		if(initialneis.size == 1){
			var p = first
			var i = initialneis[0]

			while(true){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}
		} else {
			//size is 3
			//do one path
			var p = first
			var i = initialneis[0]

			while(answer == -1){
				initial.add(0,i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

			p = first
			i = initialneis[1]

			while(answer == -1){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

		}

		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}

		//get initial peak and initial depth
		//println(initial.joinToString(" "))
		val ipeak = initial[initial.size/2]
		val idepth = (initial.size+1)/2

		var next = -1
		for(posnext in queries[ipeak]!!){
			//if(posnext == initial[initial.size/2-1] || posnext == initial[initial.size/2+1]) continue
			if(queries.containsKey(posnext)) continue
			next = posnext
			break
		}

		var depth = idepth+1
		//println("$depth $next")
		if(depth == n){
			answer = next
		} else if(depth == n-1){
			val nextneis1 = query(next)
			for(nextnei in nextneis1){
				if(query(nextnei).size == 2){
					answer = nextnei
					break
				}
			}
		}

		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}

		var parent = ipeak
		while(depth < n-2 && answer == -1){
			//go depth-1 times from next
			val nextnei = query(next)
			if(nextnei.size == 2){
				answer = next
				break
			}

			//should have size 3
			//pick one
			var try1 = -1
			var try2 = -1
			for(posnei in nextnei){
				if(posnei == parent) continue
				if(try1 == -1) try1 = posnei
				else try2 = posnei
			}
			//println("$try1 $try2")
			//see if try1 works
			if(!test(try1,next,depth)){
				parent = next
				next = try1
			} else {
				parent = next
				next = try2
			}

			depth++
		}
		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}
		//on depth 5, ,
		//get the two nodes

		var n1 = -1
		var n2 = -1

		var nextneis = query(next)
		for(neis in nextneis){
			if(neis == parent) continue
			if(n1 == -1) n1 = neis
			else n2 = neis
		}

		val possibilities = mutableListOf<Int>()
		val n1neis = query(n1)
		val n2neis = query(n2)

		for(n1nei in n1neis) possibilities.add(n1nei)
		for(n2nei in n2neis) possibilities.add(n2nei)

		for(k in 0 until 3){
			if(query(possibilities[k]).size == 2){
				answer = possibilities[k]
				break
			}
		}

		if(answer == -1) answer = possibilities[3]

		println("! $answer")
		System.out.flush()

	}
}


//New Year and Finding Roots
import java.io.*
import java.util.*
import kotlin.math.*
import kotlin.random.*
//small hint
fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	val random = Random(1000)

	for(q in 1..f.readLine().toInt()){
		val n = f.readLine().toInt()

		var answer = -1
		//store queries
		val queries = HashMap<Int,IntArray>()
		val seen = BooleanArray((1 shl (n+1)) + 2){false}
		fun query(i : Int) : IntArray{
			if(seen[i]) return queries[i]!!
			seen[i] = true
			println("? $i")
			System.out.flush()

			val size = f.readLine().toInt()
			queries[i] = f.readLine().split(" ").map{it.toInt()}.toIntArray()
			return queries[i]!!
		}

		fun test(i : Int, d : Int) : Boolean{
			var cur = i
			for(k in 0 until d-2){
				val neis = query(cur)
				if(neis.size == 1) return false
				if(neis.size == 2){
					answer = cur
					return true
				}
				//pick next
				for(nei in neis){
					if(seen[nei]) continue
					cur = nei
					break
				}
			}

			val last = query(cur)
			if(last.size == 2){
				answer = cur
				return true
			}
			return last.size == 1
		}

		//pick first node
		val first = random.nextInt(1,n+1)

		val initial = mutableListOf<Int>()
		initial.add(first)

		//query first
		val initialneis = query(first)

		if(initialneis.size == 2){
			println("! $first")
			System.out.flush()
			continue
		}

		if(initialneis.size == 1){
			var p = first
			var i = initialneis[0]

			while(true){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}
		} else {
			//size is 3
			//do one path
			var p = first
			var i = initialneis[0]

			while(answer == -1){
				initial.add(0,i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

			p = first
			i = initialneis[1]

			while(answer == -1){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

		}

		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}

		//get initial peak and initial depth
		//println(initial.joinToString(" "))
		val ipeak = initial[initial.size/2]
		val idepth = (initial.size+1)/2

		var next = -1
		for(posnext in queries[ipeak]!!){
			//if(posnext == initial[initial.size/2-1] || posnext == initial[initial.size/2+1]) continue
			if(seen[posnext]) continue
			next = posnext
			break
		}

		var depth = idepth+1

		while(depth < 6 && answer == -1){
			//go depth-1 times from next
			val nextnei = query(next)
			if(nextnei.size == 2){
				answer = next
				break
			}

			//should have size 3
			//pick one
			var try1 = -1
			var try2 = -1
			for(posnei in nextnei){
				if(seen[posnei]) continue
				if(try1 == -1) try1 = posnei
				else try2 = posnei
			}

			//see if try1 works
			if(test(try1,depth)){
				next = try1
			} else {
				next = try2
			}

			depth++
		}
		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}
		//on depth 6, have two unseen neighbors,

		val last = query(next)
		for(lastnei in last){
			if(query(lastnei).size == 2){
				answer = lastnei
				break
			}
		}

		println("! $answer")
		System.out.flush()
	}
}


//New Year and Finding Roots
import java.io.*
import java.util.*
import kotlin.math.*
import kotlin.random.*
//small hint
fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	val random = Random(54321)

	for(q in 1..f.readLine().toInt()){
		val n = f.readLine().toInt()

		var answer = -1
		//store queries
		val queries = HashMap<Int,IntArray>()
		//val seen = BooleanArray((1 shl (n+1)) + 2){false}

		fun query(i : Int) : IntArray{
			if(queries.containsKey(i)) return queries[i]!!
			//seen[i] = true
			println("? $i")
			System.out.flush()

			val size = f.readLine().toInt()
			queries[i] = f.readLine().split(" ").map{it.toInt()}.toIntArray()
			return queries[i]!!
		}

		fun test(i : Int, pa : Int, d : Int) : Boolean{
			var cur = i
			var p = pa
			for(k in 0 until d-2){
				val neis = query(cur)
				if(neis.size == 1) return false
				if(neis.size == 2){
					answer = cur
					return true
				}
				//pick next
				for(nei in neis){
					if(nei == p) continue
					p = cur
					cur = nei
					break
				}
			}

			val last = query(cur)
			if(last.size == 2){
				answer = cur
				return true
			}
			return last.size == 1
		}

		//pick first node
		val first = random.nextInt(1,1 shl n)

		val initial = mutableListOf<Int>()
		initial.add(first)

		//query first
		val initialneis = query(first)

		if(initialneis.size == 2){
			println("! $first")
			System.out.flush()
			continue
		}

		if(initialneis.size == 1){
			var p = first
			var i = initialneis[0]

			while(true){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}
		} else {
			//size is 3
			//do one path
			var p = first
			var i = initialneis[0]

			while(answer == -1){
				initial.add(0,i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

			p = first
			i = initialneis[1]

			while(answer == -1){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

		}

		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}

		//get initial peak and initial depth
		//println(initial.joinToString(" "))
		val ipeak = initial[initial.size/2]
		val idepth = (initial.size+1)/2

		var next = -1
		for(posnext in queries[ipeak]!!){
			//if(posnext == initial[initial.size/2-1] || posnext == initial[initial.size/2+1]) continue
			if(queries.containsKey(posnext)) continue
			next = posnext
			break
		}

		var depth = idepth+1

		var parent = ipeak
		while(depth < n-1 && answer == -1){
			//go depth-1 times from next
			val nextnei = query(next)
			if(nextnei.size == 2){
				answer = next
				break
			}

			//should have size 3
			//pick one
			var try1 = -1
			var try2 = -1
			for(posnei in nextnei){
				if(posnei == parent) continue
				if(try1 == -1) try1 = posnei
				else try2 = posnei
			}
			//println("$try1 $try2")
			//see if try1 works
			if(!test(try1,next,depth)){
				parent = next
				next = try1
			} else {
				parent = next
				next = try2
			}

			depth++
		}
		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}
		//on depth 6, have two unseen neighbors,

		val last = query(next)

		if(last.size == 2){
			println("! $next")
			System.out.flush()
			continue
		}

		var a1 = -1
		var a2 = -1
		for(lastnei in last){
			if(!queries.containsKey(lastnei)){
				if(a1 == -1) a1 = lastnei
				else a2 = lastnei
			}
		}

		if(a2 == -1) answer = a1
		else{
			if(query(a1).size == 2) answer = a1
			else answer = a2
		}

		println("! $answer")
		System.out.flush()
	}
}


//New Year and Finding Roots
import java.io.*
import java.util.*
import kotlin.math.*
import kotlin.random.*
//small hint
fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	val random = Random(54321)

	for(q in 1..f.readLine().toInt()){
		val n = f.readLine().toInt()

		var answer = -1
		//store queries
		val queries = HashMap<Int,IntArray>()
		//val seen = BooleanArray((1 shl (n+1)) + 2){false}

		fun query(i : Int) : IntArray{
			if(queries.containsKey(i)) return queries[i]!!
			//seen[i] = true
			println("? $i")
			System.out.flush()

			val size = f.readLine().toInt()
			queries[i] = f.readLine().split(" ").map{it.toInt()}.toIntArray()
			return queries[i]!!
		}

		fun test(i : Int, d : Int) : Boolean{
			var cur = i
			for(k in 0 until d-2){
				val neis = query(cur)
				if(neis.size == 1) return false
				if(neis.size == 2){
					answer = cur
					return true
				}
				//pick next
				for(nei in neis){
					if(queries.containsKey(nei)) continue
					cur = nei
					break
				}
			}

			val last = query(cur)
			if(last.size == 2){
				answer = cur
				return true
			}
			return last.size == 1
		}

		//pick first node
		val first = random.nextInt(1,1 shl n)

		val initial = mutableListOf<Int>()
		initial.add(first)

		//query first
		val initialneis = query(first)

		if(initialneis.size == 2){
			println("! $first")
			System.out.flush()
			continue
		}

		if(initialneis.size == 1){
			var p = first
			var i = initialneis[0]

			while(true){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}
		} else {
			//size is 3
			//do one path
			var p = first
			var i = initialneis[0]

			while(answer == -1){
				initial.add(0,i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

			p = first
			i = initialneis[1]

			while(answer == -1){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

		}

		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}

		//get initial peak and initial depth
		//println(initial.joinToString(" "))
		val ipeak = initial[initial.size/2]
		val idepth = (initial.size+1)/2

		var next = -1
		for(posnext in queries[ipeak]!!){
			//if(posnext == initial[initial.size/2-1] || posnext == initial[initial.size/2+1]) continue
			if(queries.containsKey(posnext)) continue
			next = posnext
			break
		}

		var depth = idepth+1

		while(depth < n-1 && answer == -1){
			//go depth-1 times from next
			val nextnei = query(next)
			if(nextnei.size == 2){
				answer = next
				break
			}

			//should have size 3
			//pick one
			var try1 = -1
			var try2 = -1
			for(posnei in nextnei){
				if(queries.containsKey(posnei)) continue
				if(try1 == -1) try1 = posnei
				else try2 = posnei
			}
			//println("$try1 $try2")
			//see if try1 works
			if(!test(try1,depth)){
				next = try1
			} else {
				next = try2
			}

			depth++
		}
		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}
		//on depth 6, have two unseen neighbors,

		val last = query(next)
		var a1 = -1
		var a2 = -1
		for(lastnei in last){
			if(!queries.containsKey(lastnei)){
				if(a1 == -1) a1 = lastnei
				else a2 = lastnei
			}
		}

		if(a2 == -1) answer = a1
		else{
			if(query(a1.size) == 2) answer = a1
			else answer = a2
		}

		println("! $answer")
		System.out.flush()
	}
}


//New Year and Finding Roots
import java.io.*
import java.util.*
import kotlin.math.*
import kotlin.random.*
//small hint, fixes the 1 extra query case
fun main(){
	val f = BufferedReader(InputStreamReader(System.`in`))

	val random = Random(54321)

	for(q in 1..f.readLine().toInt()){
		val n = f.readLine().toInt()

		var answer = -1
		//store queries
		val queries = HashMap<Int,List<Int>>()
		//val seen = BooleanArray((1 shl (n+1)) + 2){false}

		fun query(i : Int) : List<Int>{
			if(queries.containsKey(i)) return queries[i]!!
			//seen[i] = true
			println("? $i")
			System.out.flush()

			val size = f.readLine().toInt()
			queries[i] = f.readLine().split(" ").map{it.toInt()}.toMutableList()
			return queries[i]!!
		}

		if(n <= 4){
			//query every node
			for(k in 1 until (1 shl n)){
				if(query(k).size == 2){
					answer = k
					break
				}
			}
			println("! $answer")
			System.out.flush()
			continue
		}

		fun test(i : Int, pa : Int, d : Int) : Boolean{
			var cur = i
			var p = pa
			for(k in 0 until d-2){
				val neis = query(cur)
				if(neis.size == 1) return false
				if(neis.size == 2){
					answer = cur
					return true
				}
				//pick next
				for(nei in neis){
					if(nei == p) continue
					p = cur
					cur = nei
					break
				}
			}

			val last = query(cur)
			if(last.size == 2){
				answer = cur
				return true
			}
			return last.size == 1
		}

		//pick first node
		val first = random.nextInt(1,1 shl n)

		val initial = mutableListOf<Int>()
		initial.add(first)

		//query first
		val initialneis = query(first)

		if(initialneis.size == 2){
			println("! $first")
			System.out.flush()
			continue
		}

		if(initialneis.size == 1){
			var p = first
			var i = initialneis[0]

			while(true){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}
		} else {
			//size is 3
			//do one path
			var p = first
			var i = initialneis[0]

			while(answer == -1){
				initial.add(0,i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

			p = first
			i = initialneis[1]

			while(answer == -1){
				initial.add(i)
				val cur = query(i)
				if(cur.size == 1){
					break
				}
				if(cur.size == 2){
					answer = i
					break
				}
				//get next
				for(nei in cur){
					if(nei == p) continue
					p = i
					i = nei
					break
				}
			}

		}

		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}

		//get initial peak and initial depth
		//println(initial.joinToString(" "))
		val ipeak = initial[initial.size/2]
		val idepth = (initial.size+1)/2

		var next = -1
		for(posnext in queries[ipeak]!!){
			//if(posnext == initial[initial.size/2-1] || posnext == initial[initial.size/2+1]) continue
			if(queries.containsKey(posnext)) continue
			next = posnext
			break
		}

		var depth = idepth+1
		//println("$depth $next")
		if(depth == n){
			answer = next
		} else if(depth == n-1){
			val nextneis1 = query(next)
			for(nextnei in nextneis1){
				if(query(nextnei).size == 2){
					answer = nextnei
					break
				}
			}
		}

		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}

		var parent = ipeak
		while(depth < n-2 && answer == -1){
			//go depth-1 times from next
			val nextnei = query(next)
			if(nextnei.size == 2){
				answer = next
				break
			}

			//should have size 3
			//pick one
			var try1 = -1
			var try2 = -1
			for(posnei in nextnei){
				if(posnei == parent) continue
				if(try1 == -1) try1 = posnei
				else try2 = posnei
			}
			//println("$try1 $try2")
			//see if try1 works
			if(!test(try1,next,depth)){
				parent = next
				next = try1
			} else {
				parent = next
				next = try2
			}

			depth++
		}
		if(answer != -1){
			println("! $answer")
			System.out.flush()
			continue
		}
		//on depth 5, ,
		//get the two nodes

		var n1 = -1
		var n2 = -1

		var nextneis = query(next)
		for(neis in nextneis){
			if(neis == parent) continue
			if(n1 == -1) n1 = neis
			else n2 = neis
		}

		val possibilities = mutableListOf<Int>()
		val n1neis = query(n1)
		val n2neis = query(n2)

		for(n1nei in n1neis){
			if(n1nei == next) continue
			possibilities.add(n1nei)
		}
		for(n2nei in n2neis){
			if(n2nei == next) continue
			possibilities.add(n2nei)
		}

		for(k in 0 until 3){
			if(query(possibilities[k]).size == 2){
				answer = possibilities[k]
				break
			}
		}

		if(answer == -1) answer = possibilities[3]

		println("! $answer")
		System.out.flush()

	}
}


import java.util.ArrayList
import java.io.FileInputStream
import java.lang.Math.min
import java.math.BigDecimal
import java.math.BigInteger

var MOD = 1000000007L

fun pwd(a: Long, p: Long) : Long {
    if (p == 0L) {
        return 1 % MOD
    }
    var res = pwd(a, p / 2)
    res = res * res % MOD
    if (p % 2 == 1L) {
        res = res * a % MOD
    }
    return res
}

var a = 0
var b = 0
var h = 0
var w = 0
var n = 0

fun main(args: Array<String>) {
    if (args.size > 0) {
        input = FileInputStream(args[0])
    }
    h = nextInt()
    w = nextInt()
    a = nextInt()
    b = nextInt()
    n = nextInt()
    var arr = ArrayList<Int>();
    for (i in 0..n-1) {
        arr.add(nextInt())
    }
    arr.sort()
    arr.reverse()
    println(solve(arr.take(38)))
}

fun solve(arr: List<Int>): Int {
    var ans = 1234
    ans = min(ans, trySolve(a, b, h, w, arr))
    ans = min(ans, trySolve(b, a, h, w, arr))
    return if (ans == 1234) -1 else ans
}

fun trySolve(a: Int, b: Int, h: Int, w: Int, arr: List<Int>): Int {
    if (h <= a && w <= b) {
        return 0
    }
    var dp = Array(100005) {Array<Int>(arr.size + 1) {0}}
    dp[a][0] = b
    for (i in 0..dp.size-1)
        for (j in 0..dp[0].size-2) {
            dp[i][j + 1] = Math.max(dp[i][j + 1], dp[i][j] * arr[j])
            var nextI = i * arr[j]
            if (nextI >= dp.size) {
                nextI = dp.size - 1
            }
            dp[nextI][j+1] = Math.max(dp[nextI][j], dp[i][j])
        }
    var ans = 1234
    for (i in 0..dp.size-1)
        for (j in 0..dp[0].size - 1) {
            if (h <= i && w <= dp[i][j]) {
                ans = min(ans, j)
            }
        }
    return ans
}

fun String.toBigInteger() = BigInteger(this)
fun String.toBigDecimal() = BigDecimal(this)

var input = System.`in`

val sb = StringBuilder()
val buffer = ByteArray(4096)
var pos = 0
var size = 0

fun nextString(): String? {
    var c = skipWhitespace()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        do {
            append(c.toChar())
            c = read()
        } while (c > ' '.toInt())

        toString()
    }
}

fun nextLine(): String? {
    var c = read()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        while (c >= 0 && c != '\n'.toInt()) {
            append(c.toChar())
            c = read()
        }

        toString()
    }
}

fun nextLong(): Long {
    var c = skipWhitespace()

    val sign = if (c == '-'.toInt()) {
        c = read()
        -1
    } else 1

    var ans = 0L

    while (c > ' '.toInt()) {
        ans = ans * 10 + c - '0'.toInt()
        c = read()
    }

    return sign * ans
}

fun nextInt() = nextLong().toInt()
fun nextDouble() = nextString()?.toDouble() ?: 0.0
fun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO
fun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO

private fun skipWhitespace(): Int {
    while (true) {
        val c = read()
        if (c > ' '.toInt() || c < 0) return c
    }
}

private fun read(): Int {
    while (pos >= size) {
        if (size < 0) return -1
        size = input.read(buffer, 0, buffer.size)
        pos = 0
    }
    return buffer[pos++].toInt()
}


import java.util.ArrayList
import java.io.FileInputStream
import java.lang.Math.min
import java.math.BigDecimal
import java.math.BigInteger

var MOD = 1000000007L

fun pwd(a: Long, p: Long) : Long {
    if (p == 0L) {
        return 1 % MOD
    }
    var res = pwd(a, p / 2)
    res = res * res % MOD
    if (p % 2 == 1L) {
        res = res * a % MOD
    }
    return res
}

var a = 0
var b = 0
var h = 0
var w = 0
var n = 0

fun main(args: Array<String>) {
    if (args.size > 0) {
        input = FileInputStream(args[0])
    }
    h = nextInt()
    w = nextInt()
    a = nextInt()
    b = nextInt()
    n = nextInt()
    var arr = ArrayList<Int>();
    for (i in 0..n-1) {
        arr.add(nextInt())
    }
    arr.sort()
    arr.reverse()
    println(solve(arr.take(38)))
}

fun solve(arr: List<Int>): Int {
    var ans = 1234
    ans = min(ans, trySolve(a, b, h, w, arr))
    ans = min(ans, trySolve(b, a, h, w, arr))
    return if (ans == 1234) -1 else ans
}

fun trySolve(a: Int, b: Int, h: Int, w: Int, arr: List<Int>): Int {
    if (h <= a && w <= b) {
        return 0
    }
    var dp = Array(100005) {Array<Long>(arr.size + 1) {0}}
    dp[a][0] = b+0L
    for (i in 0..dp.size-1)
        for (j in 0..dp[0].size-2) {
            dp[i][j + 1] = Math.max(dp[i][j + 1], Math.min(1234567, dp[i][j] * arr[j]))
            var nextI = i * arr[j]
            if (nextI >= dp.size) {
                nextI = dp.size - 1
            }
            dp[nextI][j+1] = Math.max(dp[nextI][j], dp[i][j])
        }
    var ans = 1234
    for (i in 0..dp.size-1)
        for (j in 0..dp[0].size - 1) {
            if (h <= i && w <= dp[i][j]) {
                ans = min(ans, j)
            }
        }
    return ans
}

fun String.toBigInteger() = BigInteger(this)
fun String.toBigDecimal() = BigDecimal(this)

var input = System.`in`

val sb = StringBuilder()
val buffer = ByteArray(4096)
var pos = 0
var size = 0

fun nextString(): String? {
    var c = skipWhitespace()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        do {
            append(c.toChar())
            c = read()
        } while (c > ' '.toInt())

        toString()
    }
}

fun nextLine(): String? {
    var c = read()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        while (c >= 0 && c != '\n'.toInt()) {
            append(c.toChar())
            c = read()
        }

        toString()
    }
}

fun nextLong(): Long {
    var c = skipWhitespace()

    val sign = if (c == '-'.toInt()) {
        c = read()
        -1
    } else 1

    var ans = 0L

    while (c > ' '.toInt()) {
        ans = ans * 10 + c - '0'.toInt()
        c = read()
    }

    return sign * ans
}

fun nextInt() = nextLong().toInt()
fun nextDouble() = nextString()?.toDouble() ?: 0.0
fun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO
fun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO

private fun skipWhitespace(): Int {
    while (true) {
        val c = read()
        if (c > ' '.toInt() || c < 0) return c
    }
}

private fun read(): Int {
    while (pos >= size) {
        if (size < 0) return -1
        size = input.read(buffer, 0, buffer.size)
        pos = 0
    }
    return buffer[pos++].toInt()
}


import java.util.ArrayList
import java.io.FileInputStream
import java.lang.Math.min
import java.math.BigDecimal
import java.math.BigInteger

var MOD = 1000000007L

fun pwd(a: Long, p: Long) : Long {
    if (p == 0L) {
        return 1 % MOD
    }
    var res = pwd(a, p / 2)
    res = res * res % MOD
    if (p % 2 == 1L) {
        res = res * a % MOD
    }
    return res
}

var a = 0
var b = 0
var h = 0
var w = 0
var n = 0

fun main(args: Array<String>) {
    if (args.size > 0) {
        input = FileInputStream(args[0])
    }
    h = nextInt()
    w = nextInt()
    a = nextInt()
    b = nextInt()
    n = nextInt()
    var arr = ArrayList<Long>();
    for (i in 0..n-1) {
        arr.add(nextLong())
    }
    arr.sort()
    arr.reverse()
    println(solve(arr.take(38)))
}

fun solve(arr: List<Long>): Int {
    var ans = 1234
    ans = min(ans, trySolve(a, b, h, w, arr))
    ans = min(ans, trySolve(b, a, h, w, arr))
    return if (ans == 1234) -1 else ans
}

fun trySolve(a: Int, b: Int, h: Int, w: Int, arr: List<Long>): Int {
    if (h <= a && w <= b) {
        return 0
    }
    val dp = Array(100005) {Array<Long>(arr.size + 1) {0}}
    dp[a][0] = b + 0L
    for (i in 0..dp.size - 1) {
        for (j in 0..arr.size - 1) if (dp[i][j] > 0){
            dp[i][j + 1] = Math.max(dp[i][j + 1], Math.min(1234567, dp[i][j] * arr[j]))
            val nextI = min(i * arr[j], dp.size - 1L).toInt()
            dp[nextI][j + 1] = Math.max(dp[nextI][j+1], dp[i][j])
        }
    }
    var ans = 1234
    for (i in 0..dp.size-1) {
        for (j in 0..arr.size) {
            if (h <= i && w <= dp[i][j]) {
                ans = min(ans, j)
            }
        }
    }
    return ans
}

fun String.toBigInteger() = BigInteger(this)
fun String.toBigDecimal() = BigDecimal(this)

var input = System.`in`

val sb = StringBuilder()
val buffer = ByteArray(4096)
var pos = 0
var size = 0

fun nextString(): String? {
    var c = skipWhitespace()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        do {
            append(c.toChar())
            c = read()
        } while (c > ' '.toInt())

        toString()
    }
}

fun nextLine(): String? {
    var c = read()
    if (c < 0) return null

    return sb.run {
        setLength(0)

        while (c >= 0 && c != '\n'.toInt()) {
            append(c.toChar())
            c = read()
        }

        toString()
    }
}

fun nextLong(): Long {
    var c = skipWhitespace()

    val sign = if (c == '-'.toInt()) {
        c = read()
        -1
    } else 1

    var ans = 0L

    while (c > ' '.toInt()) {
        ans = ans * 10 + c - '0'.toInt()
        c = read()
    }

    return sign * ans
}

fun nextInt() = nextLong().toInt()
fun nextDouble() = nextString()?.toDouble() ?: 0.0
fun nextBigInteger(): BigInteger = nextString()?.toBigInteger() ?: BigInteger.ZERO
fun nextBigDecimal(): BigDecimal = nextString()?.toBigDecimal() ?: BigDecimal.ZERO

private fun skipWhitespace(): Int {
    while (true) {
        val c = read()
        if (c > ' '.toInt() || c < 0) return c
    }
}

private fun read(): Int {
    while (pos >= size) {
        if (size < 0) return -1
        size = input.read(buffer, 0, buffer.size)
        pos = 0
    }
    return buffer[pos++].toInt()
}


fun parse_int(): MutableList<Int> {
    return readLine()!!.split(' ').map {x: String -> x.toInt()}.toMutableList()
}

fun main(args: Array<String>) {
    val inp  = readLine()!!.trim()
    var odds = 0
    var vowels = 0

    for (c in inp) {
        if (c.isDigit()) {
            odds += c.toInt() % 2
        } else {
            if (c in "aeiou") vowels += 1
        }
    }

    println(odds + vowels)

}


fun main() {
    //println((4 or 6)xor(4 or 5))
    val r = System.`in`.bufferedReader()
    val s = StringBuilder()
    //val n = r.readLine()!!.toInt()
    val list = listOf("a", "e", "i", "o", "u", "1", "3", "5", "7", "9")
    val v = r.readLine()!!.split("").filter { it.isNotEmpty() }.count { it in list }
    println(v)
}


import java.util.*

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    val arr = next().toCharArray().filter { it.vowel() }
    print("${arr.size}")
}

fun Char.vowel(): Boolean {
    val v = arrayListOf('a', 'e', 'i', 'o', 'u', '1', '3', '5', '7', '9')
    return v.filter { it == this }.any()
}


fun main(args: Array<String>) = with(java.util.Scanner(System.`in`)) {
    var s = readLine()!!
    var (res, entahapa) = s.partition { (it.isDigit() && it.toInt()%2==1) || it == 'a' || it == 'u' || it == 'o' || it == 'i' || it == 'e' }
    println(res.count())
}


import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

private val reader = BufferedReader(InputStreamReader(System.`in`))
private val out = PrintWriter(System.out)
private var st = StringTokenizer("")

fun next(): String {
    while (!st.hasMoreTokens())
        st = StringTokenizer(reader.readLine())
    return st.nextToken()
}

fun ni() = next().toInt()
fun nl() = next().toLong()
fun nd() = next().toDouble()
fun print(obj: Any) = out.print(obj)
fun close() = out.close()

fun main(args: Array<String>) {
    val text = next()
    val v = setOf('a', 'e', 'i', 'o', 'u')
    val range = 1..10 step 2
    val odd = range.flatMap { n -> listOf(text.filter { (it.toInt()-'0'.toInt()) == n }.count()) }.reduce({ x, y -> x + y });
    print(text.filter { it in v }.count()+odd)
    close()
}


import kotlin.*

fun main(args: Array<String>) {
    var vowelsAndEvens = setOf(
            'a', 'o', 'e', 'u', 'i',
            '1', '3', '5', '7', '9'
    )

    var string = readLine() ?: ""
    println(string.count { it in vowelsAndEvens })

}


fun main() = println(readLine()!!.count { it in "aeiou13579" })


fun main(args: Array<String>) {
    val a = readLine()!!.trim()
    val voewels = arrayOf('a','e','i','o','u')
    val odds = arrayOf('1','3','5','7','9')
    val r = a.count { it in voewels || it in odds }
    println(r)
}


fun main(args: Array<String>) {
    var a = readLine()!!
    var ans = 0
    for (c in a){
        if (c.isDigit()){
            var cur = ((c.toInt())%2 == 1)
            if(cur){
                ans+=1
            }
        }else {
            if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'){
                ans += 1
            }
        }
    }
    println(ans)

}


import java.util.*

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    val res = next().toCharArray()
            .filter { c -> arrayListOf('a', 'e', 'i', 'o', 'u', '1', '3', '5', '7', '9')
                    .filter { it == c }.any() }.size
    print(res)
}


import java.util.*

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    val arr = next().toCharArray().filter { it.vowel() }
    print("${arr.size}")
}

fun Char.vowel(): Boolean {
    val v = arrayListOf('a', 'e', 'i', 'o', 'u', '0', '2', '4', '6', '8')
    return v.filter { it == this }.any()
}


import kotlin.*

fun main(args: Array<String>) {
    var vowelsAndEvens = setOf(
            'a', 'o', 'e', 'u', 'i',
            '0', '2', '4', '6', '8')

    var string = readLine() ?: ""
    println(string.count { it in vowelsAndEvens })

}


fun main(args: Array<String>) {
    val a = readLine()!!.trim()
    val voewels = arrayOf('a','e','i','o','u')
    val evens = arrayOf('0','2','4','6','8')
    val r = a.count { it in voewels || it in evens }
    println(r)
}


import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

private val reader = BufferedReader(InputStreamReader(System.`in`))
private val out = PrintWriter(System.out)
private var st = StringTokenizer("")

fun next(): String {
    while (!st.hasMoreTokens())
        st = StringTokenizer(reader.readLine())
    return st.nextToken()
}

fun ni() = next().toInt()
fun nl() = next().toLong()
fun nd() = next().toDouble()
fun print(obj: Any) = out.print(obj)
fun close() = out.close()

fun main(args: Array<String>) {
    val text = next()
    val v = setOf('a', 'e', 'i', 'o', 'u', '0', '2', '4', '6', '8')
    print(text.filter { it in v }.count())
    close()
}


fun main(args: Array<String>) = with(java.util.Scanner(System.`in`)) {
    var s = readLine()!!
    var (res, entahapa) = s.partition { (it.isDigit() && it.toInt()%2==0) || it == 'a' || it == 'u' || it == 'o' || it == 'i' || it == 'e' }
    println(res.count())
}


import java.util.*

fun main(args: Array<String>) = with(Scanner(System.`in`)) {
    val arr = next().toCharArray().filter { it.vowel() }
    print("${arr.size}")
}

fun Char.vowel(): Boolean = this == 'a' || this == 'e' || this == 'i' || this == 'o' || this == 'u' || this == 'y'


import java.util.*

fun main(args: Array<String>) {
    val vowels = listOf('a', 'e', 'i', 'o', 'u')
    val digits = "1234567890".toList()
    val s = Scanner(System.`in`)
    with(s) {
        var total = 0
        nextLine()
            .forEach {
                when (it) {
                    in vowels -> {
                        total++
                    }

                    in digits -> {
                        if (it.toInt() % 2 == 0) {
                            total++
                        }
                    }
                }
            }
        println(total)
    }
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val n = sc.nextInt()

    val a = Array(n) { sc.nextInt() }
    val b = a.sortedArray()

    val res = Array(n) { 0 }

    for (i in 0 until n) {
        res[a.indexOf(b[(n + i - 1) % n])] = b[i]
    }

    println(res.joinToString(" "))
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val n = sc.nextInt()

    val a = Array(n) { sc.nextInt() }
    val b = a.sortedArray()

    val res = Array(n) { 0 }

    for (i in 0 until n) {
        res[a.indexOf(b[i])] = b[(i + 1) % n]
    }

    println(res.joinToString(" "))
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


fun main() {
    val (x1, x2) = readInts()
    val n = minOf(x1, x2)
    val m = maxOf(x1, x2)
    val fib = LongArray(m)
    fib[0] = 1
    fib[1] = 1
    for(i in 2 until m) {
        fib[i] = (fib[i - 1] + fib[i - 2]) % mod
    }
    val f0 = LongArray(n + 1)
    f0[1] = fib[m - n + 1]
    for (i in 2..n) {
        f0[i] = (f0[i - 1] + fib[i - 2] + fib[m - n + i - 2]) % mod
    }
    println((f0[n] * 2) % mod)
}

private val mod = 1000000007L

private fun readString() = readLine()!!

private fun readInt() = readString().toInt()

private fun readInts() = readString().split(" ").map { it.toInt() }

private fun readLong() = readString().toLong()

private fun readLongs() = readString().split(" ").map { it.toLong() }


import java.lang.Integer.*
import java.util.Scanner

val MOD: Long = 1000000000 + 7
var fibs: HashMap<Int, Long> = HashMap<Int, Long>()

fun countFib(n: Int): Long {
    if (fibs.containsKey(n)) {
        return fibs[n]!!
    }
    if (n <= 0) {
        fibs[n] = 1
        return 1
    }

    fibs[n] = countFib(n - 1) + countFib(n - 2)
    return fibs[n]!!
}

fun F(n: Int, m: Int) : Long {
    // n >= m
    if (m == 1) {
        return (countFib(n - 1) + countFib(n - 1)) % MOD
    }

    var ans: Long = 0
    ans = (ans + countFib(m - 3)) % MOD
    ans = (ans + countFib(n - 3)) % MOD
    for (i in 2 until n) {
        if (n - i - 1 >= 0) {
            ans = (ans + countFib(n - i - 1)) % MOD
        }
    }

    ans = (ans + countFib(m - 2)) % MOD
    return (ans + ans) % MOD
}

fun main(args: Array<String>) {
    fibs[0] = 1
    fibs[-1] = 1
    for (i in 1 until 100000 + 1) {
        fibs[i] = fibs[i - 1]!! + fibs[i - 2]!!
    }

    val input = Scanner(System.`in`)
    val n = input.nextInt()
    val m = input.nextInt()

    val ans = F(max(n, m), min(n, m))
    println(ans)
//    for (v in fibs) {
//        println (v.key.toString() +  " " + v.value.toString())
//    }
}


import java.lang.Integer.*
import java.util.Scanner

val MOD: Long = 1000000000 + 7
var fibs: HashMap<Int, Long> = HashMap<Int, Long>()

fun countFib(n: Int): Long {
    if (fibs.containsKey(n)) {
        return fibs[n]!!
    }
    if (n <= 0) {
        fibs[n] = 1
        return 1
    }

    fibs[n] = countFib(n - 1) + countFib(n - 2)
    return fibs[n]!!
}

fun F(n: Int, m: Int) : Long {
    // n >= m
    if (m == 1) {
        return (countFib(n - 1) + countFib(n - 1)) % MOD
    }

    var ans: Long = 0
    ans = (ans + countFib(m - 3)) % MOD
    ans = (ans + countFib(n - 3)) % MOD
    for (i in 2 until n) {
        ans = (ans + countFib(n - i - 2)) % MOD
    }

    ans = (ans + countFib(m - 2)) % MOD
    return (ans + ans) % MOD
}

fun main(args: Array<String>) {
    fibs[0] = 1
    fibs[-1] = 1
    for (i in 1 until 100000 + 1) {
        fibs[i] = fibs[i - 1]!! + fibs[i - 2]!!
    }

    val input = Scanner(System.`in`)
    val n = input.nextInt()
    val m = input.nextInt()

    val ans = F(max(n, m), min(n, m))
    println(ans)
//    for (v in fibs) {
//        println (v.key.toString() +  " " + v.value.toString())
//    }
}


import java.lang.Integer.*
import java.util.Scanner

val MOD: Long = 1000000000 + 7
var fibs: HashMap<Int, Long> = HashMap<Int, Long>()

fun createMod(n : Long) : Long {
    return (n + MOD) % MOD
}

fun countFib(n: Int): Long {
    if (fibs.containsKey(n)) {
        return fibs[n]!!
    }
    if (n <= 0) {
        fibs[n] = 1
        return 1
    }

    fibs[n] = countFib(n - 1) + countFib(n - 2)
    return fibs[n]!!
}

fun F(n: Int, m: Int) : Long {
    // n >= m
    if (m == 1) {
        return createMod(countFib(n - 1) + countFib(n - 1))
    }

    var ans: Long = 0
    ans = createMod(ans + countFib(m - 3))
    ans = createMod(ans + countFib(n - 3))
    for (i in 2 until n) {
        ans = createMod(ans + countFib(n - i - 2))
    }

    ans = createMod(ans + countFib(m - 2))
    return (ans + ans) % MOD
}

fun main(args: Array<String>) {
    fibs[0] = 1
    fibs[-1] = 1
    for (i in 1 until 100000 + 1) {
        fibs[i] = createMod (fibs[i - 1]!! + fibs[i - 2]!!)
    }

    val input = Scanner(System.`in`)
    val n = input.nextInt()
    val m = input.nextInt()

    val ans = F(max(n, m), min(n, m))
    println(ans)
//    for (v in fibs) {
//        println (v.key.toString() +  " " + v.value.toString())
//    }
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING")

import java.io.PrintWriter
import java.util.StringTokenizer
import java.util.TreeMap
import java.util.TreeSet
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln // immediate println for interactive

fun main() {
    output {
        val n = readInt()
        val m = readInt()

        val F = ModIntArray(max(n, m) + 1)
        F[0] = ModInt(1)
        F[1] = ModInt(1)

        for(i in 2..F.lastIndex) {
            F[i] = F[i-1] + F[i-2]
        }

        val ans = (F[n] + F[m] - 1) * 2

        println(ans)
    }
}

const val BILLION7 = 1e9.toInt() + 7
const val MODINT_BASE = BILLION7
const val MODINT_TOTIENT = MODINT_BASE - 1 // assumes MODINT_BASE is prime

inline infix fun Int.umod(base: Int) = Math.floorMod(this, base)
inline infix fun Long.umod(base: Long) = Math.floorMod(this, base)
inline infix fun Long.umod(base: Int) = Math.floorMod(this, base.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = (toLong() * other).umod(mod)

fun Int.powMod(exponent: Int, mod: Int): Int {
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MODINT_BASE)
inline fun Long.toModInt() = ModInt(this umod MODINT_BASE)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    inline operator fun plus(other: ModInt) = plus(other.int) // MODINT_BASE < 2^30
    inline operator fun plus(other: Int) =  (int + other).toModInt() // careful of possible overflow
    inline operator fun inc() = plus(1)

    inline operator fun minus(other: ModInt) = minus(other.int)
    inline operator fun minus(other: Int) = (int - other).toModInt()
    inline operator fun dec() = minus(1)
    operator fun unaryMinus() = if(int == 0) this else ModInt(MODINT_BASE - int)

    inline operator fun times(other: ModInt) = times(other.int)
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MODINT_BASE))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) exponent umod MODINT_TOTIENT else exponent
        return ModInt(int.powMod(e, MODINT_BASE))
    }

    fun pow(exponent: Long) = pow(exponent umod MODINT_TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(MODINT_TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override fun toString() = int.toString()
}

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override fun contains(element: ModInt): Boolean = any { it == element }

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }
}
fun ModIntArray(capacity: Int) = ModIntArray(IntArray(capacity))
inline fun ModIntArray(capacity: Int, init: (Int) -> ModInt) =
    ModIntArray(IntArray(capacity) { init(it).int })

fun Iterable<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Sequence<ModInt>.sum() = fold(ModInt(0), ModInt::plus)
fun Iterable<ModInt>.product() = fold(ModInt(1), ModInt::times)
fun Sequence<ModInt>.product() = fold(ModInt(1), ModInt::times)

/** IO code start */
@JvmField val _reader = System.`in`.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(System.out, false)
inline fun output(block: PrintWriter.()->Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val m = sc.nextInt()
    val a = Array(100005) { 0 }
    val mod = 1000000007
    a[1] = 2
    a[2] = 4
    for (i in 3..100000) {
        a[i] = a[i - 1] + a[i - 2]
        a[i] %= mod
    }
    println((a[n] + a[m] - 2) % mod)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


import java.util.*
import java.math.*

fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readInts()  = readLn().split(" ").map{it.toInt()}

val MOD = 1000000007;

fun main(args: Array<String>) {
	var (n,m) = readInts()
	var sz = IntArray(maxOf(n,m,10)+1)
	sz[0]=1
	sz[1]=1
	for(i in 2..sz.size-1) {
		sz[i]=(sz[i-1]+sz[i-2])%MOD
	}
	println(2L*((sz[n]+sz[m])%MOD+MOD-1)%MOD)
}


import java.io.*
import kotlin.concurrent.thread
import java.io.IOException
import java.io.BufferedReader
import java.io.InputStream
import kotlin.*
import java.*
import java.io.OutputStream
import java.io.PrintWriter
import java.lang.ArithmeticException
import java.lang.Exception
import java.math.BigInteger
import java.security.cert.TrustAnchor
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashSet
import kotlin.system.exitProcess

fun main() {
    val inputStream = System.`in`
    val outputStream = System.out
    val `in` = InputReader(inputStream)
    val out = PrintWriter(outputStream)
    val mod = 1000*1000*1000+7

    fun add(a:Int,b:Int):Int{
        if (a+b>=mod)
            return a+b-mod
        return a+b
    }
    fun sub(a:Int,b:Int):Int{
        if (a>=b)
            return a-b
        return a-b+mod
    }

    fun mul(a:Int,b:Int):Int{
        return (a.toLong()*b.toLong()%mod).toInt()
    }

    val n=`in`.nextInt()
    val m=`in`.nextInt()

    val dp=IntArray(n+1)
    dp[0]=1
    dp[1]=1
    for (i in 2..n){
        dp[i]=add(dp[i-1],dp[i-2])
    }
    val dp2=IntArray(m+1)
    dp2[0]=1
    dp2[1]=1
    for (i in 2..m){
        dp2[i]=add(dp2[i-1],dp2[i-2])
    }

    out.println(mul(2,sub(add(dp[n],dp2[m]),1)))

    out.close()

}

internal class InputReader(stream: InputStream) {
    var reader: BufferedReader
    var tokenizer: StringTokenizer? = null

    init {
        reader = BufferedReader(InputStreamReader(stream), 32768)
        tokenizer = null
    }

    operator fun next(): String {
        while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
            try {
                tokenizer = StringTokenizer(reader.readLine())
            } catch (e: IOException) {
                throw RuntimeException(e)
            }

        }
        return tokenizer!!.nextToken()
    }

    fun nextInt(): Int {
        return Integer.parseInt(next())
    }

    fun nextLong(): Long {
        return next().toLong()
    }

}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val n = readInt()
    val m = readInt()

    val ans = (fibonacci(n+1) + fibonacci(m+1) - 1) * 2

    println(ans)
}

fun fibonacci(n: Long): ModInt {
    var a = ModInt(0)
    var b = ModInt(1)
    var c = ModInt(0)
    var d = ModInt(1)

    var e = n
    while(e > 0) {
        if(e and 1 == 1L) {
            a = (a * c + b * d).also {
                b = a * d + b * (c + d)
            }
        }
        e = e shr 1
        c = (c * c + d * d).also {
            d *= c + c + d
        }
    }

    return a
}
inline fun fibonacci(n: Int) = fibonacci(n.toLong())

const val BILLION7 = 1e9.toInt() + 7
const val MOD = BILLION7
const val TOTIENT = MOD - 1 // assumes MOD is prime

infix fun Int.umod(mod: Int): Int = (this % mod).let { (it shr Int.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Long) = (this % mod).let { (it shr Long.SIZE_BITS - 1 and mod) + it }
infix fun Long.umod(mod: Int) = umod(mod.toLong()).toInt()

fun Int.mulMod(other: Int, mod: Int) = toLong() * other umod mod

fun Int.powMod(exponent: Int, mod: Int): Int {
    if(exponent < 0) error("Inverse not implemented")
    var res = 1L
    var e = exponent
    var b = umod(mod).toLong()

    while(e > 0) {
        if(e and 1 == 1) {
            res = res * b % mod
        }
        e = e shr 1
        b = b * b % mod
    }
    return res.toInt()
}

inline fun Int.toModInt() = ModInt(this umod MOD)
inline fun Long.toModInt() = ModInt(this umod MOD)

/** note: Only use constructor for int within modulo range, otherwise use toModInt **/
inline class ModInt(val int: Int) {
    companion object {
        /** can't seem to make these private or inlined without causing compiler issues */
        @JvmField val _invMemo = HashMap<ModInt, ModInt>()
        fun _invMemoized(m: ModInt) = _invMemo.getOrPut(m) { m.inv_unmemoized() }
    }

    // normalizes an integer that's within range [-MOD, MOD) without branching
    private inline fun normalize(int: Int) = ModInt((int shr Int.SIZE_BITS - 1 and MOD) + int)

    operator fun plus(other: ModInt) = normalize(int + other.int - MOD) // overflow-safe even if MOD >= 2^30
    inline operator fun plus(other: Int) = plus(other.toModInt())
    operator fun inc() = normalize(int + (1 - MOD))

    operator fun minus(other: ModInt) = normalize(int - other.int)
    inline operator fun minus(other: Int) = minus(other.toModInt())
    operator fun dec() = normalize(int - 1)
    operator fun unaryMinus() = normalize(-int)

    operator fun times(other: ModInt) = ModInt((int.toLong() * other.int % MOD).toInt())
    inline operator fun times(other: Int) = ModInt(int.mulMod(other, MOD))

    fun pow(exponent: Int): ModInt {
        val e = if(exponent < 0) {
            require(int != 0) { "Can't invert/divide by 0" }
            exponent umod TOTIENT
        } else exponent
        return ModInt(int.powMod(e, MOD))
    }

    fun pow(exponent: Long) = if(int == 0) when {
        exponent > 0 -> this
        exponent == 0L -> ModInt(1)
        else -> error("Can't invert/divide by 0")
    } else pow(exponent umod TOTIENT)

    inline fun inverse() = inv_memoized() /** NOTE: Change if necessary */

    fun inv_unmemoized(): ModInt {
        require(int != 0) { "Can't invert/divide by 0" }
        return pow(TOTIENT - 1)
    }
    inline fun inv_memoized() = _invMemoized(this)

    operator fun div(other: ModInt) = times(other.inverse())
    inline operator fun div(other: Int) = div(other.toModInt())

    override inline fun toString() = int.toString()
}

inline operator fun Int.plus(modInt: ModInt) = modInt + this
inline operator fun Int.minus(modInt: ModInt) = toModInt() - modInt
inline operator fun Int.times(modInt: ModInt) = modInt * this
inline operator fun Int.div(modInt: ModInt) = modInt.inverse() * this

inline class ModIntArray(val intArray: IntArray): Collection<ModInt> {
    inline operator fun get(i: Int) = ModInt(intArray[i])
    inline operator fun set(i: Int, v: ModInt) { intArray[i] = v.int }

    override inline val size: Int get() = intArray.size
    inline val lastIndex get() = intArray.lastIndex
    inline val indices get() = intArray.indices

    override inline fun contains(element: ModInt): Boolean = element.int in intArray

    override fun containsAll(elements: Collection<ModInt>): Boolean = elements.all(::contains)

    override inline fun isEmpty(): Boolean = intArray.isEmpty()

    override fun iterator(): Iterator<ModInt> = object: Iterator<ModInt> {
        var index = 0
        override fun hasNext(): Boolean = index < size
        override fun next(): ModInt = get(index++)
    }

    fun copyOf(newSize: Int) = ModIntArray(intArray.copyOf(newSize))
    fun copyOf() = copyOf(size)
}
fun ModIntArray.copyInto(destination: ModIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size) =
    ModIntArray(intArray.copyInto(destination.intArray, destinationOffset, startIndex, endIndex))
inline fun ModIntArray(size: Int) = ModIntArray(IntArray(size))
inline fun ModIntArray(size: Int, init: (Int) -> ModInt) = ModIntArray(IntArray(size) { init(it).int })

inline fun ModIntArray.first() = get(0)
inline fun ModIntArray.last() = get(lastIndex)
inline fun <R> ModIntArray.fold(init: R, op: (acc: R, ModInt) -> R) = intArray.fold(init) { acc, i -> op(acc, ModInt(i)) }
fun ModIntArray.sum() = fold(ModInt(0), ModInt::plus)
fun ModIntArray.product() = fold(ModInt(1), ModInt::times)

inline fun <T> Iterable<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Iterable<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
inline fun <T> Sequence<T>.sumByModInt(func: (T) -> ModInt) = fold(ModInt(0)) { acc, t -> acc + func(t) }
inline fun <T> Sequence<T>.productByModInt(func: (T) -> ModInt) = fold(ModInt(1)) { acc, t -> acc * func(t) }
fun Iterable<ModInt>.sum() = sumByModInt { it }
fun Sequence<ModInt>.sum() = sumByModInt { it }
fun Iterable<ModInt>.product() = productByModInt { it }
fun Sequence<ModInt>.product() = productByModInt { it }
fun Collection<ModInt>.toModIntArray() = ModIntArray(size).also { var i = 0; for(e in this) { it[i++] = e } }

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

//@JvmField var _random: Random? = null
val random = Random(0x594E215C123 * System.nanoTime())

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


fun main() {
    val digitToOptions = listOf(2, 7, 2, 3, 3, 4, 2, 5, 1, 2)
//    print(readLine()!!.fold(1) { acc, c -> acc * digitToOptions[c - '0'] }) // A shorter alternative, less readable
    var sol = 1
    for (c in readLine()!!) sol *= digitToOptions[c - '0']
    print(sol)
}


import java.io.InputStream

private val MOD = 1e9.toInt() + 7

private val input = FastScanner()

fun main(args: Array<String>) = input.run {
    val n = nextInt()
    val a = nextInts(n)
    val dpA = IntArray(n + 1)
    val dpB = IntArray(n + 1)

    (1..n).forEach {
        val i = n - it
        dpA[it] = Math.max(a[i] + dpB[it - 1], dpA[it - 1])
        dpB[it] = Math.min(a[i] + dpB[it - 1], dpA[it - 1])
    }

    val alice = dpB[n]
    val bob = a.sum() - dpB[n]
    println("$alice $bob")
}

class FastScanner(private val input: InputStream = System.`in`) {
    private val sb = StringBuilder()
    private val buffer = ByteArray(4096)
    private var pos = 0
    private var size = 0

    fun nextString(): String? {
        var c = skipWhitespace()
        if (c < 0) return null

        return sb.run {
            setLength(0)

            do {
                append(c.toChar())
                c = read()
            } while (c > ' '.toInt())

            toString()
        }
    }

    fun nextLine(): String? {
        var c = read()
        if (c < 0) return null

        return sb.run {
            setLength(0)

            while (c >= 0 && c != '\n'.toInt()) {
                append(c.toChar())
                c = read()
            }

            toString()
        }
    }

    fun nextLong(): Long {
        var c = skipWhitespace()

        val sign = if (c == '-'.toInt()) {
            c = read()
            -1
        } else 1

        var ans = 0L

        while (c > ' '.toInt()) {
            ans = ans * 10 + c - '0'.toInt()
            c = read()
        }

        return sign * ans
    }

    fun nextInt() = nextLong().toInt()
    fun nextDouble() = nextString()?.toDouble() ?: 0.0

    fun nextStrings(n: Int) = Array<String>(n) { nextString() ?: "" }
    fun nextInts(n: Int) = IntArray(n) { nextInt() }
    fun nextLongs(n: Int) = LongArray(n) { nextLong() }
    fun nextDoubles(n: Int) = DoubleArray(n) { nextDouble() }

    fun nextStrings(n: Int, m: Int) = Array(n) { nextStrings(m) }
    fun nextInts(n: Int, m: Int) = Array(n) { nextInts(m) }
    fun nextLongs(n: Int, m: Int) = Array(n) { nextLongs(m) }
    fun nextDoubles(n: Int, m: Int) = Array(n) { nextDoubles(m) }

    private fun skipWhitespace(): Int {
        while (true) {
            val c = read()
            if (c > ' '.toInt() || c < 0) return c
        }
    }

    private fun read(): Int {
        while (pos >= size) {
            if (size < 0) return -1
            size = input.read(buffer, 0, buffer.size)
            pos = 0
        }
        return buffer[pos++].toInt()
    }
}


import kotlin.math.sqrt

fun main() {
    fun fac(i: Long): Set<Long> {
        val a = mutableSetOf<Long>()
        (1..sqrt(i.toDouble()).toInt()).forEach {
            if (i % it == 0L) {
                a += it.toLong()
                a += i / it
            }
        }
        return a
    }

    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val b = 1000000007L
    //val v = r.readLine()!!.split("").filter { it.isNotEmpty() }
    val (max, len) = r.readLine()!!.split(" ").map { it.toInt() }
    // i : num to res
    val dp = Array(len) { mutableMapOf<Long, Long>() }
    fun f(n: Long, i: Int): Long {
        var ans = 0L
        when {
            dp[i].containsKey(n) -> return dp[i][n]!!
            i == 0 -> {
                dp[i][n] = 1
                return dp[i][n]!!
            }
            else -> {
                val fac = fac(n)
                fac.forEach {
                    ans += f(n/it, i-1)
                }
            }
        }
        dp[i][n] = ans%b
        return dp[i][n]!!
    }
    println((1..max).fold(0L){acc, i -> (acc + f(i.toLong(), len-1)%b) })
    /*repeat(r.readLine()!!.toInt()) {
        val len = r.readLine()!!.toInt()
        val v1 = r.readLine()!!.split(" ").map { it.toInt() }
        val v = r.readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    }*/

}


import kotlin.math.sqrt

fun main() {
    fun fac(i: Int): Set<Int> {
        val a = mutableSetOf<Int>()
        if (i%2==0) {
            a+=2
            a+=i/2
        }
        (1..sqrt(i.toDouble()).toInt() step 2).forEach {
            if (i % it == 0) {
                a += it
                a += i / it
            }
        }
        return a
    }

    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val b = 1000000007L
    //val v = r.readLine()!!.split("").filter { it.isNotEmpty() }
    val (max, len) = r.readLine()!!.split(" ").map { it.toInt() }
    // i : num to res
    val dp = Array(len) { LongArray(max + 1) { -1 } }
    fun f(n: Int, i: Int): Long {
        var ans = 0L
        when {
            dp[i][n] != -1L -> {
                return dp[i][n]
            }
            i == 0 -> {
                dp[i][n] = 1
                ans++
            }
            else -> {
                val fac = fac(n)
                fac.forEach {
                    ans += f(n / it, i - 1)
                }
            }
        }
        dp[i][n] = ans % b
        return dp[i][n]
    }
    println((1..max).fold(0L) { acc, i -> (acc + f(i, len - 1)) % b })
    /*repeat(r.readLine()!!.toInt()) {
        val len = r.readLine()!!.toInt()
        val v1 = r.readLine()!!.split(" ").map { it.toInt() }
        val v = r.readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    }*/

}


import kotlin.math.sqrt

fun main() {
    fun fac(i: Int): List<Int> {
        val a = mutableListOf<Int>()
        /*var n = i
        var base = 2
        while (n>0&&n%2==0){
            a+=base
            a+=i/base
            n/=2
            base*=2
        }*/
        (1..sqrt(i.toDouble()).toInt()).forEach {
            if (i % it == 0) {
                a += it
                if (i / it > it)
                    a += i / it
            }
        }
        return a
    }
    //println(fac(12))
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val b = 1000000007L
    //val v = r.readLine()!!.split("").filter { it.isNotEmpty() }
    val (max, len) = r.readLine()!!.split(" ").map { it.toInt() }
    // i : num to res
    val dp = Array(len) { LongArray(max + 1) { -1 } }
    fun f(n: Int, i: Int): Long {
        var ans = 0L
        when {
            dp[i][n] != -1L -> {
                return dp[i][n]
            }
            i == 0 -> {
                dp[i][n] = 1
                ans++
            }
            else -> {
                val fac = fac(n)
                fac.forEach {
                    ans += f(n / it, i - 1)
                }
            }
        }
        dp[i][n] = ans % b
        return dp[i][n]
    }
    println((1..max).fold(0L) { acc, i -> (acc + f(i, len - 1)) % b })
    /*repeat(r.readLine()!!.toInt()) {
        val len = r.readLine()!!.toInt()
        val v1 = r.readLine()!!.split(" ").map { it.toInt() }
        val v = r.readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    }*/

}


import kotlin.math.sqrt

fun main() {
    fun fac(i: Int): Pair<List<Int>, Int> {
        val a = MutableList(i) { -1 }
        var num = 0
        (1..sqrt(i.toDouble()).toInt()).forEach {
            if (i % it == 0) {
                a[num++] = it
                if (i / it > it)
                    a[num++] = i / it
            }
        }
        return Pair(a, num)
    }

    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val b = 1000000007L
    //val v = r.readLine()!!.split("").filter { it.isNotEmpty() }
    val (max, len) = r.readLine()!!.split(" ").map { it.toInt() }
    // i : num to res
    val dp = Array(len) { LongArray(max + 1) { -1 } }
    fun f(n: Int, i: Int): Long {
        var ans = 0L
        when {
            dp[i][n] != -1L -> {
                return dp[i][n]
            }
            i == 0 -> {
                dp[i][n] = 1
                ans++
            }
            else -> {
                val (fac, num) = fac(n)
                for (j in 0..num-1){
                    ans += f(n / fac[j], i - 1)
                }
            }
        }
        dp[i][n] = ans % b
        return dp[i][n]
    }
    println((1..max).fold(0L) { acc, i -> (acc + f(i, len - 1)) % b })
    /*repeat(r.readLine()!!.toInt()) {
        val len = r.readLine()!!.toInt()
        val v1 = r.readLine()!!.split(" ").map { it.toInt() }
        val v = r.readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    }*/
}


import kotlin.math.sqrt

fun main() {
    fun fac(i: Long): Set<Long> {
        val a = mutableSetOf<Long>()
        (1..sqrt(i.toDouble()).toInt()).forEach {
            if (i % it == 0L) {
                a += it.toLong()
                a += i / it
            }
        }
        return a
    }

    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val b = 1000000007L
    //val v = r.readLine()!!.split("").filter { it.isNotEmpty() }
    val (max, len) = r.readLine()!!.split(" ").map { it.toInt() }
    // i : num to res
    val dp = Array(len) { mutableMapOf<Long, Long>() }
    fun f(n: Long, i: Int): Long {
        var ans = 0L
        when {
            dp[i].containsKey(n) -> return dp[i][n]!!
            i == 0 -> {
                dp[i][n] = 1
                return dp[i][n]!!
            }
            else -> {
                val fac = fac(n)
                fac.forEach {
                    ans += f(n/it, i-1)
                }
            }
        }
        dp[i][n] = ans%b
        return dp[i][n]!!
    }
    println((1..max).fold(0L){acc, i -> (acc + f(i.toLong(), len-1))%b })
    /*repeat(r.readLine()!!.toInt()) {
        val len = r.readLine()!!.toInt()
        val v1 = r.readLine()!!.split(" ").map { it.toInt() }
        val v = r.readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    }*/

}


import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.max

fun main(args : Array<String>) {
    Thread { run() }.start()
}

fun run() {

    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val k = scanner.nextInt()
    val arr = LongArray(n + 1) { 1L }
    var mod = 1000000007L
    val help = Array<IntArray>(n + 1) {
        if (it < 2)
            return@Array intArrayOf()
        val a = ArrayList<Int>()
        var i = 2
        while (i * i <= it) {
            if (it % i == 0) {
                a.add(i)
                if (i * i != it)
                    a.add(it / i)
            }
            i++
        }
        a.add(1)
        a.toIntArray()
    }
    for (i in 1 until k) {
        for (j in 2..n) {
            for (q in help[j]) {
                arr[q] += arr[j]
                arr[q] %= mod
            }
        }
    }
    var res = 0L
    for (i in 1..n) {
        res += arr[i]
        res %= mod
    }
    println(res)

}

class Scanner(s: InputStream) {
    var st: StringTokenizer? = null
    var br: BufferedReader = BufferedReader(InputStreamReader(s))
    @Throws(IOException::class)
    operator fun next(): String {
        while (st == null || !st!!.hasMoreTokens())
            st = StringTokenizer(br.readLine())
        return st!!.nextToken()
    }
    @Throws(IOException::class)
    fun nextInt(): Int {
        return Integer.parseInt(next())
    }
    @Throws(IOException::class)
    fun nextLong(): Long {
        return java.lang.Long.parseLong(next())
    }
    @Throws(IOException::class)
    fun nextLine(): String {
        return br.readLine()
    }
    @Throws(IOException::class)
    fun nextDouble(): Double {
        return java.lang.Double.parseDouble(next())
    }
    @Throws(IOException::class)
    fun ready(): Boolean {
        return br.ready()
    }
}

fun IntArray.print() {
    println(Arrays.toString(this))
}

fun Array<IntArray>.print() {
    for (i in this)
        i.print()
}


fun main() {
    val r = System.`in`.bufferedReader()
    val s1 = StringBuilder()
    val b = 1000000007L
    val (max, len) = r.readLine()!!.split(" ").map { it.toInt() }

    val dp = Array(len) { LongArray(max + 1) { 0L } }
    for (k in 1..max) {
        dp[0][k] = 1
    }
    for (i in 0..len - 2) {
        for (n in 1..max) {
            var time = 1
            while (n * time <= max) {
                dp[i + 1][n * time] = (dp[i + 1][n * time] + dp[i][n]) % b
                time++
            }
        }
    }
    println(dp[len-1].sum()%b)
}


fun main() {
    val (a, b) = readLine()!!.split(" ")
    println(if (a==b) a else "1")
}


    fun main(args: Array<String>) {
        val (a, b) = readLine()!!.split(" ")
        println( if (a == b) a else "1" )
    }


import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val (a, b) = readLine()!!.split(" ")
    println(if (a == b) a else "1")
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


import kotlin.math.max

/* template start */
// input
private fun readString() = readLine()!!
private fun readStrings() = readString().split(" ")
private fun readInt() = readString().toInt()
private fun readDigits() = readString().map { it - '0' }
private fun readInts() = readStrings().map { it.toInt() }
private fun readLongs() = readStrings().map { it.toLong() }

// output
private fun <T> T.print(map: (T) -> String = { it.toString() }) = println(map(this))
private fun <T> Iterable<T>.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)
private fun <T> Array<T>.print(sep: String? = null, map: ((T) -> String)? = null) = asSequence().print(sep, map)
private fun IntArray.print(sep: String? = null, map: ((Int) -> String)? = null) = asSequence().print(sep, map)
private fun <T> Sequence<T>.print(sep: String? = null, map: ((T) -> String)? = null) =
    println(joinToString(sep ?: "", transform = map ?: { it.toString() }))

// others
private val Int.isEven: Boolean get() = this % 2 == 0
private val Int.isOdd: Boolean get() = !this.isEven
private fun queries(block: (Int) -> Unit) = repeat(readInt(), block)

/* template end */

fun main() {
    val n = readInt()
    val maxRank = readInts().max()!!
    println(max(0, maxRank - 25))
}


import java.util.*

fun min(a:Double,b:Double) = if (a<b) a else b
fun max(a:Double,b:Double) = if (a>b) a else b
fun min(a:Int,b:Int) = if (a<b) a else b
fun max(a:Int,b:Int) = if (a>b) a else b
fun printD(d: Double) { print(d) }
fun printI(d:Int) { print(d) }
fun printS(d: String) { print(d) }
fun printL(d: Long) { print(d) }
fun readLn() = readLine()!!
fun readInt() = readLn().toInt()
fun readInts()  = readLn().split(" ").map{it.toInt()}
fun readLong() = readLn().toLong()
class pair (var first:Int, var second:Int)

fun solve() {
   val cin = Scanner(System.`in`)

   /*
   map[q] <=> map.getOrDefault(q,0)
   Сортировка вектора пар - k=v.sortedWith(compareBy({it.first},{it.second}));
   print("${k[i].second}"); - вывод аргумента пары
   var m=ArrayList<int> (); <=> vector
   getline(cin,a) <=> readLine()!!.last()

  readInt() - одно число
  readInts() - несколько чисел

   */

    /* --------- */

var a=readInt();
var q=readInts();
var max1=0;
for (i in q) {max1=max(max1,i)};
if (max1<=25) print("0"); else print(max1-25);
   /* --------- */

}

    fun main() {
    val cin = Scanner(System.`in`)

    var T=1;
    //T=readLine()!!.toInt();

    for (i55555 in 1..T) solve()
}


import java.util.Scanner;

fun main(args: Array<String>) {
    var scan: Scanner = Scanner(System.`in`);
    var max: Int = 0;
    var n: Int = scan.nextInt()-1;
    for (i in 0..n) {
        var finalist: Int = scan.nextInt();
        if (finalist > max) {
            max = finalist;
        }
    }
    var out: Int = if (max > 25) { max - 25 } else { 0 };
    System.out.println(out);
}


import kotlin.math.max

fun main() {
    readInt()
    println(max(25, readInts().maxOrNull()!!) - 25)
}

// Input Reader
private fun readLn() = readLine()!!
private fun readStrings() = readLn().trim().split(" ")
private fun readInt() = readLn().toInt()
private fun readInts() = readStrings().map { it.toInt() }


import java.io.IOException
import java.io.PrintWriter
import java.util.*;

fun main() {
    val scan = FastReader()
    val out = PrintWriter(System.out)

    var k = scan.nextInt()
    var ans = 0
    for(i in 1..k) ans = Math.max(ans, scan.nextInt())
    out.println(Math.max(0, ans - 25))

    out.close()
}

private class FastReader {
    var st: StringTokenizer? = null;

    fun next(): String {
        while(st == null || !st!!.hasMoreTokens()) {
            try {
                st = StringTokenizer(readLine()!!)
            }
            catch (e: IOException) {
                e.printStackTrace()
            }
        }
        return st!!.nextToken()
    }

    fun nextInt(): Int {
        return next().toInt()
    }

    fun nextLong(): Long {
        return next().toLong()
    }

    fun nextDouble(): Double {
        return next().toDouble()
    }

    fun nextLine(): String {
        var str = ""
        try {
            str = readLine()!!
        }
        catch (e : IOException) {
            e.printStackTrace()
        }
        return str
    }
}


import kotlin.math.max

fun main() {
    fun readInts() = readLine()!!.split(" ").map(String::toInt)

    readLine()
    print(max(0, readInts().max()!! - 25))
}


import java.io.InputStream

private val MOD = 1e9.toInt() + 7

private val input = FastScanner()

fun main(args: Array<String>) = input.run {
    val n = nextInt()
    val a = nextInts(n)
    val max = a.max()!!
    println(Math.max(0, max - 25))
}

class FastScanner(private val input: InputStream = System.`in`) {
    private val sb = StringBuilder()
    private val buffer = ByteArray(4096)
    private var pos = 0
    private var size = 0

    fun nextString(): String? {
        var c = skipWhitespace()
        if (c < 0) return null

        return sb.run {
            setLength(0)

            do {
                append(c.toChar())
                c = read()
            } while (c > ' '.toInt())

            toString()
        }
    }

    fun nextLine(): String? {
        var c = read()
        if (c < 0) return null

        return sb.run {
            setLength(0)

            while (c >= 0 && c != '\n'.toInt()) {
                append(c.toChar())
                c = read()
            }

            toString()
        }
    }

    fun nextLong(): Long {
        var c = skipWhitespace()

        val sign = if (c == '-'.toInt()) {
            c = read()
            -1
        } else 1

        var ans = 0L

        while (c > ' '.toInt()) {
            ans = ans * 10 + c - '0'.toInt()
            c = read()
        }

        return sign * ans
    }

    fun nextInt() = nextLong().toInt()
    fun nextDouble() = nextString()?.toDouble() ?: 0.0

    fun nextStrings(n: Int) = Array<String>(n) { nextString() ?: "" }
    fun nextInts(n: Int) = IntArray(n) { nextInt() }
    fun nextLongs(n: Int) = LongArray(n) { nextLong() }
    fun nextDoubles(n: Int) = DoubleArray(n) { nextDouble() }

    fun nextStrings(n: Int, m: Int) = Array(n) { nextStrings(m) }
    fun nextInts(n: Int, m: Int) = Array(n) { nextInts(m) }
    fun nextLongs(n: Int, m: Int) = Array(n) { nextLongs(m) }
    fun nextDoubles(n: Int, m: Int) = Array(n) { nextDoubles(m) }

    private fun skipWhitespace(): Int {
        while (true) {
            val c = read()
            if (c > ' '.toInt() || c < 0) return c
        }
    }

    private fun read(): Int {
        while (pos >= size) {
            if (size < 0) return -1
            size = input.read(buffer, 0, buffer.size)
            pos = 0
        }
        return buffer[pos++].toInt()
    }
}


import utils.io.FastScanner

private val MOD = 1e9.toInt() + 7

private val input = FastScanner()

fun main(args: Array<String>) = input.run {
    val n = nextInt()
    val a = nextInts(n)
    val max = a.max()!!
    println(Math.max(0, max - 25))
}


import java.util.*
import kotlin.math.exp

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single Int
private fun readInts() = readStrings().map { it.toInt() } // list of Ints
private fun readStrings() = readLn().trim().split(" ") // list of strings

fun dfs(
    start: Int,
    friends: Map<Int, MutableList<Int>>,
    dislike: Map<Int, MutableSet<Int>>,
    seen: MutableSet<Int>
): Pair<Boolean, Int> {
    val visited = mutableSetOf<Int>()
    val stack = ArrayDeque<Int>()
    stack.add(start)
    seen.add(start)
    visited.add(start)
    val bad = dislike[start] ?: mutableSetOf()
    while (stack.isNotEmpty()) {
        val node = stack.pop()
        for (neb in friends[node] ?: mutableListOf()) {
            if (neb in bad) {
                return Pair(false, -1)
            } else if (neb !in visited) {
                visited.add(neb)
                seen.add(neb)
                bad.addAll(dislike[neb] ?: mutableSetOf())
                stack.add(neb)
            }
        }
    }
    return Pair(true, visited.size)
}

fun main(args: Array<String>) {
    val n = readInt()
    val pairs = readInt()
    val friends = mutableMapOf<Int, MutableList<Int>>()
    val dislike = mutableMapOf<Int, MutableSet<Int>>()
    for (i in 0 until pairs) {
        val (u, v) = readInts()
        friends.computeIfAbsent(u) { mutableListOf() }
        friends.computeIfAbsent(v) { mutableListOf() }

        friends[u]!!.add(v)
        friends[v]!!.add(u)
    }
    val x = readInt()
    for (i in 0 until x) {
        val (u, v) = readInts()
        dislike.computeIfAbsent(u) { mutableSetOf() }
        dislike.computeIfAbsent(v) { mutableSetOf() }
        dislike[u]!!.add(v)
    }
    var res = 0
    val seen = mutableSetOf<Int>()
    for (i in 1 until n + 1) {
        if (i !in seen) {
            val p = dfs(i, friends, dislike, seen)
            if (p.first) {
                res = Math.max(res, p.second)
            }
        }
    }
    println(res)
}


import java.io.*
import java.util.*

fun main(args : Array<String>) {
  //====== Input preparations ========================================================
//  val fin = BufferedReader(FileReader("c.in"))
  val fin = BufferedReader(InputStreamReader(System.`in`))
  val fout = PrintWriter (System.out)
  var tokenizer = StringTokenizer("")
  fun next() : String {
    while (!tokenizer.hasMoreTokens())
      tokenizer = StringTokenizer(fin.readLine())
    return tokenizer.nextToken()
  }
  fun nextInt() = next().toInt()
  fun nextLong() = next().toLong()
  fun nextPair() = nextInt() to nextInt()
  fun nextPairDec() = nextInt()-1 to nextInt()-1
  //====== Solution below ============================================================
  val (n,m) = nextPair()
  val k = nextLong()
  val (x,y) = nextPairDec()
  val p = (n-1) * m
  if (n == 1) {
    val d = k / m
    val rem = k % m
    val max = d + (if (rem > 0) 1 else 0)
    val min = d
    val cnt = d + if (rem > y) 1 else 0
    fout.print("$max $min $cnt")
  } else {
    val d = k / p
    val rem = k % p
    val max = if (n == 2) ((d+1)/2 + if (d % 2 == 0L && rem > 0) 1 else 0) else d + (if (d == 0L || rem > m) 1 else 0)
    val min = d / 2 + (if (d % 2 == 1L || rem >= m) 1 else 0)
    val x1 = if (d % 2 == 0L) x else n - x - 1
    var cnt = if (x1 == 0) d/2 else if (x1 == n-1) (d+1)/2 else d
//    println("$x $y")
    if (x1 * m + y + 1 <= rem)
      cnt++
    fout.print("$max $min $cnt")
  }

  fout.close()
  fin.close()
}


import java.io.*
import java.util.*

fun main(args : Array<String>) {
  //====== Input preparations ========================================================
//  val fin = BufferedReader(FileReader("c.in"))
  val fin = BufferedReader(InputStreamReader(System.`in`))
  val fout = PrintWriter (System.out)
  var tokenizer = StringTokenizer("")
  fun next() : String {
    while (!tokenizer.hasMoreTokens())
      tokenizer = StringTokenizer(fin.readLine())
    return tokenizer.nextToken()
  }
  fun nextInt() = next().toInt()
  fun nextLong() = next().toLong()
  fun nextPair() = nextInt() to nextInt()
  fun nextPairDec() = nextInt()-1 to nextInt()-1
  //====== Solution below ============================================================
  val (n,m) = nextPair()
  val k = nextLong()
  val (x,y) = nextPairDec()
  val p = (n-1) * m
  if (p == 0) {
    val d = k / m
    val rem = k % m
    val max = d + (if (rem > 0) 1 else 0)
    val min = d
    val cnt = d + if (rem > y) 1 else 0
    fout.print("$max $min $cnt")
  } else {
    val d = k / p
    val rem = k % p
    val max = d + (if (d == 0L || rem > m) 1 else 0)
    val min = d / 2 + (if (d % 2 == 1L || rem >= m) 1 else 0)
    val (x1,y1) = if (d % 2 == 0L) (x to y) else (n - x - 1 to y)
    var cnt = if (x1 == 0) d/2 else if (x1 == n-1) (d+1)/2 else d
//    println("$x $y")
    if (x1 * m + y1 + 1 <= rem)
      cnt++
    fout.print("$max $min $cnt")
  }

  fout.close()
  fin.close()
}


import java.io.*
import java.util.*

fun main(args : Array<String>) {
  //====== Input preparations ========================================================
//  val fin = BufferedReader(FileReader("c.in"))
  val fin = BufferedReader(InputStreamReader(System.`in`))
  val fout = PrintWriter (System.out)
  var tokenizer = StringTokenizer("")
  fun next() : String {
    while (!tokenizer.hasMoreTokens())
      tokenizer = StringTokenizer(fin.readLine())
    return tokenizer.nextToken()
  }
  fun nextInt() = next().toInt()
  fun nextLong() = next().toLong()
  fun nextPair() = nextInt() to nextInt()
  fun nextPairDec() = nextInt()-1 to nextInt()-1
  //====== Solution below ============================================================
  val (n,m) = nextPair()
  val k = nextLong()
  val (x,y) = nextPairDec()
  val p = (n-1) * m
  if (n == 1) {
    val d = k / m
    val rem = k % m
    val max = d + (if (rem > 0) 1 else 0)
    val min = d
    val cnt = d + if (rem > y) 1 else 0
    fout.print("$max $min $cnt")
  } else {
    val d = k / p
    val rem = k % p
    val max = if (n == 2) (d/2 + if (d % 2 == 1L || rem > 0) 1 else 0) else d + (if (d == 0L || rem > m) 1 else 0)
    val min = d / 2 + (if (d % 2 == 1L && rem >= m) 1 else 0)
    val x1 = if (d % 2 == 0L) x else n - x - 1
    var cnt = if (x1 == 0) d/2 else if (x1 == n-1) (d+1)/2 else d
//    println("$x $y")
    if (x1 * m + y + 1 <= rem)
      cnt++
    fout.print("$max $min $cnt")
  }

  fout.close()
  fin.close()
}