peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
S = input()
T = input()

ans = 2 * N
for i in range(1, N + 1):
    if S[-i:] == T[:i]:
        ans = 2 * N - i
print(ans)
# Judge status: Accepted
n, x = map(int, input().split())
l = list(map(int, input().split()))

d = [0] * (n+1)
ans = 1
for i in range(1, n+1):
    d[i] = d[i-1] + l[i-1]
    if d[i] <= x:
        ans += 1

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
#SA = sorted(A)

D = []
for _ in range(M):
  B, C = map(int, input().split())
  D.append([B, C])

SD = sorted(D, key=lambda x:x[1], reverse=True)

for b, c in SD:
  A += b * [c]
  if len(A) > N*2:
    break

SA = sorted(A, reverse=True)
#X = min(N, len(SD))
#SD = SD[:X]

print(sum(SA[:N]))
# Judge status: Accepted
a, v = (int(i) for i in input().split(' '))
b, w = (int(i) for i in input().split(' '))
t = int(input())

flag = False
if a < b:
    l1 = a + v * t
    l2 = b + w * t
    if l1 >= l2:
        flag = True
else:
    l1 = a + (v * -1) * t
    l2 = b + (w * -1) * t
    if l1 <= l2:
        flag = True
print("YES" if flag else "NO")
# Judge status: Accepted
import math
n,x,t=map(int, input().split(" "))
print(math.ceil(n / x) * t)
# Judge status: Wrong Answer
S = input()
j = "keyence"
now = 0
out = 0
for i in range(len(S)):
  if S[i] == j[now]:
    now += 1
    if now == 7:
      break
  else:
    out += 1
    if out == 2:
      break
if now == 7:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

res = []
for i in range(k, n):
    res.append(a[i-k] < a[i])

#print(res)
for b in res:
    if(b): print("Yes")
    else: print("No")
# Judge status: Accepted
# ABC 147: A – Blackjack
total = sum(map(int, input().split()))
print('win' if total <= 21 else 'bust')
# Judge status: Accepted
N,M=map(int,input().split(' '))
if N==1 and  M==1:
    print(1)
elif N==1 or M==1:
    print(max(N,M)-2)
else:
    print(N*M-2*(N+M-2))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
Alice = 0
A.sort()
for i in range(1,N,2):
  Alice += A[i]
print(2*Alice - sum(A))
# Judge status: Accepted
print('Yes') if len(set([int(i) for i in input().split()])) == 2 else print('No')
# Judge status: Accepted
N = int(input())
a_lst = [int(x) for x in input().split()]

a_lst.sort(reverse=True)

sum = 0
for i in range(1, 2*N, 2):
    sum += a_lst[i]
print(sum)
# Judge status: Wrong Answer
q,h,s,d=map(int,input().split())
n=int(input())
l=min(q*n*4,h*n*2,s*n,d*n/2)
if l != d*n/2:
    print(l)
else:
    m=min(q*4,h*2,s)
    print(int((d*(n-1)/2)+m) if n%2==1 else int(l))
# Judge status: Accepted
a, b, k = map(int, input().split())
li = []

for i in range(1, 101):
    if a%i == 0 and b%i == 0:
        li.append(i)

print(li[-k])
# Judge status: Wrong Answer
x,y=map(int,input().split())
lol=[1]
a=0
k=pow(y,0.5)
for i in range(2,int(k)+1):
    if y%i==0:
        if i*x<=y:
            a=max(a,i)
        if (y//i)*x<=y:
            a=max(a,i)
print(a)
# Judge status: Accepted
N = int(input())

t=x=y=0

for _ in range(N):
    ti,xi,yi = map(int,input().split())
    T = ti-t
    X = xi-x
    Y = yi-y
    if ((T%2==0 and (X+Y)%2==0) or (T%2==1 and (X+Y)%2==1)) and T >= abs(X+Y):
        t=ti
        x=xi
        y=yi
    else:
        print('No')
        break
else:print('Yes')
# Judge status: Wrong Answer
x,y=map(int,input().split())
if 2*x<=y and y<=4*x and y&2==0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
x = int(input())
print(10 - x//200)
# Judge status: Accepted
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
for j in range(min(k, 42)):
    bit = [0 for _ in range(n)]
    for i in range(n):
        bit[max(i - a[i], 0)] += 1
        if i + a[i] + 1 < n:
            bit[i + a[i] + 1] -= 1
    result = [bit[0]]
    for i in range(n - 1):
        result.append(bit[i + 1] + result[-1])
    a = result
print(' '.join(list(map(str, a))))
# Judge status: Accepted
r, g, b = map(int, input().split())

ans = r * 100 + g * 10 + b
if ans % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
icase=0
if icase==0:
    n=int(input())
    if n%2==0:
        print(0.5)
    else:
        print(1.0-(n//2)/n)
# Judge status: Wrong Answer
(n,an,bn) = list(map(int,input().split()))
s = list(input())
count = 1
foreign = 1
for i in s:
  if i=='a' and an+bn >= count:
    print('Yes')
    count += 1
  elif i=='b' and an+bn > count and bn >= foreign:
    print('Yes')
    count += 1
    foreign += 1
  else:
    print('No')
# Judge status: Accepted
c = [list(map(int, input().split())) for i in range(3)]
r1 = sum(c[0][j] for j in range(3))
r2 = sum(c[1][j] for j in range(3))
r3 = sum(c[2][j] for j in range(3))
c1 = sum(c[i][0] for i in range(3))
c2 = sum(c[i][1] for i in range(3))
c3 = sum(c[i][2] for i in range(3))
if r1 % 3 == r2 % 3 == r3 % 3 and c1 % 3 == c2 % 3 == c3 % 3:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
no = int(input())
c = 0
while no > 0:
  if no%10 == 7:
    c = 1
  no = no/10
if c == 1:
  print("Yes")
else :
  print("No")
# Judge status: Accepted
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))

    c0 = 0
    c4 = 0

    for ai in a:
        if ai % 2 != 0:
            c0 += 1
        if ai % 4 == 0:
            c4 += 1
    if c0 + c4 == n and c0 == c4 + 1:
        print('Yes')
    elif c0 > c4:
        print('No')
    else:
        print('Yes')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Judge status: Wrong Answer
n = int(input())
q = [int(input())  for i in range(n)]
cnt = 0
ind = 0
for i in range(n):
  m = q[ind]-1
  if ind+1 == q[m]:
    if ind+1 == 2 or q[m]==2:
        print(cnt)
        break
    print(-1)
    exit()
  ind = q[ind]-1
  cnt += 1
  if ind == 1:
    print(cnt)
    break
# Judge status: Wrong Answer
n = int(input())
b = list(map(int,input().split()))

ans = b[0]

for i in range(n-2):
  ans = ans + min(b[i],b[i+1])
  
ans = ans + max(b[n-2],b[n-3])
  
print(ans)
# Judge status: Accepted
s = input()
print('No' if s in ['AAA', 'BBB'] else 'Yes')
# Judge status: Accepted
a, b, c = map(int, input().split())
d = a-b
e = c-d
if e > 0:
    print(int(e))
else:
    print(0)
# Judge status: Accepted
n,m = map(int,input().split())
input_lines = [[int(j)-1 for j in input().split()]for i in range(m)]

map_list = [[0 for i in range(n)] for i in range(n)]

for line in input_lines:
    map_list[line[0]][line[1]]+=1
    map_list[line[1]][line[0]]+=1

for li in map_list:
    print(sum(li))
# Judge status: Wrong Answer
s,c = map(int,input().split())
res = 0

if s*2 <= c:
    res += s
    c -= s*2
    s = 0
else:
    res += c//2
    c //= 2

#print(res,s,c)

if c:
    res += c//4
print(res)
# Judge status: Accepted
import math
from functools import reduce

def lcm_base(x, y):
	return (x * y) // math.gcd(x, y)

def lcm(*numbers):
	return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)

n = int(input())
t = [0]*n
for i in range(n):
	t[i] = int(input())
print(lcm_list(t))
# Judge status: Wrong Answer
n = int(input())

ans = ""

while n != 0:
    if n % 2 == 1:
        ans += "1"
        n = n - 1
        n //= -2
    else:
        ans += "0"
        n //= -2

print(ans[::-1] if n != 0 else 0)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
p = list(map(int, readline().split()))

ans = 0
ok = True
for i in range(n):
    if p[i] == i+1 and ok:
        ans += 1
        ok = False
    else:
        ok = True
print(ans)
# Judge status: Wrong Answer
def main():
    n = int(input())
    cnt = 0
    for i in range(n):
        a,b = map(int,input().split())
        if cnt == 3:
            print('Yes')
            return
        if a == b:
            cnt += 1
        else:
            cnt = 0
    print('No')

main()
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[11]:


W,H,N = map(int, input().split())
l,r,u,d = 0,W,H,0
for _ in range(N):
    x,y,a = list(map(int, input().split()))
    if a == 1:
        l = max(l,x)
    elif a == 2:
        r = min(r,x)
    elif a == 3:
        d = max(d,y)
    else:
        u = min(u,y)
print(max(0,(r-l))*max(0,(u-d)))


# In[ ]:
# Judge status: Accepted
n, s = int(input()), input()

ans, lb, rw = s.count('.'), 0, s.count('.')
for i in s:
    if i == '#':
        lb += 1
    elif i == '.':
        rw -= 1
    ans = min(ans, lb + rw)
print(ans)
# Judge status: Accepted
n = int(input())
existing_list = list(map(int,input().split()))

counts = 0 
while all(num%2 ==0 for num in existing_list):
    length = 0
    for a in existing_list:
        division = a/2
        existing_list[length]=division
        length +=1
    counts +=1

print(counts)
# Judge status: Accepted
N = int(input())
As = list(map(int, input().split()))

from collections import Counter
c = Counter(As)
ans = []
for a, c in c.most_common():
    if c<2:
        break
    ans.append(a)
    if c>=4:
        ans.append(a)

if len(ans)<2:
    print(0)
else:
    ans.sort()
    print(ans[-1]*ans[-2])
# Judge status: Wrong Answer
n,k = list(map(int,input().split()))

if n < k:
    print(min(n,k - n))
else:
    if n % k == 0:
        print(0)
    else:
        print(min(abs(n - k * int(n / k)),abs(abs(n - k * int(n / k))-k)))
# Judge status: Accepted
x = int(input())
if x % 11 == 0:
    print((x//11)*2)
elif x % 11 <= 6:
    print((x//11)*2+1)
else:
    print((x//11)*2+2)
# Judge status: Accepted
import math
import collections
import fractions
import itertools
import functools
import  operator

def solve():
    n = int(input())
    s = input()
    l, r = 0, 0
    for i in s:
        if i == "(":
            r += 1
        else:
            if r != 0:
                r -= 1
            else:
                l += 1
    ans = "("*l + s + ")"*r
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

da = 0
db = 0
for i in range(n):
    if a[i] <= b[i]:
        da += (b[i] - a[i]) // 2
    else:
        db += a[i] - b[i]
        
if da >= db:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>k:
    print(k*x+(n-k)*y)
else:
    print(n*x)
# Judge status: Wrong Answer
A,B,K = map(int,input().split())
ans_list=[0]
for i in range(1,A*B+1):
    if A%i+B%i==0:
        ans_list.append(i)
print(ans_list[K])
# Judge status: Wrong Answer
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    mul4 = len([a for a in A if a % 4 == 0])
    mul2 = len([a for a in A if a % 4 != 0 and a % 2 == 0])
    less = N - 3*mul4
    if less <= 0:
        print("Yes")
    elif less == 1 and 2 <= mul2:
        print("Yes")
    elif 2 <= less <= mul2:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
x = int(input())

if x % 11 == 0:
    print((x//11)*2)
elif x % 11 > 6:
    print((x//11)*2 + 2)
else:
    print((x//11)*2 + 1)
# Judge status: Accepted
n,m = map(int,input().split())
res = [0]*m
for i in range(n):
    a = list(map(int,input().split()))
    for k in a[1:]:
        res[k-1] += 1
a = list(filter(lambda x:x==n,res))
print(len(a))
# Judge status: Accepted
a, b, x = map(int, input().split())
import math

S = a*b
s = x/a
if s == S:
  print(0)

elif s >= S/2:
  em_s = S-s
  tan = (a**2)/(2*em_s)
  ans = math.degrees(math.atan(tan))
  print(90-ans)

else:
  tan = (2*s)/(b**2)
  ans = math.degrees(math.atan(tan))
  print(90-ans)
# Judge status: Accepted
n = int(input())
z = (-(-n//111))*111
print(z)
# Judge status: Accepted
N = int(input())
B = list(map(int, input().split()))
sum=B[0]
for i in range(1,N):
    if i<N-1 and B[i]<=B[i-1]:
        sum=sum+B[i]
    elif i<N-1 and B[i-1]<=B[i]:
        sum=sum+B[i-1]
    else:
        sum=sum+B[N-2]
print(sum)
# Judge status: Accepted
n = int(input())
c = []
s = []
f = []
for i in range(n - 1):
  ci, si, fi = map(int, input().split())
  c.append(ci)
  s.append(si)
  f.append(fi)
for i in range(n):
  t = 0
  for j in range(i, n - 1):
    t = max(t, s[j])
    t = (t + f[j] - 1) // f[j] * f[j] + c[j]
  print(t)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
l =[]
for i in a:
    l.append(i//400)
x = set()
y = 0
for i in l:
    if i<= 7:
        x.add(i)
    else:
        y +=1
x = len(x)
if x:
    mi =x
else:
    mi =1
ma = x+y
print('{} {}'.format(mi, ma))
# Judge status: Accepted
n,m=map(int,input().split())
a=[[int(i) for i in input().split()] for i in range(m)]
b=sorted(a)
id={}
t=1
for ind,i in enumerate(b):
    if ind!=0 and b[ind][0]!=b[ind-1][0]:
        t=1
    x=str(i[0]).zfill(6)
    y=str(t).zfill(6)
    t=int(t)
    t+=1
    idd=x+y
    id[str(i[0])+str(i[1])]=idd
for i in a:
    ii=str(i[0])+str(i[1])
    print(id[ii])
# Judge status: Accepted
x, y = map(int, input().split())

if abs(x) < abs(y):
    ans = abs(y)-abs(x)
    if x < 0:
        ans += 1
    if y < 0:
        ans += 1
    print(ans)
else:
    ans = abs(x)-abs(y)
    if 0 < x:
        ans += 1
    if 0 < y:
        ans += 1
    print(ans)
# Judge status: Accepted
N = int(input())
A = [[] for _ in range(N)]
for i in range(N):
  x, l = map(int, input().split())
  A[i] = [x + l, x - l]
A.sort()
for i in range(N):
  A[i][0], A[i][1] = A[i][1], A[i][0]
M = A[0][1]
cnt = 1
for i in range(1, N):
  if M <= A[i][0]:
    cnt += 1
    M = A[i][1]
print(cnt)
# Judge status: Accepted
n, k = map(int, input().split())
a = [0] + [int(i) for i in input().split(" ")]
b = [0,1] + [0]*(n-1)
c = [1]
nex = 1
for i in range(1,n+1):
    nex = a[nex]
    if b[nex] == 1:
        whe = c.index(nex)
        lo = len(c)-whe
        break
    b[nex] = 1
    c.append(nex)
if whe+1 >= k:
    print(c[k])
else:
    k_ = k - whe
    print(c[whe:][k_%lo])
# Judge status: Accepted
def resolve():
    x = int(input())
    ans = 0
    dist = 0
    for i in range(1, x+1):
        dist += i
        ans += 1
        if dist >= x:
            break
    print(ans)

if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
# 数値の取得
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

# 宿泊費の計算後結果を出力
account = (K * X) + ((N - K) * Y) 
print(account)
# Judge status: Accepted
n,a,b = map(int,input().split())
s = input()
y = 0
bn = 1
for i in range(n):
  if s[i] == "a" and y < a + b:
    print("Yes")
    y += 1
  elif s[i] == "b" and y < a + b and bn <= b:
    print("Yes")
    y += 1
    bn += 1
  else:
    print("No")
# Judge status: Wrong Answer
s = input()
n = len(s)
acgt = ["A", "C", "G", "T"]
ans = 0
cnt = 0
for i in range(n):
    if s[i] in acgt:
        cnt += 1
        #print(ans, cnt, i)
    else:
        ans = max(ans, cnt)
        #print(ans, cnt, i)
        cnt = 0
print(ans)
# Judge status: Accepted
s=str(input())
if s=='RRR':
    print(3)
if s=='RRS':
    print(2)
if s=='RSR':
    print(1)
if s=='SRR':
    print(2)
if s=='RSS':
    print(1)
if s=='SRS':
    print(1)
if s=='SSR':
    print(1)
if s=='SSS':
    print(0)
# Judge status: Accepted
N=int(input())
S=input()
a=[]
total=0
for i in range(len(S)):
    if S[i]=="I":
        total+=1
        a.append(total)
    else:
        total-=1
        a.append(total)
print(max(max(a),0))
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
if abs(a-b) == c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

n = ni()
p  = nl()
ans = 0
for i in range(1,n-1):
    if p[i-1] < p[i] < p[i+1]:
        ans += 1
    elif p[i-1] > p[i] > p[i+1]:
        ans += 1

print(ans)
# Judge status: Wrong Answer
n=int(input())
s=[list(input()).sort() for _ in range(n)]
print(n-len(set(s))+1)
# Judge status: Accepted
A, B, C = map(int, input().split())

if (A + B >= C):
	print("Yes")
else:
	print("No")
# Judge status: Accepted
S = input()

SR = S[::-1]
ans = 0

for i in range(len(S)//2):
  if S[i] != SR[i]:
    ans +=1
  
print(ans)
# Judge status: Accepted
x,y,z=map(int,input().split())
print(z,end=' ')
print(x,end=' ')
print(y,end='')
# Judge status: Wrong Answer
import sys
from itertools import combinations
input = sys.stdin.readline

a,b,c,d = map(int,input().split())
h = []
h.append(a)
h.append(b)
h.append(c)
h.append(d)

li = list(combinations(h,2))
answer = -10000000001
for i in li:
    answer = max(answer,i[0]*i[1])
print(answer)
# Judge status: Accepted
n = int(input())
import math
l=0
for i in range(1,n+1):
    for j in range(1,n+1):
        p=math.gcd(i,j)
        for k in range(1,n+1):
            l+=math.gcd(p,k)
print(l)
# Judge status: Accepted
x,n = map(int,input().split())
p_L = list(map(int,input().split()))
p_L = set(p_L)
sa = 101
for i in range(0,200):
    if i not in p_L:
        if sa > min(sa,abs(i-x)):
            sa = abs(x-i)
            ans = i

print(ans)
# Judge status: Accepted
S = list(input())
n = len(S)
print("x"*n)
# Judge status: Wrong Answer
N= int(input())
li = [list(map(int,input().split())) for _ in range(N-1)]

for i in range(N-1):
    ci,si,fi = li[i]
    time = si+ci
    for j in range(i+1,N-1):
        cj,sj,fj = li[j]
        time += time%fj
        if time < sj:
            time = sj
        time += cj
    print(time)
print(0)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if (a<=0 and b>=0) or (b<=0 and a>=0):
    print("Zero")
elif a>0 and b>0:
    print("Positive")
else:
    if b-a%2==0:
        print("Positive")
    else:
        print("Negative")
# Judge status: Accepted
# A - Airplane
import itertools
P,Q,R=list(map(int,input().split()))

m=99999
for v in itertools.permutations([P,Q,R],2):
    m=min(m,v[0]+v[1])

print(m)
# Judge status: Accepted
c=input()
if c=="a" or c=='e' or c=="o" or c=="i" or c=="u":
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

N = int(input())
S = input()

ans = []
for c in S:
    print(abc[(abc.index(c) + N) % len(abc)], end = "")
# Judge status: Wrong Answer
a = input()
if a.isupper:
    print('A')
else:
    print('a')
# Judge status: Accepted
import math
import sys
import collections
import bisect


def main():
    n, m = map(int, input().split())
    x = sorted(list(map(int, input().split())))
    if m <= n:
        print(0)
        return
    y = sorted([x[i + 1] - x[i] for i in range(m - 1)])
    print(sum(y[0:(m-n)]))


if __name__ == '__main__':
    main()
# Judge status: Accepted
K = int(input())
S = input()

result = ""

if len(S) <= K:
  result = S
else:
  result = S[0:K] + "..."
  
print(result)
# Judge status: Accepted
import collections

n = int(input())
li = list(map(int,input().split()))
ans = []

for i in li:
    ans.append(i-1)
    ans.append(i)
    ans.append(i+1)

c = collections.Counter(ans)

print(c.most_common()[0][1])
# Judge status: Accepted
import numpy as np

n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1)
    s += 2 ** i * c1 * (n - c1)
    arr = arr >> 1

print(s % mod)
# Judge status: Accepted
N, W = map(int, input().split())
D = [tuple(map(int, input().split())) for _ in range(N)]

dp = [[0]*(N+1) for _ in range(W+1)]

for w in range(1, W+1):
	for i in range(1, N+1):
		# take one
		if D[i-1][0] <= w:
			dp[w][i] = max(dp[w][i-1], dp[w-D[i-1][0]][i-1] + D[i-1][1])
		# ignore
		dp[w][i] = max(dp[w][i], dp[w][i-1])

#print(dp)
print(max(dp[-1]))
# Judge status: Wrong Answer
num = int(input())
list = list(map(int,input().split()))
sorted(list)
count = 0
print(list)
for i in range(len(list)):
    for j in range(len(list)):
        for k in range(len(list)):
            if ( list[i] < list[j] < list[k] ) and ( list[i] + list[j] >  list[k] ):
                count += 1
print(count)
# Judge status: Accepted
s = str(input())
if s[0] == s[1] == s[2] == s[3]:
    print('No')
    exit()
if (s[0] == s[1] and s[2] == s[3]) or (s[0] == s[3] and s[2] == s[1]) or (s[0] == s[2] and s[1] == s[3]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = list(map(int, list(input())))
k = int(input())
ans = 1

if len(s) <= k:
    for i in s:
        if i != 1:
            ans = i
            break
else:
    for i in range(0,k):
        if s[i] != 1:
            ans = s[i]
            break

print(ans)
# Judge status: Accepted
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

import heapq

N = ri()
A = rl()

A.sort()

heap = []
a = A.pop()
heapq.heappush(heap, (-a, a, a))

ans = 0
while A:
	a = A.pop()
	b, l, r = heapq.heappop(heap)
	b = -b
	ans += b
	heapq.heappush(heap, (-min(a, l), l, a))
	heapq.heappush(heap, (-min(a, r), a, r))
print(ans)
# Judge status: Accepted
str = input().split()
s = str[0]
print("2018" + s[4:len(s)])
# Judge status: Wrong Answer
p,q,r=map(int,input().split())
x=p+q
y=q+r
z=r+p
if(x<=y):
  if(x<=z):
    print(x)
elif(y<=z):
  if(y<=x):
    print(y)
elif(z<=x):
  if(z<=y):
    print(z)
# Judge status: Accepted
N=int(input())
M=10**9+7
A=[int(x) for x in input().split()]

ans=0
for i in range(60):
  one=sum([a>>i&1 for a in A])
  zero=N-one
  ans+=(one*zero)*pow(2,i,M)%M
  ans%=M
  #print(one,zero)
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
X = sorted(map(int, input().split()))
d = [0] * (m-1)
for i in range(m-1):
    d[i] = abs(X[i] - X[i+1])
d.sort(reverse=True)
print(sum(d[n-1:]))
# Judge status: Wrong Answer
n,d = map(int,input().split())

print((n-d)//(d+1))
# Judge status: Wrong Answer
l,r = map(int,input().split())
x = l%2019
if (l//673 < r//673 or l%673==0) and (l//3 < r//3 or l%3==0):
    ans = 0
else:
    ans = l*(l+1)%2019
print(ans)
# Judge status: Wrong Answer
a,b,c = map(str,input().rstrip(""))


if(a=="R" and b == "R" and c == "R"):
  count = 3
  
elif(a=="R" and b == "R" and c == "S"):
  count = 2
elif(a=="R" and b == "S" and c == "S"):
  count = 1
elif(a=="S" and b == "R" and c == "R"):
  count = 2
elif(a=="S" and b == "R" and c == "S"):
  count = 1
elif(a=="S" and b == "S" and c == "R"):
  count = 1
else:
  count = 0

print(count)
# Judge status: Accepted
n=input()

n1,n2=int(n[:2]),int(n[2:])
if (n1>12 and n2>12) or (n1==0 and n2==0):
    print("NA")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("NA")
# Judge status: Accepted
s=sorted(input())
t=sorted(input(), reverse=True)
if s<t:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a,b,c,x,y = map(int,input().split())

if (a + b) <= 2 * c:
  print(a * x + b * y)
else:
  max_c = max(x,y)
  min_c = min(x,y)
  AB = 2 * c * max_c
  if x > y:
    SP = ((x - min_c) * a) + (2 * c * min_c)
  else:
    SP = ((y - min_c) * b) + (2 * c * min_c)
  print(min(AB,SP))
# Judge status: Accepted
a,b,c=map(int,input().split())
print("Yes" if (a+b)>=c else "No")
# Judge status: Accepted
n,k = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]

print(sum(sorted(arr)[::-1][k:]))
# Judge status: Wrong Answer
c = input().rstrip('\n')

str1 = "dreamer"
str2 = "dream"
str3 = "eraser"
str4 = "erase"

tmpstr = ""

endflag = False

while(c != ""):
  tmpstr = c
  c = c.replace(str1, "")
  c = c.replace(str2, "")
  c = c.replace(str3, "")
  c = c.replace(str4, "")
  
  print("tmpstr:" + tmpstr)
  print("c:" + c)
  
  if (c == tmpstr):
    endflag = True
    break

if (c == ""):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

cnt = 0
for i in range(n-2):
    test = sorted(p[i:i+3])
    if test[1] == p[i+1]:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer


import numpy as np
import math
MOD=10**9+7

n=int(input())
ans=1
for i in range(n+1):
    ans=(ans*i)%MOD
print(ans)
# Judge status: Accepted
W,H,x,y=map(int,input().split())
a1=W*H/2
a2=1 if x==W/2 and y==H/2 else 0
print(a1,a2)