MOD = 998244353

n, k = map(int, input().split())
f = [0] * (5 * n + 5)
for d in map(int, input().split()):
    f[d] = 1

def ntt_transform(a, P, G, inv=False):
    n, k = 1, 0
    while n < len(a):
        k += 1
        n *= 2
    a += [0] * (n - len(a))

    n2 = n // 2
    w = [1] * n2
    w[1] = pow(G, (P - 1) // n, P)
    if inv: w[1] = pow(w[1], P - 2, P)
    for i in range(2, n2):
        w[i] = w[i - 1] * w[1] % P

    rev = [0] * n
    for i in range(n):
        rev[i] = rev[i >> 1] >> 1
        if i & 1: rev[i] |= n2
        if i < rev[i]: a[i], a[rev[i]] = a[rev[i]], a[i]

    l = 2
    while l <= n:
        half, diff = l // 2, n // l
        for i in range(0, n, l):
            pw = 0
            for j in range(i, i + half):
                v = a[j + half] * w[pw] % P;
                a[j + half] = a[j] - v if a[j] - v >= 0 else a[j] - v + P
                a[j] = a[j] + v if a[j] + v < P else a[j] + v - P
                pw += diff
        l *= 2

    if inv:
        inv_n = pow(n, P - 2, P)
        for i in range(n): a[i] = a[i] * inv_n % P;

ntt_transform(f, MOD, 3)
f = [pow(x, n // 2, MOD) for x in f]
ntt_transform(f, MOD, 3, inv=True)

ans = sum(x * x % MOD for x in f) % MOD
print(ans)


n = int(input())
A = []
sum = 0
for i in range(n):
    x = int(input())
    sum += x
    A.append(sum/i)

print('%.6f\n' % max(A))


n = int(input())
l = []
for i in range(1 , n + 1):
    l.append(i)

if sum(l) % 2 == 0:
    print(0)
else:
    print(1)


numcases = int(input())
start = "1"
root = "1"
count = 0

for i in range(numcases):
    lim = int(input())

    while int(start) != lim:
        if (len(start) < 4):
            start += root

        else:
            root = str(int(root) + 1)
            start = root
        count += len(start)
    if (lim == 1):
        print(1)
    else:
        print(count+1)


def fact(n):
	p = 1
	if(n == 0):
		return 1
	for i in range(1,n+1):
		p = p*n
	return p
n = int(raw_input())
f = fact(n+1)
a = map(int, raw_input().split())
a.pop(0)
b = map(int, raw_input().split())
b.pop(0)
for i in range(f):
	if(a[0]>b[0]):
		a.append(b[0])
		a.append(a[0])
		a.pop(0)
		b.pop(0)
	elif(b[0]>a[0]):
		b.append(a[0])
		b.append(b[0])
		a.pop(0)
		b.pop(0)
	else:
		print "-1"
		exit()
	if(len(a)==0):
		print str(i+1)+" "+"2"
		exit()
	elif(len(b)==0):
		print str(i+1)+" "+"1"
		exit()
print "-1"


g = [0]*111111
t = [0]*111111

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def ksm(a, b, p=int(1e9+7)):
    a = a % p
    ans = 1
    while b > 0:
        if b & 1:
            ans = ans * a % p
        b = b >> 1
        a = a*a % p
    return ans

m = int(input())
p = int(1e9+7)
tmp = ksm(m, p-2)
for j in range(m, 0, -1):
    c1 = 0
    tyouce = tmp
    gyouce = 0
    if j == 1:
        c1 = 0
    else:
        c1 = m//j * tmp % p

    for k in range(2, m//j + 1):
        t0 = m//j//k
        t1 = 0
        for l in range(1, k):
            if gcd(l, k) == 1:
                t1 += 1
        ck = t0*t1 % p
        for l in range(1, (m//j) % k + 1):
            if gcd(l, k) == 1:
                ck += 1
        ck = ck*tmp%p
        tyouce = (tyouce + ck * t[k*j]) % p
        gyouce = (gyouce + ck * (t[k*j] + g[k*j])) % p
    t[j] = tyouce * ksm(1-c1+p, p-2) % p
    gyouce = (gyouce + tmp + c1 * t[j]) % p
    g[j] = gyouce * ksm(1-c1+p, p-2) % p

# print(t[2])
# print(g[2])
# print(t[1])
print(g[1])


from fractions import Fraction

g = [0]*111111
t = [0]*111111
prime = [0]*111111
pm = [0]*111111
for i in range(len(prime)):
    prime[i] = {}

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def ksm(a, b, p=int(1e9+7)):
    a = a % p
    ans = 1
    while b > 0:
        if b & 1:
            ans = ans * a % p
        b = b >> 1
        a = a*a % p
    return ans

m = int(input())
p = int(1e9+7)
tmp = ksm(m, p-2)
for j in range(m, 0, -1):
    c1 = 0
    tyouce = tmp
    gyouce = 0
    if j == 1:
        c1 = 0
    else:
        c1 = m//j * tmp % p

    for k in range(2, m//j + 1):

        def get_ck(m, n):
            ans = 0

            def get_fac():
                for i in range(2, 100011):
                    if pm[i] == 0:
                        prime[i][i] = 1
                        for j in range(2, 100001//i+1):
                            pm[i*j] = 1
                            prime[i*j][i] = 1

            if prime[m] == {}:
                get_fac()
            prime_list = list(prime[m].keys())
            for i in range(1, 1 << len(prime_list)):
                t = i
                rongchixishu = -1
                lcm = 1
                index = len(prime_list)-1
                while t>0:
                    if t&1:
                        lcm = lcm*prime_list[index]
                        rongchixishu *= -1
                    t >>= 1
                ans += n//lcm*rongchixishu
            return ans

        ck = (m//j - get_ck(k, m//j)+p) % p
        ck = ck*tmp % p
        tyouce = (tyouce + ck * t[k*j]) % p
        gyouce = (gyouce + ck * (t[k*j] + g[k*j])) % p
    t[j] = tyouce * ksm(1-c1+p, p-2) % p
    gyouce = (gyouce + tmp + c1 * t[j]) % p
    g[j] = gyouce * ksm(1-c1+p, p-2) % p

print(g[1])


# -*- coding:utf-8 -*-

"""

created by shuangquan.huang at 1/17/20

"""

import collections
import time
import os
import sys
import bisect
import heapq
from typing import List

def solve(N, A, B, K):
    MOD = 1000000007

    dp = [0 for _ in range(N+1)]
    dp[A] = 1
    for k in range(1, K+1):
        delta = []
        for x in range(1, N+1):
            d = abs(x-B)
            if d <= 1:
                continue
            l, r = max(x-d+1, 1), min(x+d, N+1)
            if l < x:
                delta.append((l, dp[x]))
                delta.append((x, -dp[x]))
            if x < r:
                delta.append((x+1, dp[x]))
                delta.append((r, -dp[x]))

        delta.sort()

        ndp = [0 for _ in range(N+1)]
        v = 0
        for x, d in delta:
            v += d
            v %= MOD
            if x <= N:
                ndp[x] = v

        dp = ndp

    return sum(dp) % MOD

N, A, B, K = map(int, input().split())
print(solve(N, A, B, K))


def solve(n, st, k):
    MOD = int(1e9 + 7)
    dp = [0] * (n + 1)
    prefix_sum = [0] * (n + 1)
    dp[st] = 1
    for times in range(k):
        prefix_sum[0] = 0
        for i in range(1, n + 1):
            prefix_sum[i] = prefix_sum[i - 1] + dp[i]
            if prefix_sum[i] >= MOD: prefix_sum[i] -= MOD
        for i in range(1, n + 1):
            t = prefix_sum[n] - prefix_sum[i] + prefix_sum[i - 1] - prefix_sum[i >> 1]
            while t < 0: dp[i] += MOD
            while t >= MOD: dp[i] -= MOD
            dp[i] = t
    return sum(dp) % MOD

def main():
    n, a, b, k = [int(i) for i in input().split()]
    if a > b:
        print(solve(n - b, a - b, k))
    else:
        print(solve(b - 1, b - a, k))

main()


import sys

def main():
    def modst(a, s):
        ret = 1
        while s:
            if s % 2:
                ret = ret * a % mod
            a = a * a % mod
            s //= 2
        return ret
    def Cnk(n, k):
        return (k <= n and n >= 0) * ((f[n] * modst((f[k] * f[n - k]) % mod, mod - 2)) % mod)
    #n, v, u = map(int, sys.stdin.readline().split())
    #n, k = map(int, sys.stdin.readline().split())
    n = int(sys.stdin.readline().strip())
    #a, b = map(int, sys.stdin.readline().split())
    #q = list(map(int, sys.stdin.readline().split()))
    #q = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)
    f = [1, 1]
    m = 200007
    for i in range(2, m):
        f.append(f[-1] * i)
    mod = 998244353
    a = 0
    for i in range(2 - n % 2, n + 1, 2):
        a = (a + Cnk(max(((n - i) // 2) + i - 1, 0), i - 1)) % mod
    print((a * modst(modst(2, n), mod - 2)) % mod)

#for i in range(int(sys.stdin.readline().strip())):
main()


import sys
n=int(input())
a=[1]*n
b=list(range(1,n+1))
if n>1:
    while True:
        for i in range(1,n):
            a[i]=a[i-1]+b[i]
        if a[1]==n:
            print(a[n-1])
            sys.exit()
        for j in range(1,n):
            b[j]=b[j-1]+a[j]
        if b[1]==n:
            print(b[n-1])
            sys.exit()
else:
    print(1)


r,g,b=map(int,raw_input().split())
t=0
while r>0 or g>0 or b>0:
    if t%3==0:
        r-=2
    elif t%3==1:
        g-=2
    else:
        b-=2
t += 30
print t


def solve(year):
    while(True):
        year = str(int(year)+1)
        if(len(set(year))==4):
            return year

if __name__ == "__main__":
    print solve(input())


res = a
rem = 0
while a > 0:
    a += rem
    s = a // b
    res += s
    rem = a % b
    a = s
print res


def gen(i, counts, res1, res2):
    global count
    if i == n:
        if res1 == res2 == 0 and (counts < count or count == -1):
            count = counts
    else:
        gen(i + 1, counts, (res1 + A[i][0]) % 2, (res2 + A[i][1]) % 2)
        gen(i + 1, counts + 1, (res1 + A[i][1]) % 2, (res2 + A[i][0]) % 2)

n = int(input())
count = -1
A = []
for i in range(n):
    A.append(list(map(int, input().split())))
gen(0, 0, 0, 0)
print(count)


n = input()
for i in reversed(n) :
    k = int(i)
  if k < 5 :
    print('O-|' + 'OOOO'[:k] + '-' + 'OOOO'[:4-k])
  else :
    k -= 5
    print('-O|' + 'OOOO'[:k] + '-' + 'OOOO'[:4-k])


# -*- coding: utf-8 -*-
"""
Created on Wed Oct 31 20:11:35 2018

@author: Himanshu Gwalani

"""
n,a,x,b,y = map(int,input().split())
l = [a]
if a == n:
    a = 1
else:
    a+=1
while a!=x:
    l.append(a)
    a+=1
    if a == n+1:
        a = 1
l.append(x)
ll = [y]
while b<=y:
    ll.append(b)
    b-=1
    if b==0:
        b = n
flag = False
#print(l)
#print(ll)
for i in range(n):
    if i+1 in l and i+1 in ll:
        flag = True
        break
if flag:
    print("YES")
else:
    print("NO")


a = list(map(int, raw_input().split(" ")))

s = 0

for i in range(len(a)):
    s+= a[i]

if s % len(a) == 0:
    print s/len(a)
else:
    print "-1"


inp = raw_input().strip().split()

total = 0
for i in range(0,len(inp)):
    a = int(inp[i])
    total += a

m = total % 5
x = total / 5
if total == 0:
    print "-1"
if m == 0:
    print x
else:
    print "-1"


def func(fr,to):
  if fr==to:
    return 0
  temp=fr.bit_length()-to.bit_length()
  if temp<=0:
    return -1
  return temp
n,k=map(int,input().split())
gans=-1
arr=sorted(list(map(int,input().split())))
for i in range(max(arr)+1):
    cs=0
    tk=0
    for j in arr:
        if tk>=k:
            break
        temp=func(j,i)
        if temp<0:
            continue
        cs=cs+temp
        tk=tk+1
    if gans==-1:
        gans=cs
    else:
        if tk>=k:
            gans=min(gans,cs)
    #print(i,cs,tk,gans)
print(gans)


n=input()
for i in range(n):
    k=input()
    l=7
    s=3
    if k<l:
        if k%s==0:
            print "YES"
        else:
            print"NO"
    elif k>=l:
        if k%s==0:
            print "YES"

        elif k%l==0:
            print "YES"
        elif k%l!=0:
            y=k%l
            if y%s==0:
                print "YES"
            elif k%s!=0:
                i=1
                while True:
                    if (s*i)+l==k or (l*i)+s==k:
                        print "YES"
                        break
                    i=i+1
            else:
                print "NO"


import sys

a = int(input())

p = 0
if a==0:
    print(8)
    sys.exit()

while True:
    a+=1
    p+=1
    j=a
    while j!=0:
        if j%10==8:
            print(p)
            sys.exit()
        else:
            j=j//10


from math import factorial as F
n, w, b = map(lambda x: int(x), raw_input().split())
print reduce(lambda x,i:x+(i-1)*F(w-1)/F(i-1)/F(w-i)*F(b-1)/F(n-i-1)/F(b+i-n),xrange(max(2,n-b),min(n,w+1)),0)*F(w)*F(b) % (10**9+9)


n = int(input())
a = list(map((int, input().split()))
b = sorted(a)
res = 0
for i in range(n/2):
    res += b[i*2+1]-b[i*2]
print(res)


n,m = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort(reverse=True)

for k in range(0,n):
    total = 0
    grps = (k+n-1)//n
    for i in range(n):
        total += max(0, arr[i] - i%grps)
    if total>=m:
        print(k)
print(-1)


#After seeing the editorials :'(
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
for i in range(1,n+1):
    s=0
    for j in range(n):
        s+=max(0,a[j]-(j//i))
    if s>=m:
        print(i)
        flag=1
        break
if flag==0:
    print(-1)


__author__ = 'Esfandiar'
'''
یه تعداد به یه رستوران و یه تعداد به هر دوتا رستوران و یه تعداد هم تو هر دوتاش
تعداد کسایی که تو هیچکدوم نبودن یا اینکه اصن اطلاعات داده شده اشتباهه
'''
A,B,C,N = map(int,input().split())
A-=C
B-=C
if A< and B<0 and A+B+C<N:
    print(N-(A+B+C))
else:
    print(-1)


n=int(input())
str=input()

maks=0
sum=0

for i in range(len(str)):
    if s[i]==' ':
        if (sum>maks)
            maks = sum
        sum=0
    if str[i].isUpper():
        sum+=1;

if (sum>maks)
    maks = sum
print(maks)


a, b = map(int, input().split())
a, b = bin(a)[2:], bin(b)[2:]

max_len = max(len(a), len(b))

for _ in range(max_len - len(a)):
    a = '0' + a

for _ in range(max_len - len(b)):
    b = '0' + b

output = ''
reminder = 0

for i in range(max_len - 1, -1, -1):
    if a[i] == '0' and b[i] == '1' or a[i] == '1' and b[i] == '0':
        output = str(1 ^ reminder) + output
    elif a[i] == '0' and b[i] == '0':
        output = str(0 ^ reminder) + output
    elif a[i] == '1' and b[i] == '1':
        output = str(0 ^ reminder) + output
        reminder = 1

if reminder:
    output = '1' + output

print(int(output, 2))


import sys
input=sys.stdin.readline
n,m = map(int,input().split())
print((2**m-1)**n)


a, b = list(map(int, input().split()))
mod = 10**9 + 7
print(pow(pow(2, b)-1, a)%mod)


n, m = map(int, input().split())
s = (2 ** m - 1) ** n

print(s)


import sys
inputfn = sys.stdin.readline

nm = inputfn().split(" ")
n = int(nm[0])
m = int(nm[1])

print((((1 << n) - 1) * ((1 << m) - 1)) % (10**9 + 7))


n,m=map(int,input().split())

ans=(2**m-1)
for _ in range(1,n):
    ans*=(2**m-1)%(10**9+7)

print(ans)


n,m,X,Y,x,y=map(int,input().split())
a=[abs(X-x),abs(Y-y)]
a.sort()
print("First" if a[0]<5 and a[0]+a[1]<7 else "Second")


from decimal import *
import sys
getcontext().prec=100
n,m=input().split()
n=eval(n)
m=eval(m)
if n*m<=2:
    if n==2 and m==1:
        print(0.5)
    else:
        print(1)
    sys.exit()
n=Decimal(n)
m=Decimal(m)
a=m*n
b=n-1
b=b*b
ans=(a-1+b)/(n*(a-1))
print(ans)


a=[[1,1,1],[1,1,1],[1,1,1]]
b=[]
;b.append(list(map(int,input().split())))
;b.append(list(map(int,input().split())))
;b.append(list(map(int,input().split())))
for i in range(3):
                   for j in range(3):
                                      if b[i][j]%2==1:
                                                         for k in range(3):
                                                                            if a[k][j] and k!=i:a[k][j]=0
                                                                            else:a[k][j]=1
                                                         for k in range(3):
                                                                            if a[i][k]:a[i][k]=0
                                                                            else:a[i][k]=1
for i in range(3):print(*a[i])


n,k=[int(i) for i in input().split()]
arr=list(map(int,input().split()))
x=0
y=1
e=0
while x<=y+1:
    if arr[x]<=k:
        e=e+1
        x=x+1
    if arr[-y]<=k:
        e=e+1
        y=y+1
print(e)


def inp(dtype=str, strip=True):
    s = input()
    res = [dtype(p) for p in s.split()]
    res = res[0] if len(res) == 1 and strip else res
    return res

def problem1():

    def test(cur, steps):
        if 0 < cur <= n and cur not in a:
            return steps
        else:
            return -1

    t = inp(int)
    for _ in range(t):
        n, s, k = inp(int)
        a = inp(int, strip=False)
        a = set(a)

        res = -1
        steps = 0
        while res < 0:
            res = test(s + steps, steps)
            if res < 0:
                res = test(s - steps, steps)
            steps += 1

        print(res)

def problem2():
    n = inp(int)
    res = 0
    for i in range(1, n + 1):
        res += 1 / i
    print(res)

def problem3():
    n, q = inp(int)
    conflicts = [[[0, 0, 0] for _ in range(n)] for _ in range(2)]
    state = [[0 for _ in range(n)] for _ in range(2)]
    nconflicts = 0
    for _ in range(q):
        r, c = inp(int)
        r = r - 1
        c = c - 1

        if state[r][c] == 0:
            state[r][c] = 1
            q = 1 - r
            if c - 1 >= 0 and state[q][c - 1] == 1:
                nconflicts += 1
                conflicts[r][c][-1 + 1] = 1
                conflicts[q][c - 1][1 + 1] = 1
            if state[q][c] == 1:
                nconflicts += 1
                conflicts[r][c][0 + 1] = 1
                conflicts[q][c][0 + 1] = 1
            if c + 1 < n and state[q][c + 1] == 1:
                nconflicts += 1
                conflicts[r][c][1 + 1] = 1
                conflicts[q][c + 1][-1 + 1] = 1
        else:
            state[r][c] = 0
            q = 1 - r
            if c - 1 >= 0 and state[q][c - 1] == 1:
                nconflicts -= 1
                conflicts[r][c][-1 + 1] = 0
                conflicts[q][c - 1][1 + 1] = 0
            if state[q][c] == 1:
                nconflicts -= 1
                conflicts[r][c][0 + 1] = 0
                conflicts[q][c][0 + 1] = 0
            if c + 1 < n and state[q][c + 1] == 1:
                nconflicts -= 1
                conflicts[r][c][1 + 1] = 0
                conflicts[q][c + 1][-1 + 1] = 0

        if nconflicts == 0:
            print("YES")
        else:
            print("NO")

def problem4():

    def dist(xi, yi, xj, yj):
        return abs(xi - xj)  + abs(yi - yj)

    def dist2(xi, yi, xj, yj):
        return 2 * max(abs(xi - xj), abs(yi - yj))

    x0, y0, ax, ay, bx, by = inp(int)
    xs, ys, t = inp(int)

    i = 0
    a = [(x0, y0)]
    xmin, ymin = x0, y0
    while i < 60:
        xmin = ax * xmin + bx
        ymin = ay * ymin + by
        a.append((xmin, ymin))

    i = 0
    xmin, ymin = x0, y0
    while dist2(xs, ys, xmin, ymin) > t and i < 60:
        xmin = ax * xmin + bx
        ymin = ay * ymin + by
        i += 1
    imin = i

    xmax, ymax = xmin, ymin
    while dist2(xs, ys, xmax, ymax) <= t and i < 60:
        xmax = ax * xmax + bx
        ymax = ay * ymax + by
        i += 1
    imax = i - 1

    res = 0
    for istart in range(imin, imax + 1):
        dist_start = dist(xs, ys, *a[istart])
        if dist_start > t:
            continue

        # some down and all up
        for imed in range(imin, istart + 1):
            dist_med = dist(*a[istart], *a[imed])
            if dist_start + dist_med > t:
                continue

            i = imed + 1
            while dist_start + dist_med + dist(*a[imed], *a[i]) <= t:
                i += 1

            i = max(imed, i - 1)
            res = max(res, i - imed + 1)

        # some up and all down
        for imed in range(istart, imax + 1):
            dist_med = dist(*a[istart], *a[imed])
            if dist_start + dist_med > t:
                continue

            i = imed - 1
            while dist_start + dist_med + dist(*a[imed], *a[i]) <= t:
                i -= 1

            i = min(imed, i + 1)
            res = max(res, imed - i + 1)

    print(res)

def problem5():
    pass

if __name__ == '__main__':
    # problem1()
    # problem2()
    # problem3()
    problem4()
    # problem5()


n=input()
strs=input()
if len(strs)<3:
    print(strs)
k='ogo'
if len(strs)>=3:
    while True:
        while k in strs:
            k+='go'
        k=k[:-2]
        strs=strs.replace(k,'***')
        if k=='ogo':
            print(strs)
            break
        else:
            k=='ogo'


n=input()
strs=input()
c=0
if len(strs)<3:
    print(strs)
    c=1
k='ogo'
z=0
if c!=1:
     while True:
        while k in strs:
            k+='go'
            z=1
        if z==1:
            k=k[:-2]
            z=0
        strs=strs.replace(k,'***')
        if k=='ogo':
            print(strs)
            break
        else:
            k=='ogo'


l, r = list( map( int, input().split() ) )

def cnt( x ) :
    ret = 0
    for i in range( 1, x+1 ):
        s = str(i)
        if s[0] == s[-1]:
            ret += 1
            #print(s)
    return ( ret )

def cnt2( x ):

    ret = 0
    s = str(x)
    L = len(s)

    if L >= 2 and x == 10**(L-1):
        return ( cnt2( 10**(L-1)-1 ) )

    if L <= 1:
        return ( x )
    elif L <= 2:
        while x//10 != x%10:
            x -= 1
        return ( 9 + x//10 )
    else:
        ret = int( "1" + "0"*(L-3) + "8" )
        num = list( str(x) )
        #print( num )
        if num[0] != num[-1]:
            if int(num[0]) > int( num[-1] ):
                how = int(num[-1]) + 10-int(num[0])
            else:
                how = int(num[-1]) - int(num[0])
            x -= how
        num = str(x)
        d = x % 10
        #print( 'num',num )
        #print( 'd', d )
        #print( 'num', num, 'ret before', ret )
        ret += ( int(d-1) ) * int( "9" * (L-2) ) + int( num[1:-1] ) + int(d)

    return ( ret )

#print( cnt(1024), cnt2(1024) )
#print( cnt(47), cnt2(47) )
#print( cnt(9), cnt2(9) )
#print( cnt(58), cnt2(58) )
#print( cnt(999), cnt2(999) )
#print( cnt(8987), cnt2(8987) )
#print()
#print( cnt(99999), cnt2(99999) )
#print( cnt(99899), cnt2(99899) )
#print( cnt(1000), cnt2(1000) )
#print( cnt2(1) )
#exit(0)

print( cnt2(r) - cnt(l-1) )


n,num=input(),0
for i in range(len(n)):
    if n[i]=="4":
        num+=1
    elif n[i]=="7":
        num+=1
    else:
        num+=0
print(["NO","YES"]["4" in str(num) or "7" in str(num)]


a=input().split()
if a[0]<=a[1] and a[0]<=a[2]:
    prinnt('Yes')
else:
    print('No')


def Solve(x,B):
    if(len(B)>X):
        return False
    if(x==len(L)):
        return True
    if(Form(L[x],B)):
        A=list(B)
        for e in range(len(B)):
            r=A[e]
            A[e]=L[x]
            if(Solve(x+1,tuple(A))):
                return True
            A[e]=r
        A+=[L[x]]
        if(Solve(x+1,tuple(A))):
            return True
    return False

def Form(x,B):
    for i in range(len(B)):
        for j in range(i,len(B)):
            if(B[i]+B[j]==x):
                return True
    return False

n=int(input())
L=list(map(int,input().split()))
done=False
for X in range(1,n+1):
    if(Solve(1,(L[0],))):
        print(X)
        done=True
        break
if(not done):
    print(-1)


__author__ = "runekri3"

shop_1, shop_2, between_shops = list(map(int, input().split()))

opt_1 = 2 * shop_1 + 2 * shop_2
opt_2 = shop_1 + shop_2 + between_shops

print(min(opt_1, opt_2))


def ok( s, r ):
  res = s // 50 % 475
  for i in range( 25 ):
    res = ( res * 96 + 42 ) % 475
    if 26 + res == r:
      return True
  return False

P, X, Y = map( int, input().split() )

if any( ok( i, P ) for i in range( X, Y - 1, -50 ) ):
  exit( print( 0 ) )
else:
  ans = 1
  X += 100
  while True:
    if ok( X, P ) or ok( X - 50, P ):
      exit( print( ans ) )
  X += 100
  ans += 1


#include <bits/stdc++.h>
using namespace std;

#define boost ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main(){
    boost;
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++)
        cin >> v[i];
    sort(v.begin(), v.end());

    int t, ans = 0;
    cin >> t;

    for(int i = 0; i < n; i++){
        int k = 0;
        for(int j = i + 1; j < n; j++){
            if(v[j] - v[i] <= t) k++;
        }
        ans = max(ans, k + 1);
    }
    cout << ans << "\n";
    return 0;
}


n = int(input())
m = list(map(int, input().split()))
print(m)
t = int(input())
m.sort()
if n == 1 || len(m) == 1:
    print(1)
elif m[-1]-m[0] <= t:
    print(n)
else:
    mx = 1
    for i in range(n-1):
        ma = 1
        fr = m[i]
        for j in range(i+1, n):
            if m[j]-fr <= t:
                ma += 1
            else:
                break
        mx = max(ma, mx)
print(mx)


import collections
import sys
def recur(_list):
    idx = -1
    next_list = []
    for i,x in enumerate(_list):
        if x > 1:
            idx = i
            q = _list[idx] // 2
            r = _list[idx] % 2
            next_list += [q,r,q]
        else:
            next_list += [x]
    if idx == -1:
        return _list
    else:
        return recur(next_list)

sys.setrecursionlimit(100000)
n,s,e = list(map(int,input().split(' ')))
_list = [n]
print(collections.Counter(recur(_list[:])[s-1:e])[1])


n, l, r = map(int, input().split())
s = ''
a = []
k = n
while k > 1:
    a.append(str(k % 2))
    k = k // 2
cur = 1
k = str(k)
s = k + a[-cur] + k
cur += 1
while cur < len(a):
    s = s + a[-cur] + s
    cur += 1
s = s + a[0] + s
ans = 0
for i in range(l - 1, r):
    ans += int(s[i])
print(ans)


def construct_array(n):
  if n == 1 or n == 0:
    return [n]
  half_n = construct_array(n/2)

  return half_n + [n%2] + half_n

def count_ones(array, i, j):
  count = 0
  while(i<=j):
    count = count + array[i-1]
    i = i + 1
  return count

import sys

for line in sys.stdin:
  x = line.split(' ')
  print count_ones(construct_array(int(x[0])), int(x[1]), int(x[2]))


import sys as s

for v in s.stdin:
    if not v.isnumeric():
        s.exit(1)
    v=list(v.strip())
    pl1=pl2=0
    p=0
    ln=len(v)
    while p<len(v):
        pl1=0
        while p<ln and int(v[p])==0:
            p+=1
            pl1+=1
            if pl1>=7:
                print("YES")
                s.exit()
        pl2=0
        while p<ln and int(v[p])==1:
            p+=1
            pl2+=1
            if pl2>=7:
                print("YES")
                s.exit()
    break
print("NO")
s.exit()


def modinv(a,m):
    b=m
    u=1
    v=0
    while b:
        t=a//b
        a-=t*b
        a,b=b,a
        u-=t*v
        u,v=v,u
    u%=m
    return u
n=int(input())
MOD=998244353
dpsum=[0]*(n+1)
dp=1
for i in range(n):
    dpsum[i+1]=dp+dpsum[i]
    dp=dpsum[i]
ans=dpsum[n]
for _ in range(n):ans*=modinv(2,MOD)
ans%=MOD
print(ans)


def win(x, y, z):
    if y != z:
        return False
    if x == 'rock':
        return y == 'scissors'
    if x == 'scissors'
        return y == 'paper'
    return y == 'rock'

a = []
b = 'MFS'
for i in range(3):
    a.append(input())

for i in range(3):
    if win(a[i], a[(i+1) % 3], a[(i+2) % 3]):
        print(b[i])
else:
    print('?')


import sys
input = sys.stdin.readline

n,k=map(int,input().split())
mod=10**9+7

FACT=[1]
for i in range(1,2*10**5+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0

DP=[0]*(n+1)
DP[0]=1

for yoko in range(n):
    NDP=[0]*(n+1)
    for i in range(n+1):
        for j in range(max(1,i),n+1):
            PLUS=pow(k,i,mod)*Combi(n-i,j-i)*pow(k-1,n-j,mod)
            if i==j:
                PLUS-=pow(k-1,n,mod)

            #print(i,j,PLUS)
            NDP[j]=NDP[j]+DP[i]*PLUS

            NDP[j]%=mod

    DP=NDP
    #print(DP)

print(DP[-1])


MOD = int(1e9+7)

def mult(l, r):
	return (l*r)%MOD

def fast_exp(b, e):
	if e == 0:
		return 1
	if e%2 == 1:
		return mult(b, fast_exp(b, e-1))
	else:
		b2 = fast_exp(b, e//2)
		return mult(b2, b2)

[n, k] = [int(s) for s in input().split(" ")]
print(n, k)
fact = (n+1)*[1]
for i in range(1, n+1):
	fact[i] = mult(i, fact[i-1])

ifact = (n+1)*[1]
ifact[n] = fast_exp(fact[n], MOD-2)
for i in reversed(range(1, n)):
	ifact[i] = mult(i+1, ifact[i+1])

def binom(N, K):
	return mult(mult(fact[N], ifact[K]), ifact[N-K])

def get(i, j):
	X = i*j
	Y = (n-i)*j
	Z = (n-j)*i
	tot = X+Y+Z
	ans = 0
	if (i+j)%2 == 0:
		ans = 1
	else:
		ans = (MOD - 1)
	ans = mult(ans, binom(n, j))
	ans = mult(ans, binom(n, i))
	ans = mult(ans, fast_exp(k, n*n - tot))
	ans = mult(ans, fast_exp(k-1, tot))
	return ans

ans = 0
for i in range(0, n+1):
	for j in range(0, n+1):
		ans = (ans + get(i, j)) % MOD

print(ans)


n = int(input())
a = list(map(int, input().split()))
if a.count(1) == 0:
  print(0)
elif a.count(1) == 1:
  print(1)
else:
  ans = 1
  for i in range(1, n):
    if a[i - 1] == 1 and a[i] == 0:
      cnt = 1
    elif a[i] == 0 and cnt > 0:
      cnt += 1
    else:
      ans *= (cnt + 1)
      cnt = 0
  print(ans)


# https://codeforces.com/problemset/problem/450/B

MOD = 10**9 + 7
x, y = map(int, input().split())
n = int(input())

f = [x, y]
for i in range(2, n):
    f.append(f[-1] - f[-2])

print(f[-1] % MOD)


def main():
    (x, y) = map(int, input().split(' '))
    n = int(input())
    f = [x, y]
    for i in range(2, n):
        f.append(f[i-1] - f[i-2])
    print(f[-1] % 1000000007)

main()


f = [int(x) for x in input().split()]
n = int(input())

for i in range(2, n):
    f.append(f[i - 1] - f[i - 2])
print(f[-1] % 1000000007)


import sys
from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt,gcd

# def time_t():
#     print("Current date and time: " , datetime.datetime.now())
#     print("Current year: ", datetime.date.today().strftime("%Y"))
#     print("Month of year: ", datetime.date.today().strftime("%B"))
#     print("Week number of the year: ", datetime.date.today().strftime("%W"))
#     print("Weekday of the week: ", datetime.date.today().strftime("%w"))
#     print("Day of year: ", datetime.date.today().strftime("%j"))
#     print("Day of the month : ", datetime.date.today().strftime("%d"))
#     print("Day of week: ", datetime.date.today().strftime("%A"))

def ip(): return int(sys.stdin.readline())

def sip(): return sys.stdin.readline()

def mip(): return map(int,sys.stdin.readline().split())

def mips(): return map(str,sys.stdin.readline().split())

def lip(): return list(map(int,sys.stdin.readline().split()))

def matip(n,m):
    lst=[]
    for i in range(n):
        arr = lip()
        lst.append(arr)
    return lst

def factors(n): # find the factors of a number
    return list(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))

def minJumps(arr, n): #to reach from 0 to n-1 in the array in minimum steps
    jumps = [0 for i in range(n)]
    if (n == 0) or (arr[0] == 0):
        return float('inf')
    jumps[0] = 0
    for i in range(1, n):
        jumps[i] = float('inf')
        for j in range(i):
            if (i <= j + arr[j]) and (jumps[j] != float('inf')):
                jumps[i] = min(jumps[i], jumps[j] + 1)
                break
    return jumps[n-1]

def dic(arr): # converting list into dict of count
    return Counter(arr)

def check_prime(n):
    if n<2:
        return False
    for i in range(2,int(n**(0.5))+1,2):
        if n%i==0:
            return False
    return True

# --------------------------------------------------------- #
# sys.stdin = open('input.txt','r')
# sys.stdout = open('output.txt','w')
# --------------------------------------------------------- #

x,y = mip()
n = ip()
if n==1:
    print(x%1000000007)
if n==2:
    print(y%1000000007)
else:
    lst = [x,y]
    for i in range(n-2):
        p = lst[-1]-lst[-2]
        lst.append(p)
    print(lst[-1]%1000000007)


x, y= map(int, input().split())
z = int(input())

lst = [0 for _ in range(z)]
lst[0] = x
lst[1] = y
for i in range(2, z, 1):
    lst[i] = (lst[i-1]-lst[i-2])

print(lst[z-1]%1000000007)


def b(n, k):
    v = 0
    while n:
        n, v = n // k, 10 * v + n % k
    return str(v)[::-1]
k = int(input())
for i in range(1, k):
    print(' '.join(b(i * j, k) for j in range(1, k)))


n = int(raw_input())
def rad_n(n,x):
	r =''
	while x>n:
		r=str(x%n)+r
		x = x/n
	r=str(x)+r
	return r
l = len(str(rad_n(n,(n-1)*(n-1))))
#print l
for i in xrange(1,n):
	for j in xrange(1,n):
		a = rad_n(n,i*j)
		if j==1:
			print a,
		elif j<n-1:
			print ' '*(l-len(a))+a,
		else:
			print ' '*(l-len(a))+a


#inspired by throwawayatcoder
from collections import *
import sys

# "". join(strings)

def ri():
    return int(input())

def rl():
    return list(map(int, input().split()))

t=ri()
for _ in range(t):
    n,k,l=rl()
    dd=rl()
    p = list(range(k+1))+ list(range(k))[::-1]

    def get_depth(t,i):

        return dd[i] + p[t%(2*k)]

    # def getDepth2(t, i):
    #     m = t % (2 * k)
    #     tide = min(m, 2 * k - m)
    #     depth = dd[i] + tide
    #     return depth

    # for z in range(n):
    #     for T in range(2*k):
    #         print (get_depth(T,z)-getDepth2(T, z))

    def canWinFromThere(t,i):
        if i==n:
            return True
        if get_depth(t,i)>l:
            return False

        for wait in range(2*k):
            if get_depth(t+wait, i)>l:
                break

            if canWinFromThere(t+wait+1,i+1):
                return True
        return False

    for u in range(2*k):
        if canWinFromThere(u,0):
            print("Yes")
            break
    else:
        print("No")


import re, sys
from collections import Counter

def check(num, K):
    cnt = 0

    while num:
        if num%10 != 0:
            break

        cnt += 1
        num /= 10

        if cnt == K:
            return True

    return False

def main():
    N, K = map(int, raw_input().split())
    sqrt, val = 0, 1

    for i in range(K):
        val *= 10

    for i in range(val):
        if i*i < val:
            sqrt = i + 1
        else:
            break

    answer = N * val

    for i in range(1, sqrt+1):
        if val%i != 0:
            continue

        num = N * i

        if check(num, K):
            if num < answer:
                answer = num

        num = N * (val / i)

        if check(num, K):
            if num < answer:
                answer = num

    print answer

############################################################
############################################################
############################################################
if(__name__ == "__main__"):
    main()


n=int(input())
if n==3:
    print (1)
elif n==1:
    print (2)
elif n==4:
    print (2)
elif n==2:
    print (3)
else
    print (2)


n = int(raw_input())
s= raw_input()
li=s.split()
for i in range(len(li)):
    li[i]=int(li[i])
if 1 in li:
    print "-1"
else :
    print "1"


a1, b1 = map(int, stdin.readline().split())
a2, b2 = map(int, stdin.readline().split())
a3, b3 = map(int, stdin.readline().split())
mx, mn = max(a1, b1), min(a1, b1)
x = [0]*4
y = [0]*4
x[0], y[0] = a2+a3, max(b2, b3)
x[1], y[1] = a2+b3, max(b2, a3)
x[2], y[2] = b2+a3, max(a2, b3)
x[3], y[3] = b2+b3, max(a2, a3)

def solve():
    for i in xrange(4):
        if mx >= max(x[i], y[i]) and mn >= min(x[i], y[i]):
            print "YES"
            return
    print "NO"
    return
solve()


a=int(input())
l=[]
for i in range(a):
    l.append(int(input())
b=sum(l)
print(int(4.5*a-b)+1)


nimport sys
n = int(input())
a = list(map(int,sys.stdin.readline().strip().split()))
avg = sum(a)/n
count = 0
#print(avg)
if avg >= 4.5:
    print('0')
else:
    a.sort()
    i = 0
    while avg < 4.5:
        a[i] = 5
        count += 1
        avg = sum(a)/n
        i += 1
    print(count)


a, b = map(int, input().split())
if a == b:
    print(0)
else:
    a2 = 0
    a3 = 0
    a5 = 0
    while True:
        if a % 2 == 0:
            a = a // 2
            a2 += 1
        elif a % 3 == 0:
            a = a // 3
            a3 += 1
        elif a % 5 == 0:
            a = a // 5
            a5 += 1
        else:
            break
    b2 = 0
    b3 = 0
    b5 = 0
    while True:
        if b % 2 == 0:
            b = b // 2
            b2 += 1
        elif b % 3 == 0:
            b = b // 3
            b3 += 1
        elif b % 5 == 0:
            b = b // 5
            b5 += 1
        else:
            break
    if a != b:
        print(-1)
    else:
        print(abs(a2 - b2) + abs(a3 - b3) + abs(a5 - b5))


from math import ceil
n, m, s = map(int, raw_input().split())
arr = []
for i in xrange(min(s, n)):
    for j in xrange(min(s, m)):
        arr.append(int(ceil(1.0 * (m - j) / s) * ceil(1.0 * (n - i) / s)))
print n * m if max(arr) is 1 or max(arr) is 0 else max(arr) * arr.count(max(arr))


import string

def determinant(a11, a12, a21, a22):
	return a11 * a22 - a21 * a12

first = [int(coeff) for coeff in input().split()]
second = [int(coeff) for coeff in input().split()]

# Determine rang
rang = 2
if determinant(first[0], first[1], second[0], second[1]) == 0:
	rang = 1

# Check consistency
tilda_rang = 2
if (determinant(first[0], first[2], second[0], second[2]) == 0) and (determinant(first[1], first[2], second[1], second[2]) == 0) and (rang == 1):
	tilda_rang = 1

# Check the special case of null matrix
if rang = 1:
	if (first[0] == 0) and (first[1] == 0) and (second[0] == 0) and (second[1] == 0):
		rang = 0
		if (first[2] == 0) and (second[2] == 0):
			tilda_rang = 0
		else:
			tilda_rang = 1

if rang != tilda_rang:
	print('0')
elif rang == 2:
	print('1')
else:
	print('-1')


def plane(a, b, c):
    if a == b == 0 != c:
        return 0
    else:
        return -1

def hline(b1, c1, a2, b2, c2):
    if b1 == 0:
        if c1 == 0:
            return plane(a2, b2, c2)
        else:
            return -1
    elif a2 == 0:
        if b2 == 0 != c2:
            return 0
        elif c2 * b1 == c1 * b2:
            return -1
        else:
            return 0
    else:
        return 1

def vline(a1, c1, a2, b2, c2):
    return hline(a1, c1, b2, a2, c2)

def intersect(a1, b1, c1, a2, b2, c2):
    if a1 == b1 == 0:
        if c1 == 0:
            return plane(a2, b2, c2)
        else:
            return 0
    if a1 == 0:
        return hline(b1, c1, a2, b2, c2)
    if b1 == 0:
        return vline(a1, c1, a2, b2, c2)
    if a2 == b2 == 0:
        if c2 == 0:
            return plane(a1, b1, c1)
        else:
            return -1
    if a2 == 0:
        return hline(b2, c2, a1, b1, c1)
    if b2 == 0:
        return vline(a2, c2, a1, b1, c1)
    else:
        if a1 * b2 == a2 * b1:
            if c1 * a2 == c2 * a1:
                return -1
            else:
                return 0
        else:
            return 1

a1, b1, c1 = map(int, input().split())
a2, b2, c2 = map(int, input().split())

print(intersect(a1, b1, c1, a2, b2, c2))


C, Ha, Hb, Wa, Wb = (int(x) for x in raw_input().split())

if Ha * Wb > Hb * Wa:
    Ha, Hb, Wa, Wb = Hb, Ha, Wb, Wa

res = 0
for x in xrange(0, Wb):
    r = x * Ha + (C - x * Wa) / Wb * Hb
    res = max(r, res)

print res


C, H1, H2, W1, W2 = map(int, raw_input().split())

if H1 * W2 < H2 * W1:
    H1, H2 = H2, H1
    W1, W2 = W2, W1

r = C % W1
x0 = C // W1
best = 0
for k in xrange(min(x0 + 1, W2)):
    ans_opt = (x0 - k) * H1 + (r + k * W1) * H2 / W2
    if ans_opt < best:
        break
    ans = (x0 - k) * H1 + (r + k * W1) // W2 * H2
    best = max(ans, best)
print best


n = int(input())
i = 1
s = 0
flag = False

while (s < n):
    for j in range(1, i+1):
        s += 1

        if (s == n):
            flag = True
            val = j
            break

    i += 1

    if (flag):
        break

print(val)


from fractions import gcd

N = input()
H = dict()

def number (n,b):
    if not H.has_key((n,b)):
        if n == 1 and b == 1:       H[n,b] = 0
        elif n>b and b>0:           H[n,b] = (n-1)/b + number ((n-1)%b+1,b)
        elif b>n and n>0:           H[n,b] = (b-1)/n + number (n,(b-1)%n+1)
        else:                       H[n,b] = 10000000
    return H[n,b]

m = min (number(N,b) for b in range (N+1))
print m
#print [b for b in range (N+1) if number(N,b)==m]
# for b in range (N+1): print number(N,b),b,gcd(N,b)


from collections import deque

class CodeforcesTask134BSolution:
    def __init__(self):
        self.result = ''
        self.n = 0

    def read_input(self):
        self.n = int(input())

    def process_task(self):
        go = deque([(1, 1, 0)])
        while go:
            exploring = go.popleft()
            if exploring[0] == self.n or exploring[1] == self.n:
                self.result = str(exploring[2])
                break
            else:
                go.append((exploring[0] + exploring[1], exploring[1], exploring[2] + 1))
                go.append((exploring[0], exploring[1] + exploring[0], exploring[2] + 1))

    def get_result(self):
        return self.result

if __name__ == "__main__":
    Solution = CodeforcesTask134BSolution()
    Solution.read_input()
    Solution.process_task()
    print(Solution.get_result())


n = int(input())
c = n - 10
elif c == 10:
    print(15)
    exit()
elif c > 11 or c <= 0:
    print(0)
else:
    print(4)


n = input()
print "codeforces" + "s" * (n - 1)


k = int(input())
myStr = 'codeforce'+ 's'*k
print myStr


n, k = map(int, input().split())
s = list(input())
ans = False
for i in range(len(s) - k):
    flag = True
    for j in range(i, i + k):
        if (s[j] == 'Y'):
            flag = False
            break
    if ((i + k) < len(s)) and s[i + k] == 'N': flag = False
    if (i > 0) and (s[i - 1] == 'N'): flag = False
   # print(i, flag)
    if (flag):
        ans = True
        break
maximum = 0
i = 0
while (i < len(s)):
    now = 0
    while (s[i] != 'N'):
        i += 1
        if (i >= len(s)):
            break
    if (i >= len(s)): break
    while (i < len(s)) and (s[i] == 'N'):
        i += 1
        now += 1
    maximum = max(maximum, now)
if ans and (maximum <= k):
    print('YES')
else: print('NO')


text = input()
bracket = False
bracket_word_count = 0
max_length = 0
bracket_s = ""
non_bracket_s = ""
for ch in text:
	if bracket:
		if ch == ')':
			bracket = False
			bracket_word_count += sum(1 for s in bracket_s.split('_') if s)
			bracket_s = ""
		else:
			bracket_s += ch
	else:
		if ch == '(':
			bracket = True
			max_length = max(max_length, max(len(s) for s in non_bracket_s.split('_')))
			non_bracket_s = ""
		else:
			non_bracket_s += ch
max_length = max(max_length, max(len(s) for s in non_bracket_s.split('_'))
bracket_word_count += sum(1 for s in bracket_s.split('_') if s)
print('{} {}'.format(max_length, bracket_word_count))


n,k=map(int,input().split())
s=[1]
for i in range(n):
  s.append((max(s)+1))
  s+=s[:-1]
print(s[k-1])


a=[int(i) for i in input().split()]
b=[1]
c=[]
for i in range(a[0]):
    c=[i+2]
    b=b+c+b
    if len(b)>=a[1]:
        print(b[a[1]-1])
        break


n,k=map(int,input().split())
a=[1]
b=[]
for i in range(2,n+1):
	b=a+[i]
	a=b+a
print(a[k-1])


n,k=map(int,input().split())
a=[1]
for i in range(n):
    b=a[:]
    a.append(max(a)+1)
    a.extend(b)
print(a[k-1])


string = input()
numbers = string.split()
a = int(numbers[0])
b = int(numbers[1])
sequence = []
for x in range(a):
    sequence += [x + 1] + sequence
print(sequence[b - 1])


n, k = [int(x) for x in input().split()]
start = [1]
i = 0
digit = 2
while i != n-1 and k > len(start):
    start = start + [digit] + start
    digit = digit + 1
    i += 1
print(start[k-1])


n,k=map(int,input().split())
a,b=map(int,input().split())
r=[]
i=1
p=n*k
while i<=n*k:
    r.append(i)
    i+=k
s=1+a
c=[]
for i in r:
    c.append((i-b)%p)
    c.append((i+b)%p)
mx=0
mn=1111111111111111111111111
for i in c:
    dp=i-s
    dp%=p
    if not dp:ns=1
    else:
        j=1
        while (j*p)%dp:j+=1
        ns=(j*p)//dp
    mx=max(mx,ns)
    mn=min(mn,ns)
print(mn,mx)


def cnt_flowers(r, g, b):
    return r // 3 + g // 3 + b // 3

def main():
    r, g, b = map(int, input().split())
    n = min(r, g, b) + 1
    ans = [0] * n
    for i in range(0, n):
        rr = r - i
        gg = g - i
        bb = b - i
        ans[i] = (cnt_flowers(rr, gg, bb) + i)
    print(max(ans))

main()


x, n = map(int, input().split())
MOD = 10**9 + 7
c = 4*x
if c == 0:
    print(0)
elif n == 0:
    ans = 2 * x
else:
    ans = (((c - 2) * pow(2, n -1, MOD) + 1) + MOD) % MOD
print(ans)


import sys
#sys.stdin = open ('input.txt')
#sys.stdout = open ('output.txt', 'w')

h, m = map (float, raw_input ().split (':'))
h += m / 60.
if h not in [12, 0]:
	x = 30. * h
else:
	x = 0
if m not in [12, 0]:
	y = 6. * m
else:
	y = 0

print x, y


n,k=[int(i) for i in input().split()]
l=[]
for i in range(n):
    l.append(i+1)

import itertools
l_C_k=list(itertools.combinations(l,k))

l_xor_sum=[]
for i in l_C_k:
    xor_sum=i[0]^i[1]
    for j in i[2:]:
        xor_sum=xor_sum^j
    l_xor_sum.append(xor_sum)

print(max(l_xor_sum))


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

n = mint()
p = [0]*n
x = dict()
y = dict()
for i in range(n):
	a = tuple(mints())
	p[i] = a
	if a[0] in x:
		x[a[0]].append(i)
	else:
		x[a[0]] = [i]
	if a[1] in y:
		y[a[1]].append(i)
	else:
		y[a[1]] = [i]

del(pow)
r = 1
q = [0]*n
w = [True]*n
ql = 0
qr = 0
for i in range(n):
	if w[i]:
		w[i] = False
		q[qr] = i
		qr += 1
		qlb = ql
		e = 0
		xs = set()
		ys = set()
		while ql < qr:
			v = q[ql]
			ql += 1
			a = p[v]
			xs.add(a[0])
			ys.add(a[1])
			for u in x[a[0]]:
				e += 1
				if w[u]:
					w[u] = False
					q[qr] = u
					qr += 1
			for u in y[a[1]]:
				e += 1
				if w[u]:
					w[u] = False
					q[qr] = u
					qr += 1
		vc = ql-qlb
		#print(vc,e,vc*3-1)
		if vc*3-1 == e:
			r = (r*(pow(2,vc+1,1000000007)-1))%1000000007
		else:
			r = (r*(pow(2,len(xs)+len(ys),1000000007)))%1000000007
print(r)


n = int(input())
disjointSet = [-1] * n
def root(x, level=200):
    if disjointSet[x] < 0:
        return x
    if level < 1:
        while disjointSet[x] >= 0:
            x = disjointSet[x]
        return x
    disjointSet[x] = root(disjointSet[x], level - 1)
    return disjointSet[x]

def join(x, y):
    r1, r2 = root(x), root(y)
    if r1 == r2:
        return
    disjointSet[r2] = r1

points = []
vertPoints = {}
horizPoints = {}
for i in range(n):
    a, b = map(int, input().split())
    points.append((a, b))
    if a in vertPoints:
        join(i, vertPoints[a])
    else:
        vertPoints[a] = i
    if b in horizPoints:
        join(i, horizPoints[b])
    else:
        horizPoints[b] = i

sets = {}
for i in range(n):
    r = root(i)
    if r in sets:
        sets[r].append(points[i])
    else:
        sets[r] = [points[i]]

ans = 1
for i in sets:
    s = sets[i]
    horiz = [x for x,y in s]
    vert = [y for x,y in s]
    tmp = len(set(horiz)) + len(set(vert))
    if tmp <= len(s):
        ans *= 2 ** tmp
    else:
        ans *= 2 ** tmp - 1
    ans %= 10 ** 9 + 7

print(ans % (10 ** 9 + 7))


 import sys
import time

for line in sys.stdin:
  ll = len(line)-1
  fail=0
  for i in range(ll):
    if i == ll-1-i : continue
    x = int(line[i])
    y = int(line[ll-1-i])
    if (x,y) not in [(3,3),(4,6),(6,4),(7,7),(8,0),(0,8),(5,9),(9,5)]:fail=1
  if fail: print("No")
  if not fail:print("Yes")


key=input()
str=input()
a=['q','w','e','r','t','y','u','i','o','p']
b=['a','s','d','f','g','h','j','k','l',';']
c=['z','x','c','v','b','n','m',',','.','/']
if key=='R':
for i in str:
    if i in a:
        print(a[a.index(i)-1],end='')
    elif i in b:
        print(b[b.index(i)-1],end='')
    elif i in c:
        print(c[c.index(i)-1],end='')
    else:
        print(i,end='')
else:
    for i in str:
    if i in a:
        print(a[a.index(i)+1],end='')
    elif i in b:
        print(b[b.index(i)+1],end='')
    elif i in c:
        print(c[c.index(i)+1],end='')
    else:
        print(i,end='')


import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline

n,a,b=map(int,input().split())

if a<b: a,b=b,a

if b==0:
    # 1 01 001 0001 ... is optimal
    print(n*a)
else:
    # pascal's triangle thing
    pascal=[[1]*20005]
    for i in range(20004):
        newrow=[1]
        for j in range(1,20005):
            newrow.append(newrow[-1]+pascal[-1][j])
            if newrow[-1]>n: break
        pascal.append(newrow)
    def getcom(a,b):
        # return a+b choose b
        # if larger than n, return infinite
        if len(pascal[a])>b: return pascal[a][b]
        if b==0: return 1
        if b==1: return a
        return 100000005

    # start with the null node (prefix cost 0)
    # can split a node into two other nodes with added cost c+a+b
    # new nodes have prefix costs c+a, c+b
    # want n-1 splits in total
    n-=1    # now represents number of splits needed

    # binary search the last cost added
    lo=0
    hi=a*int((n**0.5)*3+3)

    while 1:
        mid=(lo+hi)//2
        mid=11
        # count stuff
        c0=0    # < mid
        c1=0    # = mid
        for i in range(mid//a+1):
            j=(mid-i*a)//b
            if (mid-i*a)%b!=0:
                # c0 += iC0 + (i+1)C1 + (i+2)C2 + ... + (i+j)Cj
                for k in range(j+1):
                    print(mid,i,k)
                    c0+=getcom(i,k)
                    if c0>n: break
            else:
                for k in range(j):
                    print(mid,i,k)
                    c0+=getcom(i,k)
                    if c0>n: break
                print(mid,i,j,"c1")
                c1+=getcom(i,j)
        print(mid,"is",c0,c1)
        if n<c0:
            hi=mid-1
        elif c0+c1<n:
            lo=mid+1
        else:
            # mid is correct cutoff
            lowcost=0   # sum of all cost, where cost < mid
            for i in range(mid//a+1):
                j=(mid-i*a)//b
                if (mid-i*a)%b!=0:
                    for k in range(j+1):
                        lowcost+=getcom(i,k)*(i*a+k*b)
                else:
                    for k in range(j):
                        lowcost+=getcom(i,k)*(i*a+k*b)
            temp=lowcost+(n-c0)*mid
            print(temp+n*(a+b))
            break


n=int(input())
numbers=[1,1,2,1,2,3,1,2,3,4,1,2,3,4,5,1,2,3,4,5,6,1,2,3,4,5,6,7]
pattern=[1,2,3,4,5,6,7]
count=8
while n>len(numbers):
    pattern.append(count)
    numbers.extend(pattern)
    count+=1
print(numbers[n-1])


while True:
    n = int(input())
    if n in [1,60]:
        break
if (n%2 ==0):
    print(n)
else:
    print(n-1)


x=int(input())
y=input()
a=[]
d1=0
d2=[]
m=0
for c in x:
    x1=0
    x2=0
    s=c=="_" or c==")" or c=="("
    if s and isalpha(x[x.index(c)+1]):
        a.append(x.index(c))

    if c==")" and x[a[len(a)-1]]=="(":
        x1=a.[len(a)-1]+1
        x2=index(c)
        b=[]
        for i in x[x1:x2]:
            if i=="_"  and isalpha(x[x.index(i)+1]):
               d1+=1
        for i in range((len(a)-1)):
            y1=a[i+1]-a[i]-1
            d2.append(y1)
        a=[]
print(max(d2),d1)


def kthDivisor(n, k):
    divisors = []
    i = 1
    while i * i < n:
        if n % i == 0:
            divisors.append(i)
        i += 1
    if i * i > n:
        i -= 1
    while i > 0:
        if n % i == 0:
            divisors.append(n/i )
        i -= 1
    if len(divisors) < k:
        return -1
    return int(divisors[k - 1])

n,k=map(int,input().split())
print(kthDivisor(n,k))


from math import ceil
a,b,c = map(int,input().split())
t = max(a,b,c)
if t == c:
	print(32+3*ceil((c-2)/2))
elif t == b:
	print(31+3*ceil((b-2)/2))
elif t == a:
	print(30+3*ceil((a-2)/2))


n = int(input())
s = 0
for i in range(n):
    if (i + 1) % 2520 == 0:
        s += 1
print (s)


l=""
k=int(input())
index=0
counter=1
while True:
    for i in str(counter):
        if index<=9999:
            l+=i
            index+=1
        counter+=1
        if index>9999:
            break
if 1<=k<=10000:
    print(l[k-1])


l=''
k=int(input())
index=0
counter=1

for i in range(1,k+1):
        if index<=k-1:
          l+=str(i)
          index+=1
        else:
          break

if 1<=k <=10**12:
     print(l[k-1])


n = int(input())
a = list(map(int, input().split()))
idx = []
for i in range(1, n // 2 + 1):
    idx.append(2 * i + 1)
a.sort()
s1 = 0
s2 = 0
for i in range(0, n // 2):
    s1 += abs(a[i] - 2 * i -a 1)
    s2 += abs(a[i] - 2 * i - 2)
print(min(s1, s2))


mod=int(10e8+7)
a,b,n,x=map(int,input().split())
exp=a
ans=1
while n>0:
    if(n%2==1):
        ans=ans*exp
    exp=exp**2
    n//=2

if ans!=1:
    res=((ans-1)//(a-1))%mod
    ans=ans%mod
    print(((ans*x)%mod+(res*b)%mod)%mod)
else:
    print(((ans*x)%mod+((n+1)*b)%mod)%mod)


n, k =map(int, input().split())
for i in range(0 , k):
    last_numeral = 10*(1-(n/10-truncate(n/10)))
    if last_numeral = 0:
        n=n/10
    else
        n=n-1
    print(n)


def check(4,512):
    for i in range(x):
        if number%10 == 0:
            number = number / 10
            print(number)
        else:
            number = number -1
            print(number)

check()


import collections
n,s,e = map(int,raw_input().split())
a =  bin(n)[2:]
#print a
b = str(a[0])
for i in xrange(1,len(a)):
	b = str(b)+a[i]+str(b)
print collections.Counter(b[s-1:e])['1']


num = int(input())

count = 0
while num != 0:
    lst = [int(i) for i in str(num)]
    num -= max(lst)
    count += 1

return count


# read line1 in, split into elements, cast to integers, stored at List_1
list_1 = map(int,raw_input().split())

# read line2 in, split into elements, cast to integers, stored at interesting minutes
interesting_minutes = map(int,raw_input().split())

#check the first element to see if it is greater than 15, print 15, break out of the loop
if interesting_minutes[0] > 15:
    print 15
else:
	for index in range(len(interesting_minutes)):
	    #check the last element to see if 90 - (this element) greater than 15
	    if index == len(interesting_minutes) -1:
            if 90 - interesting_minutes[index] > 15:
                print interesting_minutes[index] + 15
                break
            else:
                print 90
                break

	    #for all elements which is not the first and the last, calculate the distance between the next element and current
	    else:
	        distance = interesting_minutes[index+1] - interesting_minutes[index]
	        if distance > 15:
	            print int(interesting_minutes[index] + 15)
	            break


a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())

c1 = min(a,d)*e + f*(min(b,c,max(0,d-a))
c2 = min(d, b, c) * f + min(max(d - min(b, c), 0), a) * e)

print(c1,c2)
print(max(c1,c2))


a=int(input())

b=int(input())
c=int(input())

d=int(input())

e=int(input())
f=int(input())

big=max(e,f)
x=min(b,c)

if (big==f):
    if((d-x)>0):
        sum=min(x,d)*f + min(a,(d-x))*e
    else:
        sum=d*f
else:
    if((d-a)>0)
        sum=min(a,d)*e + min(x,(d-a))*f
    else:
        sum=d*e
print(sum)


import math
import sys
input = raw_input()
a = input.split()
x = [int(i) for i in a]

count = 0
#print x
x.sort()
total = sum(x)
while (total > 2) and (x[2] != total):
	x.sort()
#	print x
#	if x[2] == 1:
#		count += 1
#		break
#	max_value = max(x)
#	max_index = x.index(max_value)
	x[2] -= 2
#	x.sort()
#	max_value = max(x)
#	max_index = x.index(max_value)
	x[1] -= 1
	count += 1
	total -= 3

print int(count	)


import math
x, y = map(int, raw_input().split())
ans = {}
mod = 10 ** 9 + 7
if y%x !=0:
	print 0
else:
	a=y/x
	factors=[]
	for i in xrange(2, int(math.floor(math.sqrt(a))+1)):
		if a%i==0:
			factors.append(i)
			a!=i*i and factors.append(a/i)
	factors.sort()
	ans[1]=1
	def getAns(f):
		if f in ans:
			return ans[f]
		res=2**(f-1)%mod
		res=(res+mod-1)%mod
		for i in factors:
			if i>=f:
				break
			if f%i==0:
				res+=(mod-getAns(i))
				res%=mod

		ans[f]=res
		return res
	print getAns(a)


from collections import defaultdict
x, y = map(int, input().split())
if y%x != 0:
	print(0)
	exit()
x = y//x
divisors = []
for i in range(1,int(x**(.5))+1):
	if x%i == 0:
		divisors.append(i)
		divisors.append(x//i)
if divisors[-1] == divisors[-2]: divisors.pop()
divisors.sort()
va = defaultdict(int)
va[1] = 1
for i in range(1, len(divisors)):
	k = divisors[i]
	count = 2**(k-1)
	for j in range(i):
		if k%divisors[j] == 0: count -= va[divisors[j]]
	va[k] = count
print(va[x])


import fileinput
i=0
costMatrix = []

for line in fileinput.input():
    if i<3:
        costMatrix.append([int(i) for i in line.split()])
        i+=1
    else:
        n = int(line)

def switchC(MAT):
    SW = [[0]*3 for i in range(3)]
    SW[0][1]=MAT[0][2]
    SW[0][2]=MAT[0][1]
    SW[1][0]=MAT[1][0]
    SW[2][0]=MAT[1][0]
    SW[1][2] = MAT[2][1]
    SW[2][1] = MAT[1][2]
    return SW

def switchC2(MAT):
    SW = [[0]*3 for i in range(3)]
    SW[0][1]=MAT[1][0]
    SW[0][2]=MAT[1][2]
    SW[1][0]=MAT[0][1]
    SW[2][0]=MAT[2][1]
    SW[1][2] = MAT[0][2]
    SW[2][1] = MAT[2][0]
    return SW

def switchC3(MAT):
    SW = [[0]*3 for i in range(3)]
    SW[0][1]=MAT[2][1]
    SW[0][2]=MAT[2][0]
    SW[1][0]=MAT[1][2]
    SW[2][0]=MAT[0][2]
    SW[1][2] = MAT[1][0]
    SW[2][1] = MAT[0][1]
    return SW

def hashMAT(n,MAT):
    M = max(n,MAT[0][1],MAT[0][2],MAT[1][0],MAT[1][2],MAT[2][0],MAT[2][1])
    hashed = n + M*MAT[0][1]+M**2*MAT[0][2]+M**3*MAT[1][0]+M**4*MAT[1][2]+M**5*MAT[2][0]+M**6*MAT[2][1]
    return hashed

a = {}

def SmallY(n,MAT):
    h = hashMAT(n,MAT)
    isIN = h in list(a.keys())
    if n == 1:
        if isIN:
            return a[h]
        else:
            a[h] = min(MAT[0][2], MAT[0][1]+MAT[1][2])
            return a[h]
    else:
        if isIN:
            return a[h]
        else:
            a[h] = min(MAT[0][2]+SmallY(n-1,switchC(MAT))+SmallY(n-1,switchC2(MAT)),MAT[0][1]+MAT[1][2]+2*SmallY(n-1,MAT)+SmallY(n-1,switchC3(MAT)))
            return a[h]

print(SmallY(n,costMatrix))


n = int(input())
val = [[]]
for x in sorted(int(x) for x in input().split()):
    for l in val:
    if x >= len(l):
            l.append(x)
            break
    if len(val[-1]) > 0:
    val.append([])
print(len(val) - 1)


num_interesting_minutes = input()
minutes_list = [int(i) for i in input().split()]
if minutes_list[0] > 15:
    return 15
will_watch_minutes = minutes_list[0]
for i in range(len(minutes_list) - 1):
    if (amount := (minutes_list[i + 1] - minutes_list[i])) <= 15:
        will_watch_minutes += amount
    else:
        will_watch_minutes += 15
        break
print(will_watch_minutes)


n=int(input())
i=1
mu=2520
bonus=0
while(mu<=n):
    mu=2520
    if(mu<=n):
        bonus+=1
    i+=1
    mu=mu*i
print(bonus)


a,b = map(int,input().split())
days = list(map(int,input().split()))
c = max([days[i]-days[i+1] for i in range(len(days)-1)])-b)
print(c) if c > 0 else print(0)


import sys
import os
from io import BytesIO, IOBase

#########################
# imgur.com/Pkt7iIf.png #
#########################

# returns the list of prime numbers less than or equal to n:
'''def sieve(n):
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r'''

# returns all the divisors of a number n(takes an additional parameter start):
'''def divs(n, start=1):
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors'''

# returns the number of factors of a given number if a primes list is given:
'''def divn(n, primes):
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t
    return divs_number'''

# returns the leftmost and rightmost positions of x in a given list d(if x isnot present then returns (-1,-1)):
'''def flin(d, x, default=-1):
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return (default, default)
    else:
        return (left, right)'''

# returns (b**p)%m
'''def modpow(b,p,m):
    res=1
    b=b%m
    while(p):
        if p&1:
            res=(res*b)%m
        b=(b*b)%m
        p>>=1
    return res'''

# if m is a prime this can be used to determine (1//a)%m or modular multiplicative inverse of a number a
'''def mod_inv(a,m):
    return modpow(a,m-2,m)'''

# returns the ncr%m for (if m is a prime number) for very large n and r
'''def ncr(n,r,m):
    res=1
    if r==0:
        return 1
    if n-r<r:
        r=n-r
    p,k=1,1
    while(r):
        res=((res%m)*(((n%m)*mod_inv(r,m))%m))%m
        n-=1
        r-=1
    return res'''

# returns ncr%m (if m is a prime number and there should be a list fact which stores the factorial values upto n):
'''def ncrlis(n,r,m):
    return (fact[n]*(mod_inv(fact[r],m)*mod_inv(fact[n-r],m))%m)%m'''

#factorial list which stores factorial of values upto n:
'''mx_lmt=10**5+10
fact=[1 for i in range(mx_lmt)]
for i in range(1,mx_lmt):
    fact[i]=(i*fact[i-1])%mod'''

#count xor of numbers from 1 to n:
'''def xor1_n(n):
    d={0:n,1:1,2:n+1,3:0}
    return d[n&3]'''

def ceil(n, k): return n // k + (n % k != 0)
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def prr(a, sep=' '): print(sep.join(map(str, a)))
def dd(): return defaultdict(int)
def ddl(): return defaultdict(list)
def ddd(): return defaultdict(defaultdict(int))

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
			while True:
					b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
					if not b:
							break
					ptr = self.buffer.tell()
					self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
			self.newlines = 0
			return self.buffer.read()

	def readline(self):
			while self.newlines == 0:
					b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
					self.newlines = b.count(b"\n") + (not b)
					ptr = self.buffer.tell()
					self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
			self.newlines -= 1
			return self.buffer.readline()

	def flush(self):
			if self.writable:
					os.write(self._fd, self.buffer.getvalue())
					self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
	def __init__(self, file):
			self.buffer = FastIO(file)
			self.flush = self.buffer.flush
			self.writable = self.buffer.writable
			self.write = lambda s: self.buffer.write(s.encode("ascii"))
			self.read = lambda: self.buffer.read().decode("ascii")
			self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

from collections import defaultdict
#from collections import deque
#from collections import OrderedDict
#from math import gcd
#import time
#import itertools
#import timeit
#import random
#from bisect import bisect_left as bl
#from bisect import bisect_right as br
#from bisect import insort_left as il
#from bisect import insort_right as ir
#from heapq import *
#mod=998244353
#mod=10**9+7

for _ in range(1):
    a=li()
    print(2+a[2]^min(a))


s = raw_input()

def check():
    i = len(s) - 1
    cnt = 0
    while i >= 0:
        if s[i] == '0':
            cnt += 1
        else:
            if cnt >= 6:
                return True
    return False

print 'yes' if check() else 'no'

# need to be positive


l,r=map(int,input().split())

a=[]
def foo(n):
	a.append(n)
	if n>10*r:
		return
	foo(10*n+4)
	foo(10*n+7)
	return

foo(0)
a.sort()

def get_sum(m):
	s=0
	for i in range(1,len(a)):
		s+=a[i]*(min(a[i],m)-min(a[i-1],m))
	return s

print(get_sum(r)-get_sum(l-1)


ans = 0
mod = 1000000007
a, b, n = map(int, input().split())
def chk(x):
    while x:
        if x % 10 != a and x % 10 != b:
            return 0
        x //= 10
    return 1
f = [1]
for i in range(1, n + 1):
    f.append(i * f[-1])
for x in range(n + 1):
    if chk(x * a + (n - x) * b):
        ans += pow(f[x] * f[n - x], mod - 2, mod)
        ans %= mod
print(ans * f[n] % mod)


s=input().split()
L=[]
for i in range(1,len(s)):
    L.append(int(s[i]))
L.sort()
toPrint=""
for x in L:
    toPrint+=str(x)+" "
time.sleep(1.3)
print(toPrint)


primes = []

def list_primes_upto(upto :int):
    pcl = [1 for x in range(upto+1)]
    global primes
    primes = []
    if upto >= 2: primes.append(2)
    if upto >= 3: primes.append(3)
    for i in range(6, upto + 2, 6):
        if i-1 <= upto and pcl[i-1] == 1:
            primes.append(i-1)
            for k in range((i-1)**2, upto+1, (i-1)*2):
                pcl[k] = 0
        if i+1 <= upto and pcl[i+1] == 1:
            primes.append(i+1)
            for k in range((i+1)**2, upto+1, (i+1)*2):
                pcl[k] = 0
    return

t = int(input())

tests = []
for q in range(t):
    tests.append([int(x) for x in input().split()])

primes_limit = 0
for tp in tests:
    if tp[0]-tp[1] == 1:
        primes_limit = max(primes_limit, tp[0]+tp[1])

list_primes_upto(primes_limit)

for a, b in tests:
    yes = True
    if a-b != 1:
        yes = False
    if yes:
        apb = a+b
        is_apb_prime = True
        for p in primes:
            if not is_apb_prime or p >= apb:
                break
            is_apb_prime = is_apb_prime and (apb % p != 0)
        yes = yes and is_apb_prime
    print("YES" if yes else "NO")


a,b = ( x for x in input().split(" "))
i = 0
while(b>a):
    a*=3
    b*=2
    i+=1
print(i)


d, c = map(int, input().split())
m = 0
ds = list(map(int, input().split()))
for i in range(d-1):
	m = max(ds[i] - ds[i+1], m)
if (m != 0)
	print(m - c)
else:
	print(m)


a,b,c,d=input().split()
n=min(int(a),min(int(c),int(d))
m=int(a)-n
j=min(int(b),m)
print(256*n+32*j)


from math import *
import sys
from queue import *

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
f = 0
s = 0
al = 0
for i in range(n):
    if a[i] + b[i] == 2:
        al += 1
    elif a[i] == 1:
        f += 1
    elif b[i] == 1:
        s += 1
if f == 0 || s == f:
    print(-1)
else:
    print(ceil((s + 1) / f))


def one_or_zero(n):
    if n%2 == 0:
        return 0
    else:
        return 1

if __name__ == "__main__":
    n = int(input())
    print("%d" % one_or_zero(n)


total = []

def excg(s, p1, p2, new):
    if p1 > p2:
        (p1, p2) = (p2, p1)
    #print ('--', s, p1, p2, new)
    s = s[:p1] + s[p1+1:p2] + s[p2+1:]
    #print (s + new)
    #input()
    return s + new

def calc(s):
    global total

    if len(s) == 1:
        if s[0] not in total:
            total += s[0]
        return

    pr = s.find('R')
    pr2 = s.find('R', pr + 1)

    pg = s.find('G')
    pg2 = s.find('G', pg + 1)

    pb = s.find('B')
    pb2 = s.find('B', pb + 1)

    if pr+pr2>0: calc(excg(s, pr, pr2, 'R'))
    if pg+pg2>0: calc(excg(s, pg, pg2, 'G'))
    if pb+pb2>0: calc(excg(s, pb, pb2, 'B'))

    if pr+pb>0: calc(excg(s, pr, pb, 'G'))
    if pr+pg>0: calc(excg(s, pr, pg, 'B'))
    if pb+pg>0: calc(excg(s, pb, pg, 'R'))

n = input()
s = input()

calc(s)

for b in total: print(b, end='')


Inp = str( raw_input() )
arr = Inp.split()
a = long( arr[0] )
b = long( arr[1] )
ans = 0L
MOD = 1000000007L

for i in range( 1, b ):
    Sum = 0L
    Sum = ( a * i ) % MOD
    Sum = ( Sum + i * b * a * ( a + 1 ) / 2 ) % MOD
    ans = ( ans + Sum ) % MOD

print ans


import math

line = raw_input()
a, b = [int(x) for x in line.split()]

nice = 0

for i in range (1, a+1):
    for j in range (1, b):
        nice += (i*j)*b + j

print nice%1000000007


#!/usr/bin/env python
# coding: utf-8

# In[120]:

n, k = [int(i) for i in input().split()]

# In[122]:

polozh = [i + 1 for i in range(n)]
vin = [-1 for i in range(1,n)]

for j in range(n):
    hod_list = polozh[0:n-j] + vin[0:j]
    if sum(hod_list) == k:
        break
#out = 0
#for i in hod_list:
#    if i == -1:
#        out +=1

print(j)


n=2*int(input())
w=sorted(map(int,input().split()))
r=10000
for i in range(n):
    for j in range(i):
        u=[w[k] for k in range(n) if i!=k!=j)
        r=min(r,sum(u[i+1]-u[i] for i in range(0,n-3,2)))
print(r)


big = input()
small = input()
left = [0] * (len(small) + 1)
left[0] = -1
wsk = -1
for i in range(1, len(small) + 1):
    while True:
        wsk += 1
        if big[wsk] == small[i - 1]:
            left[i] = wsk
            break
big = big[::-1]
small = small[::-1]
right = [0] * (len(small) + 1)
right[0] = -1
wsk = -1
for i in range(1, len(small) + 1):
    while True:
        wsk += 1
        if big[wsk] == small[i - 1]:
            right[i] = wsk
            break
wyn = 100000000
for i in range(len(left))


x = int(raw_input())
qts = set()
for i in range(2, x+1):
    n = x / i
    for m in range(1, n+1):
    	qts.add(m)

print(len(qts) + 1)


from sys import stdin
lines = stdin.readlines()
n = int(lines[0])

def split(x):
    summ = 0
    for i in range(1,x/2+1):
        if x % i == 0:
            summ += 1
        elif x / i > 1:
            summ += 1
    return summ+1
print split(n)


n=input()
t=int(input())
b=[]
c=0
d=""
for i in range(t):
    x=(input())
    b.append(x)
    d=d+x
if len(b)>1:
    if d.count(n[0])>=n.count([n[0]) and d.count(n[1])>=n.count(n[1]):
        if any(c for c in b if c[1]==n[0] or c[0]==n[1]):
            print("YES")
        else:
            print("NO")
    else:
        print("NO")
else:
    if b[0]==n or b[0][::-1]==n:
        print("YES")
    else:
        print("NO")


n = int(input())
coins = [1,5,10,20,100]

if(n%100==0):
    print(n//100)
else:
    optimal = [(10 ** 9) + 1] * (n + 1)
    optimal[0] = 0
    for i in range(n+1):
        for coin in coins:
            if(coin<=i):
                tmp = optimal[i-coin] +1
                if(tmp<optimal[i]):
                    optimal[i] = tmp

    print(optimal[-1])


n = int(input())
sol = [0 for _ in range(n+1)]
comm = [100,20,10,5,1]
for i in range(1, n+1):
  for j in comm:
    if (i-j) >= 0:
      sol[i] = 1 + sol[i-j]
      break
print(sol[n])


import sys
def minCoins(coins, m, V):
    table = [0 for i in range(V + 1)]

    table[0] = 0

    for i in range(1, V + 1):
        table[i] = sys.maxsize

    for i in range(1, V + 1):

        for j in range(m):
            if (coins[j] <= i):
                sub_res = table[i - coins[j]]
                if (sub_res != sys.maxsize and sub_res + 1 < table[i]):
                    table[i] = sub_res + 1
    return table[V]

V = int(input())
coins = [1,5,10,20,100]
m = len(coins)
print(minCoins(coins,m,V))


n,m=input().split()
n=int(n)
m=int(m)
if(m>=n):
    m=n
    print(n)
else:
    a=2*(n-m)
    u=1
    l=n-1-m
    while(u!=l):
        mid=(u+l)//2
        if(mid*(mid+1)>=a):
            if((mid-1)*mid<a):
                break
            else:
                l=mid-1
        else:
            if((mid+1)*(mid+2)>=a):
                mid+=1
                break
            else:
                u=mid+1
    print(mid+m)


def swap (a, b):
    if a > b:
        tmp = a
        a = b
        b = tmp

a = input ();
b = input ();
c = input ();

if a > b:
    swap (a, b)

i = 0
ans = False
while a*i <= c and not ans:
    if (c-a*i) % b == 0:
        ans = True
    i += 1

if ans == True:
    print ("Yes")
else:
    print ("No")


n,m,k = map(int,input().split())

steps = dict()
for x in range(n):
    steps[x] = (x+1,1)

current = n*m - 1
if k < n:
    print (k+1,1)
else:
    remaining = k - n
    row_from_down = remaining // 2

    row = n - row_from_down
    # 11 10
    if row%2:
        col = remaining % (m-1)
        col = m - col

    else:
        col = remaining % (m-1)
        col += 2
    print (row, col)


n, m, k = map(int, input().split())
s = list()
for i in range(n):
    s.append((0, i))
for i in range(n - 1, -1, -1):
    if i % 2:
        for q in range(1, m):
            s.append((q, i))
    else:
        for q in range(m - 1, 0, -1):
            s.append((q, i))
o = s[k % (n * m)]
print(o[1] + 1, o[0] + 1)


import sys

if __name__ == "__main__":
    n, a, b, p, q = [int(i) for i in sys.stdin.readline().strip().split()]
    ass = set(xrange(a, n+1, a))
    bss = set(xrange(b, n+1, b))
    first_part = len(ass - bss) * p
    second_part = len(bss - ass) * q
    third_part = len(bss & ass) * max(p, q)
    print first_part + second_part + third_part


'''
Created on 12.05.2012

@author: matt
'''

def primes(n):
    n = n + 1
    store = [True for i in range(n)]
    store[0] = store[1] = False
    index = 1
    while True:
        index += 1
        while index < n and store[index] == False:
            index += 1
        if index >= n:
            yield n-1
        for i in range(index ** 2, n, index):
            store[i] = False
        yield index

def factorize(n):
    MP = int(n // 2 + 1)
    P = primes(MP)
    k = n
    factors = {}
    while k != 1:
        nextp = next(P)
        while k % nextp == 0:
            if not nextp in factors:
                factors[nextp] = 0
            factors[nextp] += 1
            k //= nextp
    return factors

def solve():
    try: input = raw_input
    except: pass
    N = int(input())
    k = N
    r = N
    factors = factorize(k)
    fs = sorted([(i, j) for i, j in factors.items()])
    for i,j in fs:
        for t in range(j):
            r += k // i
            k //= i
    print str(r)

solve()


n=input()
s=n
while n != 1:
    for i in range(n/2,0,-1):
        if not n%i:
            n = i
            break
    s+=n
print s


import sys
def basic(n, coins):
    dp = [0 for _ in range(n+1)]
    dp[0] = 0
    count = 0
    for i in range(1, n+1):
        dp[i] = sys.maxsize

    for j in range(1, n+1):
        for k in range(len(coins)):
            if coins[k] <= j:
                res = dp[j-coins[k]]
                if (res != sys.maxsize) and (res+1 < dp[j]):
                    dp[j] = res + 1

    return dp[n]

n = int(input())
# arr = list(map(int, input().split(' ')))
coins = [1, 5, 10, 20, 100]
print(basic(n, coins))


import sys

def calculateCoins(withdraw_balance,dollar_coins,coins_length):
    bill_values = []
    bill_values.append(0)

    for i in range(1,withdraw_balance+2):
        bill_values.append(sys.maxsize)

    if(withdraw_balance == 0):
        return(bill_values[0])

    for i in range(1,withdraw_balance+2):
        for j in range(0,coins_length):
            if(dollar_coins[j] <= i):
                sub_result = bill_values[i - dollar_coins[j]]

                if(sub_result != sys.maxsize and sub_result < bill_values[i]):
                    bill_values[i] = sub_result +1

    return(bill_values[withdraw_balance])

withdraw_balance = input()
dollar_coins = [100, 20, 10, 5, 1]
coins_length = len(dollar_coins)

total_bills = calculateCoins(int(withdraw_balance),dollar_coins,coins_length)
print(total_bills)


x,y=[int(x) for x in input().split()]
a=[]
for i in range(1,x+1,2):
    a.append(i)
for i in range(2,x+1,2):
    a.append(i)
print(a.pop(y-1))


n,k=map(int,input().split())
a=[int(x) for x in input().split()]
a.sort(reverse=True)
x=a[:k]

j=k
while(j<n and a[j]==a[k-1]):
    x.append(a[j])
c=0
for i in x:
    if i==0:
        c+=1
print(len(x)-c)


l, r, x, y, k = map(int, raw_input().split(' '))
a = set(range(k * x, k * y + 1, k))
b = set(range(l, r + 1))
if len(a & b) == 0:
    print 'NO'
else:
    print 'YES'


n=input().split()
l=int(n[0])
r=int(n[1])
s=0
for i in range(l,r):
    i=str(i)
    if i[0]==i[len(i)-1]:
        s+=1
print(s)


from math import sqrt
def naive_subseq(sq, num):
    next_sq = 0
    for dig in num:
        if dig == sq[next_sq]:
            next_sq += 1
            if next_sq == len(sq):
                break
    if next_sq == len(sq):
        return True
    else:
        return False
n = raw_input().strip()
lim = int(sqrt(int(n))) + 1
squares, done = map(str, [i * i for i in range(1,lim)]), False
for i in range(lim - 1, -1, -1):
    if naive_subseq(squares[i], n):
        done = True
        print len(n) - len(squares[i])
        break
if not done:
    print -1


import itertools
import time
a = map(int, raw_input().split())[1:]
a.sort()
time.sleep(1.2)
print " ".join(map(str, b))


k,b,n,t = map(int, raw_input('').split(' '))
if k==1:
    z = k+b*(n-1)
    if t >= z:
        i = 0
    else:
        i = int((z-t)/float(b) + 1)
        amount = t+b*(i-1)
        while amount < z:
            i += 1
            amount = t+b*(i-1)
else:
    powers = [1]
    s = 1
    for i in range(1,n):
        np = powers[-1]*k
        powers.append(np)
        s += np
    s -= np

    z = powers[n-1]+b*s
    if t >= z:
        i = 0
    else:
        i = 1
        amount = powers[i-1]*(t*(k-1)+b)-b
        while amount < z*(k-1):
            i += 1
            amount = powers[i-1]*(t*(k-1)+b)-b

print(i)


import sys
n = int(sys.stdin.readline())
s= sys.stdin.readline().strip()
mini=0
compcolor=""

for i in range(n):
  currentcolaor=s[i]
  if currentcolaor ==compcolor :
      min+=1
  else:
      compcolor=currentcolaor
print mini


n , k = map(int,input().split())

l = list(map(int,input().split()))

t = []

for i in range(n):
    t.append([l[i],i])

l = t[:]

while len(l)>1:

    t = []

    for i in range(n):
        if l[i][0]>k:
            t.append([l[i][0]-k,l[i][-1])

    l = t[:]

print(l[0][-1]+1)


s=input().strip()

con1, con2 = 'http://', 'ftp://'

if s[0]=='h':
	start= 4
	end = 4
	for i in range(4,len(s)-1):
		if s[i]+s[i+1] == 'ru' && start !=end:
			end = i
			break
	ans = s[start:end]

	ans = con1+ans+'.ru/'+s[end+2:]
	print(ans)

elif s[0]=='f':
	start= 3
	end = 3
	for i in range(3,len(s)-1):
		if s[i]+s[i+1] == 'ru' && start !=end:
			end = i
			break
	ans = s[start:end]

	ans = con2+ans+'.ru/'+s[end+2:]
	print(ans)


w = input()
ind = True
alf = ["a", "e", "i", "o", "u", "y"]
while (ind):
    for i in range(len(w)):
        if i >= len(w):
            break
        if w[i] in alf:
            if w[i + 1] in alf:
                w = w.replace(w[i + 1], "");
                ind = False
print(w)


A=list(map(int,input().split()))
maxi=0
for i in range(0,14):
    B=[]
    B=A.copy()
    summ=0
    if(B[i]>0):
        if((13-i)>=B[i]):
            for j in range(i+1,i+1+B[i]):
                B[j]+=1
        else:
            for j in range(i+1,14):
                B[j]+=1
            for j in range(0,B[i]-(13-i)):
                B[j]+=1
        B[i]=0
        for j in range(0,14):
            if(B[j]%2==0):
                summ+=B[j]
        if(summ>maxi):
            maxi=summ
print(maxi)


# swapcase()convert the lower into upper and upper into lower
# like geeksFORgeeks =>> GEEKSforGEEKS

n=input()
b=a[1:]
print([n,n.swapcase()][b.upper()==b])


import math
onsegment = lambda x, y, z: min(y,z) <= x <= max(y,z)
oninterval = lambda x, y, z: min(y,z) < x < max(y,z)
def inrectangle(p0, p1, p2):
    return oninterval(p0[0], p1[0], p2[0]) and oninterval(p0[1], p1[1], p2[1])
def onborder(p0, p1, p2):
    return onsegment(p0[0], p1[0], p2[0]) and onsegment(p0[1], p1[1], p2[1]) and not inrectangle(p0, p1, p2)
points = []
for i in range(3):
    points.append(tuple(int(x) for x in input().split()))
points.sort()
if (all((point[0] == points[0][0] for point in points)) or
    all((point[1] == points[0][1] for point in points))):
    print(1)
elif points[0][1] == points[2][1]:
    print(3 if points[0][0] < points[1][0] < points[2][0] else 2)
elif onborder(points[1], points[0], points[2]) or onborder((points[2], points[0], points[1]) or (points[0], points[1], points[2]:
    print(2)
else:
    print(3)


n=int(raw_input())
i=1%n
k=2%n
v=[-1]*n
v[0]=1
while not (k==v[i]):
	v[i]=k
	i=(i+k)%n
	k=(k+1)%n
if v.count(-1)!=0:
	print 'NO'
else:
	print 'YES'


#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__

def memoize(f):
    """ Memoization decorator for a function taking one or more arguments. """

    class memodict(dict):
        def __getitem__(self, *key):
            return dict.__getitem__(self, key)

        def __missing__(self, key):
            ret = self[key] = f(*key)
            return ret

    return memodict().__getitem__

def main():
    n, T = map(int, input().split())
    t, g = [0] * n, [0] * n
    for i in range(n):
        t[i], g[i] = map(int, input().split())

    def solve(T, p, mask):
        if T < 0:
            return 0
        if T == 0:
            return 1

        res = 0
        for i in range(n):
            if mask[i] == 0 and p != g[i]:
                new_mask = mask[:]
                new_mask[i] = 1
                res += solve(T - t[i], g[i], new_mask)

        return res

    print(solve(T, -1, [0] * n))

# region fastio

BUFSIZE = 8192

class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()

class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()

def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


P = 10**9+7
N, T = map(int, input().split())
A = [[], [], []]
for _ in range(N):
    t, g = map(int, input().split())
    A[g-1].append(t)

def calc(X, pr, t):
    if t < 0:
        return 0
    if t == 0:
        return 1
    if len(X[0])+len(X[1])+len(X[2]) == 0:
        return 0

    ans = 0
    for k in range(3):
        if pr != k:
            for i in range(len(X[k])):
                Y = [[X[k][j] for j in range(len(X[k])) if j != i] if _ == k else [a for a in X[_]] for _ in range(3)]
                ans = (ans + calc(Y, k, t-X[k][i])) % P
    return ans

print(calc(A, -1, T))


from collections import*
n,m=map(int,input().split())
c=Counter(i*i%m for i in range(1,n+1))
print(sum(c[k]*c[(m-k)%m]for k in c))


b=int(input())
a=[]
for i in range(b):
    a.append(int(input()))
c=a.index(1)
d=a.index(b)
e=0
if(c<d):
    if(abs(b-d)>abs(d-c)):
        print(abs(b-d))
    else:
        print(abs(d-c))
else:
    if(abs(b-c)>abs(c-d)):
       print(abs(b-c))
    else:
        print(abs(d-c))


n = int(input())
a = list(map(int,input().split()))
b = list(map(int,intput().split())
if sum(a) >= sum(b):
    print("Yes")
else:
    print("No")


x=input()
l=0
for n in range(int(x)+1):
	if n%4==0:
		if str(n) in x:
			l+=1
		for k in range(1,len(x)-len(str(n))+1):
		  z='0'*k+str(n)
		  if z in x:
		    l+=1
print(l)


import math
def ar():
    return map(int,raw_input().split())
c,d=ar()
n,m=ar()
k=ar()[0]
req=(n*m)-k
mi=100000000
for i in range(req+1):
    for j in range(req+3):
        if n*i+j >=req:
            if c*i+j*d<mi:
                mi=i*c+j*d
print mi


import sys, re

f = sys.stdin

c, d = map(int, f.readline().strip().split())
n, m = map(int, f.readline().strip().split())
k = int(f.readline().strip().split()[0])

need = n * m - k

if need <= 0:
    print 0
    exit(0)

result = sys.maxint
for x in xrange(need + 1):
    for y in xrange(need + 1):
        if x * n + y >= need:
            result = min(x * c + y * d, result)

print result


import sys
sys.stdin=open("input.in",'r')
sys.stdout=open("out1.out",'w')
n=int(input())
print((n-1)//2)


h, m, s, t1, t2 = list(map(int, input().split()))

h = h * 3600

if s >= 5:
    s = round(s / 5 * 3600)

else:
    s = s * 3600

if m >= 5:
    m = round(m / 5 * 3600)

else:
    m = m * 3600

t1 = t1 * 3600
t2 = t2 * 3600

if (t2 > h and t1 < h) or (t2 > m and t1 < m) or (t2 > s and t1 < s)
    print("NO")

else:
    print("YES")


from itertools import *
import sys
from array import *

l = [
[1,2,3],
[4,5,6,7],
[8,9,10,11,12],
[13,14,15,16],
[17,18,19],

[1,4,8],
[2,5,9,13],
[3,6,10,14,17],
[7,11,15,18],
[12,16,19],

[3,7,12],
[2,6,11,16],
[1,5,10,15,19],
[4,9,14,18],
[8,13,17]
]

mask = []
for k in range(0,len(l)):
	for i in range(0,len(l[k])):
		for j in range(i,len(l[k])):
			val = 0
			for p in range(i,j+1):
				val |= (1 << (l[k][p]-1))
			mask.append(val)
mask = array('l', sorted(list(set(mask))))

lst = []
for i in range(0,5):
	lst += map(lambda x: 1 if x=="O" else 0, raw_input().split())
num = 0
for i in range(0,len(lst)):
	if lst[i]==1:
		num |= (1 << i)

up = (1<<19)
ans = array('l',[0]*up)

for i in count(1):
	if i==up:
		break

	good = False
	for m in mask:
		if (i | m) == i:
			if ans[i ^ m] == 0:
				good = True
				break

	ans[i] = ( 1 if good else 0 )

print "Karlsson" if ans[num]==1 else "Lillebror"


n,m=map(int,input().split())
a=2*n
b=3*m
i=6
while i<=min(a,b):
  if b<a: b+=3
  else: a+=2
print(max(a,b))


l=''.join(map(str,list(i for i in range(1,10000001))))
x=int(input())
print(l[x-1])


n, S = map(int, input().split())

numbers = [0] + S * [float('inf')]
for total in range(1, S + 1):
    for value in range(1, n + 1):
        if total - value < 0:
            break
        numbers[total] = min(numbers[total], numbers[total - value] + 1)

print(numbers[-1])


#!/usr/bin/python

import sys

def Ni(): return tuple(map(int, sys.stdin.readline().split()))

n = Ni()[0]
c = Ni()
c = sorted(c)

F = [0] * (n+1)
for _c in c:
    F[_c] += 1

#print n, c, F
answer = "NO"

def backtrack(stack, avail, sumleft):
    #print stack, avail, sumleft
    if len(stack) == 1 and sumleft == 0:
        print "YES"
        sys.exit(0)

    # shift
    for i, a in enumerate(avail):
        if a > 0:
            avail[i] -= 1
            #print "shift", i
            backtrack(stack + [i], avail, sumleft - i)
            avail[i] += 1

    # reduce
    if len(stack) < 2:
        return

    s = 1 + stack[-1]
    for i in range(2, len(stack) + 1):
        s += stack[-i]
        if s >= n + 1:
            break

        if avail[s] > 0:
            avail[s] -= 1
            #print "reduce", s
            backtrack(stack[:-i] + [s], avail, sumleft - s)
            avail[s] += 1

backtrack([], F, sum(c))
print "NO"


def solve():
	n1= raw_input()
	n2= raw_input()
	n3= raw_input()
	n4= raw_input()

	if n1 > n2: print "First"
	else: print "Second"

solve()


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;

int main()
{
    int n1,n2,k1,k2;
    while(scanf("%d%d%d%d",&n1,&n2,&k1,&k2)!=EOF)
    {
            if(n1>n2)
                printf("First\n");
            else printf("Second\n");
    }
    return 0;
}


h, m = map(int, raw_input().split(":"))
rh = int(str(h)[::-1])
if rh < 60 and m < rh:
    print "%02d:%02d" % (rh, m)
else:
    while 1:
        nm = int(str((h+1)%24)[::-1])
        if nm < 60:
            break
    print "%02d:%02d" % (int(str(nm)[::-1]), nm)


n=input()
k=n.index(' ')
a=int(n[:k])
b=int(n[k+1:])
d=input()
k1=n.index(' ')
a1=int(d[:k1])
b1=int(d[k1+1])
c1=int(d[k1+3])
for i in range(a1):
    a-=2
for i in range(b1):
    a-=1
    b-=1
for i in range(c1):
    b-=3
c=(a+b)*(-1)
print(c)


s = input()
c = s.count("VK")
if s.count("VV") or s.count("KK"):
    c+=1
print c


def build_fac():
   global mod
   fac = [1] * int(2e5 + 1)
   for i in range(1, int(2e5)):
      fac[i] = i*fac[i-1] % mod
   return fac

def inv(x):
   global mod
   return pow(x, mod-2, mod)

def ncr(n, r):
   global fac
   if n < 0 or n < r: return 0
   return fac[n]*inv(fac[r])*inv(fac[n-r]) % mod

def cf(f, w, h):
   global mod
   if w == 0: return 1
   rs = 0
   for k in range(1, min(w//(h+1),f+1)+1):
      rs += ncr(f+1, k) * ncr(w-k*h-1, k-1) % mod
      rs %= mod
   return rs

f, w, h = map(int,input().split(' '))
mod = int(1e9 + 7)

fac = build_fac()
cnt = cf(f, w, h)
rs = cnt*inv(ncr(f+w, w)) % mod

print(rs)


import math
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int,input().split()))

n = int(input())

h = n//2
left = 1
right = n

def eat(k,n):
	a = 0
	while n > 0:
		#print(a,n,k)
		a += min(k,n)
		n -=  min(k,n)
		n -=  (n*10)//100
	return a

ans = eat(39259424579862572,n)
if n != 1:
	while left <= right:
		m = (left + right)//2
		eat1 = eat(m,n)
		eat2 = 0
		if m-1 > 0:
			eat2 = eat(m-1,n)

		if eat1 >= h and eat2 < h:s
			print(m)
			break
		if eat1 < h:
			left = m
		else:
			right = m

else:
	print(1)


[n] = raw_input().split()
n = int (n)
v = []
for i in range (n) :
  v.append(0)
v = raw_input().split()
mx = int (-1)
votes = int (0)
for x in v :
  x = int (x)
  mx = max (mx, x)
  votes += x
votes = n * mx - votes
while (votes < n * mx - votes) :
  mx = mx + 1
print mx


#include <iostream>

using namespace std;

int main()
{
    int k,n;
    int t=0,a[n];
    cin >> n >> k;
    int b[n],r=0,c[n];

    for (int i=0;i<n;i++){
        cin >> a[i];
        for (int j=0;j<t;j++){
            if (a[i]==b[j]){
                r=1;
                break;
            }
        }
        if (r==0){
            b[t]=a[i];
            c[t]=i;
            t++;
        }
        r=0;
        if (t==k){
            cout << "YES" << endl;
            for (int j=0;j<t;j++){
                cout << c[j]+1<<" ";
            }
            return 0;
            break;

        }
    }
    cout << "NO";
    return 0;
}


n = input()

a = [chr(i) for i in range(ord('a'),ord('z')+1)]
num = range(1, 27)

dict_all = dict(zip(a, num))

stat = 'a'
res = 0
for i in n:
    end = i
    res = res + min(abs(dict_all[stat] - dict_all[end]), 26 - abs(dict_all[stat] - dict_all[end]))
    stat = end

print res


#-*- coding: utf-8 -*-

import sys
import re

write = sys.stdout.write

nab = sys.stdin.readline()
nab = nab.replace('\n','').split(" ")
n,a,b = int(nab[0]), int(nab[1]), int(nab[2])

n = n/2

if a!=n and a!=n+1:
    write("YES")
elif n==1:
    write("NO")
elif b>1 and b<2*n and 2*m>=6:
    write("YES")
else:
    write("NO")


n, bx = int(raw_input()), int(raw_input())

X = 0
for inx in xrange(n):
	X += bx ** (n - inx - 1)

m, by = int(raw_input()), int(raw_input())

Y = 0
for inx in xrange(n):
	Y += by ** (m - inx - 1)

if X < Y:
	print '<'
if X > Y:
	print '>'
if X == Y:
	print '='


import sys

while True:
    a, b, r = [ int(i) for i in sys.stdin.readline().split() ]
    if a < r * 2 or b < r * 2:
        print 'Second'
    else:
        print 'First'


t = int(input())
for _ in range(t):
    n, m = [int(x) for x in input().split()]
    a = list()
    b = list()
    for _ in range(m)
        x, y = [int(x) for x in input().split()]
        a.append(x)
        b.append(y)


n=eval(input())
a=eval(input())
b=eval(input())
c=eval(input())
x = 0
if ( b - c < a ):
    x = (n - c)//(b - c)
    n -= x*(b - c)
l += n//a
print(l)


n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
library = []
money = 0
for i in range(len(a)):
    if a[i] not in library:
        money += 1
        if len(library) < k:
            library.append(a[i])
        else:
            curmin = n
            curindex = 0
            for j in range(len(library)):
                if a[i+1::].count(library[j]) < curmin:
                    curmin = a[i+1::].count(library[j])
                    curindex = j
            library[curindex] = i
print(money)


p=int(input())
if x == 2:
    print(1)
ans=0
for x in range(1,p):
    m=x%p
    if m==1:
        if x==2:
            q=True
        else:
            q=False
    else:
        q=False
        for i in range(2,p):
            m=(m*x)%p
            if m==1:
                if i==p-1:
                    q=True
                break
    ans+=q
print(ans)


"""Basic number theory functions.
   Functions implemented are:
        gcd(a,b) - Compute the greatest common divisor of a and b.
                xgcd(a,b) - Find [g,x,y] such that g=gcd(a,b) and g = ax + by.
                powmod(b,e,n) - Compute b^e mod n efficiently.
                invmod(b,n) - Compute 1/b mod n.
                isprime(n) - Test whether n is prime using a variety of pseudoprime tests.
                isprimeF(n,b) - Test whether n is prime or a Fermat pseudoprime to base b.
                isprimeE(n,b) - Test whether n is prime or an Euler pseudoprime to base b.
                eulerphi(n) - Compute Euler's Phi function of n - the number of integers strictly less than n which are coprime to n.
                carmichaellambda(n) - Computer Carmichael's Lambda function of n - the smallest exponent e such that b**e = 1 for all b coprime to n.
                factor(n) - Find a factor of n using a variety of methods.
                factors(n) - Return a sorted list of the prime factors of n.
                factorPR(n) - Find a factor of n using the Pollard Rho method
                isprimitive(g,n) - Test whether g is primitive - generates the group of units mod n.
                sqrtmod(a,n) - Compute sqrt(a) mod n using various algorithms.
                TSRsqrtmod(a,grpord,n) - Compute sqrt(a) mod n using Tonelli-Shanks-RESSOL algorithm.
   A list of the functions implemented in numbthy is printed by the command info()."""

Version = 'NUMBTHY.PY, version 0.6, 24 Nov, 2012, by Robert Campbell, <campbell@math.umbc.edu>'

import math  # Use sqrt, floor

def gcd(a,b):
        """gcd(a,b) returns the greatest common divisor of the integers a and b."""
        if a == 0:
                return abs(b)
        return abs(gcd(b % a, a))

def powmod(b,e,n):
        """powmod(b,e,n) computes the eth power of b mod n.
        (Actually, this is not needed, as pow(b,e,n) does the same thing for positive integers.
        This will be useful in future for non-integers or inverses.  Currently assumes e>0.)"""
        accum = 1; i = 0; bpow2 = b
        while ((e>>i)>0):
                if((e>>i) & 1):
                        accum = (accum*bpow2) % n
                bpow2 = (bpow2*bpow2) % n
                i+=1
        return accum

def xgcd(a,b):
        """xgcd(a,b) returns a list of form [g,x,y], where g is gcd(a,b) and
        x,y satisfy the equation g = ax + by."""
        a1=1; b1=0; a2=0; b2=1; aneg=1; bneg=1
        if(a < 0):
                a = -a; aneg=-1
        if(b < 0):
                b = -b; bneg=-1
        while (1):
                quot = -(a // b)
                a = a % b
                a1 = a1 + quot*a2; b1 = b1 + quot*b2
                if(a == 0):
                        return [b, a2*aneg, b2*bneg]
                quot = -(b // a)
                b = b % a;
                a2 = a2 + quot*a1; b2 = b2 + quot*b1
                if(b == 0):
                        return [a, a1*aneg, b1*bneg]

def isprime(n):
        """isprime(n) - Test whether n is prime using a variety of pseudoprime tests."""
        if (n in [2,3,5,7,11,13,17,19,23,29]): return True
        return isprimeE(n,2) and isprimeE(n,3) and isprimeE(n,5)

def isprimeF(n,b):
        """isprimeF(n) - Test whether n is prime or a Fermat pseudoprime to base b."""
        return (pow(b,n-1,n) == 1)

def isprimeE(n,b):
        """isprimeE(n) - Test whether n is prime or an Euler pseudoprime to base b."""
        if (not isprimeF(n,b)): return False
        r = n-1
        while (r % 2 == 0): r //= 2
        c = pow(b,r,n)
        if (c == 1): return True
        while (1):
                if (c == 1): return False
                if (c == n-1): return True
                c = pow(c,2,n)

def factor(n):
        """factor(n) - Find a prime factor of n using a variety of methods."""
        if (isprime(n)): return n
        for fact in [2,3,5,7,11,13,17,19,23,29]:
                if n%fact == 0: return fact
        return factorPR(n)  # Needs work - no guarantee that a prime factor will be returned

def factors(n):
        """factors(n) - Return a sorted list of the prime factors of n."""
        if (isprime(n)):
                return [n]
        fact = factor(n)
        if (fact == 1): return "Unable to factor "+str(n)
        facts = factors(n/fact) + factors(fact)
        facts.sort()
        return facts

def factorPR(n):
        """factorPR(n) - Find a factor of n using the Pollard Rho method.
        Note: This method will occasionally fail."""
        for slow in [2,3,4,6]:
                numsteps=2*math.floor(math.sqrt(math.sqrt(n))); fast=slow; i=1
                while i<numsteps:
                        slow = (slow*slow + 1) % n
                        i = i + 1
                        fast = (fast*fast + 1) % n
                        fast = (fast*fast + 1) % n
                        g = gcd(fast-slow,n)
                        if (g != 1):
                                if (g == n):
                                        break
                                else:
                                        return g
        return 1

def eulerphi(n):
        """eulerphi(n) - Computer Euler's Phi function of n - the number of integers
        strictly less than n which are coprime to n.  Otherwise defined as the order
        of the group of integers mod n."""
        thefactors = factors(n)
        thefactors.sort()
        phi = 1
        oldfact = 1
        for fact in thefactors:
                if fact==oldfact:
                        phi = phi*fact
                else:
                        phi = phi*(fact-1)
                        oldfact = fact
        return phi

n = int(raw_input())
print eulerphi(n-1)


from itertools import permutations as p
r=map(int,raw_input().split())
P=list(p(r[:4]))
print len([ x for x in range(r[4],r[5]+1) if sum([ x == eval('%'.join(map(str, [x]+list(e)))) for e in P])>6])


import sys

p = sys.stdin.readline().strip().split()
p = [int(xy) for xy in p]
p = [(p[0],p[1]), (p[2],p[3]), (p[4],p[5])]

def solve():
	def right(a, b, c):
		return (b[1] - a[1]) * (c[1] - a[1]) == -(c[0] - a[0]) / (b[0] - a[0])

	def almost_right(a, b, c):
		dx = [1,-1,0,0]
		dy = [0,0,1,-1]
		for i in range(4):
			a_ = (a[0]+dx[i], a[1]+dy[i])
			if right(a_, b, c):
				return True
		return False

	for i in range(3):
		if right(p[i], p[(i + 1) % 3], p[(i + 2) % 3]):
			print "RIGHT"
			return

	for i in range(3):
		if almost_right(p[i], p[(i + 1) % 3], p[(i + 2) % 3]):
			print "ALMOST"
			return

	print "NEITHER"
	return

solve()


from math import factorial as fact
n = input ()
C = lambda n, k: fact (n) / (fact (n - k) * fact (k))
print (2 * C (n * 2 - 1, n - 1) - n) % 1000000007