peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
A=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
bn=[int(input()) for _ in range(N)]
ans=False
for ver in zip(*A):
    if all(item in bn for item in ver):
        ans=True
for wide in A:
    if all(item in bn for item in wide):
        ans=True
if all(A[i][i] in bn for i in range(3)):
    ans=True
if all(A[i][3-i-1] in bn for i in range(3)):
    ans=True
if ans==True:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
w,h,n=map(int,input().split())
temphu=h
temphd=0
tempwu=w
tempwd=0
for i in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    tempwd=max(tempwd,x)
  if a==2:
    tempwu=min(tempwu,x)
  if a==3:
    temphd=max(temphd,y)
  if a==4:
    temphu=min(temphu,y)
print(max(0,temphu-temphd)*max(0,tempwu-tempwd))
# Judge status: Accepted
import numpy as np
n,m = map(int,input().split())
if n == 1 and m == 1:
    print(1)
elif n == 1 or m == 1:
    print(np.maximum(n-2,m-2))
else:
    print((n-2)*(m-2))
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a + 2*b >= c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x,y = map(int,input().split())
if y%2==0 and x*2<=y<=x*4:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
from functools import reduce
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, sys.stdin.readline().split()))
c = [gcd_list(a[:i] + a[i+1:]) for i in range(min(n, 5))]
c.sort()
if n == 2:
    print(c[1])
else:
    print(c[2])
# Judge status: Accepted
n=int(input())
a=[int(i) for i in input().split()]
for i in range(n):
    a[i]-=(i+1)
a.sort()
s=0
for i in range(n):
    s+=abs(a[i]-a[int(n/2)])
print(s)
# Judge status: Wrong Answer
a, b, c = map(int,input().split())

if a%2 == 0 and b%2 == 0 and c%2 == 0:
    print(0)
else:
    print(a*b*c//max(a,b,c))
# Judge status: Wrong Answer
x, y, z = map(int, input().split())

a = x
x, y = x, y
x = z
z = a

print(x, y ,z)
# Judge status: Wrong Answer
n = int(input())
ans = 0
for a in range(1, n):
  ans += (n - 1)
print(ans)
# Judge status: Wrong Answer
#abc164a

a,b,c,d=map(int,input().split())
x=(a+d-1)/d
y=(c+b-1)/b
if x>=y:
 print('Yes')
else:
 print('No')
# Judge status: Wrong Answer
import math
x = int(input())
for i in range(0, math.ceil(math.sqrt(x))):
    b = int(i**5 - x)
    if b > 0:
        b = b**0.2
    else:
        b = -((-b)**0.2)
    try:
        if b % 1 == 0:
            print(i, int(b))
            break
    except:
        pass
# Judge status: Accepted
from fractions import gcd

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

print(a*b//gcd(a,b))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(1,n):
    ans += max(a[i-1]-a[i],0)
    a[i] = max(a[i-1],a[i])
print(ans)
# Judge status: Accepted
n=int(input())
ar=list(map(int,input().split()))
x=0
for i in range(n):
    x^=ar[i]
for i in range(n):
    print(ar[i]^x,end=" ")
# Judge status: Accepted
n=int(input())
*a,=map(int,input().split())
*b,=map(int,input().split())

capacity=0
for i in range(n):
    capacity+=max(0,b[i]-a[i]-(b[i]-a[i])%2)

for i in range(n):
    if a[i]>b[i]:
        capacity-=(a[i]-b[i])*2

if capacity>=0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
data.sort(key = lambda x : x[1])
now = 0
for i in range(n):
    now += data[i][0]
    if now > data[i][1]:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
def fact(n):
    val = 1
    for i in range(2, n + 1):
        val += i
    return val
n = int(input())
if n ==1:
  print(0)
elif n == 2:
  print(2)
else:
  print((fact(n-1)*9**(n-2))%(10**9+7))
# Judge status: Accepted
# abc 157
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(readline().strip())

if (N % 2) == 0:
    answer = int(N / 2)
else:
    answer = int((N + 1)/ 2)

print(answer)
# Judge status: Wrong Answer
s = input()
t = input()
n = len(s)
r=[-1]*26
r2=[-1]*26
abcd = 'abcdefghijklmnopqrstuvwxyz'

def f(l,l2,R):
  for i in range(n):
    if R[abcd.index(l[i])]!=-1:
       R[abcd.index(l[i])]=l2[i]
    else:
       print("No")
       exit()

f(s,t,r)
f(t,s,r2)
print("Yes")
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
total=sum(a)
cnt=0
i=0
while(cnt<=total/2):
  cnt+=a[i]
  i+=1
if i!=1:
  print(min(abs((total-cnt)-cnt),abs((total-cnt+a[i-1])-(cnt-a[i-1]))))
else:
  print(abs((total-cnt)-cnt))
# Judge status: Accepted
s = input()
print(2*(min(s.count("0"),s.count("1"))))
# Judge status: Accepted
n,h,*d=map(int,open(0).read().split());a=max(d[::2]);b=sorted(d[1::2]);c=0
while b and b[-1]>a>0<h:h-=b.pop();c+=1
print(c-(-h//a)*(h>0))
# Judge status: Accepted
def n_c_k(n, k):
    x = y = 1
    for i in range(k): 
        x *= n - i
        x %= mod
        y *= i + 1
        y %= mod
    return x * pow(y, mod - 2, mod) % mod

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

mod = 10 ** 9 + 7
ans = (pow(2, n, mod) - 1 - n_c_k(n, a) - n_c_k(n, b)) % mod 
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
d = s // 2
t = 0
i = -1
while(t <= d):
    i += 1
    t += a[i]
t2 = t - a[i]
# print(t,t2,s)
# print(t-(s-t),(s-t2)-t2)
print(min(t - (s - t),(s - t2) - t2))
# Judge status: Accepted
from collections import deque
n,m = map(int,input().split())
g = [[] for i in range(n)]
for i in range(m):
    x,y = map(int,input().split())
    g[x-1].append(y-1)
    g[y-1].append(x-1)
ans = [-1]*n
deq = deque([0])
while deq:
    fr = deq.popleft()
    for go in g[fr]:
        if ans[go] == -1:
            ans[go] = fr
            deq.append(go)
print("Yes")
for i in ans[1:]:print(i+1)
# Judge status: Wrong Answer
N = int(input())
print(int((N*(int(N-1)))/2))
# Judge status: Accepted
import math
import itertools

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

l=[0] * n

for _ in range(q):
    l[int(input())-1] += 1


for i in l:
    if k - (q-i) >0 :print('Yes')
    else: print('No')
# Judge status: Accepted
N, blue, red = map(int, input().split())

ans = N // (blue + red) * blue
rem = N % (blue + red)
ans += min(rem, blue)
print(ans)
# Judge status: Accepted
def comb_mod(n,r,m):
    ans = 1
    for i in range(1,r+1):
        ans *= (n-i+1) % m
        ans *= pow(i,m-2,m) % m
        ans = ans % m
    return ans

x,y = map(int,input().split())
m = 10**9+7
if x > 2*y or 2*x < y or (x+y)%3 != 0:
    ans = 0
else:
    n = (x+y)//3
    r = x-n
    ans = comb_mod(n,r,m)
print(ans)
# Judge status: Wrong Answer
N = int(input())
nums = list(map(int, input().split(' ')))
tmp = 0
max = 10**100
for i in nums:
    for j in nums:
        tmp += (j-i)**2
    if max > tmp:
        max = tmp
    tmp = 0
print(max)
# Judge status: Accepted
import math
A,B,C,D=[int(s) for s in input().split()]
taka=math.ceil(C/(B+0.0))
aoki=math.ceil(A/(D+0.0))
if taka>aoki:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
il = [int(k) for k in input().split()]
S = il[0]
W = il[1]

if S//2 <= W :
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted

N = input()
C = 0

for i in N:
	C += int(i)

if C % 9 == 0:
	print('Yes')
else:
	print('No')
# Judge status: Accepted
a,b,c=map(int,input().split())
print('YES' if b-a==c-b else 'NO')
# Judge status: Wrong Answer
inp=[int(x) for x in input().split()]
a,b,n=inp[0],inp[1],inp[2]
if (a-1)>n:
  print(n-1)
else:
  print(a-1)
# Judge status: Wrong Answer
N, L = map(str, input().split())
K = int(N)
P = list(map(str, input().split()))
U = sorted(list(set([str(i) for i in range(10)])-set(P)))
for i in range(len(N)):
    if int(N) <= K:
        if N[i] in P:
            for j in U:
                if j >=N[i]:
                    N=N.replace(N[i],j)
                    break
    else:
        if N[i] in P:
            N=N.replace(N[i],U[0])
print(N)
# Judge status: Accepted
s = input()
l = len(s)

print('x'*l)
# Judge status: Wrong Answer
N = int(input())
B = [int(s) for s in input().split(' ')]
def doit(bb):
    A = []
    for b in bb:
        if len(A) == 0:
            A.append(b)
            continue
        A.append(min(A[-1], b))
    A.append(A[-1])
    return sum(A)

print(max(doit(B), doit(reversed(B))))
# Judge status: Wrong Answer
import math
n,x,t = map(int,input().split())
print(math.ceil(n//x)*t)
# Judge status: Accepted
def red(n):
    if n < 3:
        return 0
    elif n == 3:
        return 1
    memo = [0] * (n+1)
    memo[3] = 1
    rem = 10**9 + 7
    for i in range(4,n+1):
        memo[i] = (memo[i-1] + memo[i-3]) % rem
    return memo[n] % rem

n = int(input())
print(red(n))
# Judge status: Accepted
A = []
for i in range(3):
  A += list(map(int,input().split()))

called = [False] * 9

bingo = ((0,1,2),(3,4,5),(6,7,8),(0,3,6),(1,4,7),(2,5,8),(0,4,8),(2,4,6))

N = int(input())
for i in range(N):
  target = int(input())
  if target in A:
    called[A.index(target)] = True
  
for a,b,c in bingo:
  if called[a] and called[b] and called[c]:
    print("Yes")
    break
else:
  print("No")
# Judge status: Wrong Answer
def edpcA(n, hs):
    hm2, hm1 = hs[0], hs[1]
    dp = [0, abs(hm2-hm1)]
    hs = list(reversed(hs[2:]))
    for i in range(2, n):
        h = hs.pop()
        d1 = dp[i-1] + abs(h-hm1)
        d2 = dp[i-2] + abs(h-hm2)
        dp.append(min(d1, d2))
        hm2, hm1 = hm1, h
    print(dp)
n = int(input())
hs = list(map(int, input().split(' ')))
edpcA(n, hs)
# Judge status: Accepted
n,k = map(int,input().split())

count = 1

while n >= k:
    n = n/k
    count += 1

print(count)
# Judge status: Wrong Answer
from itertools import combinations as c

def cond1(a,b,c):
    return a != b and b != c and c != a

def cond2(i,j,k):
    return j-i != k - j

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

comb_N = list(c(range(N), 3))

C = [1 for i in range(len(comb_N)) if cond1(S[comb_N[i][0]], S[comb_N[i][1]], S[comb_N[i][2]]) and cond2(*comb_N[i])]
print(C)
# Judge status: Accepted
n = int(input())
S = []
P = []
for i in range(n):
    tmp_S, tmp_P = input().split()
    S.append(tmp_S)
    P.append(int(tmp_P) * -1)
index = [i for i in range(1, n+1)]

ZIP = zip(S, P, index)
ZIP = sorted(ZIP)
S, P, index = zip(*ZIP)

for i in range(n):
    print(index[i])
# Judge status: Accepted
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)

x = 0
y = 0
for i in range(len(a)):
    if i % 2 == 0:
        x += a[i]
    else:
        y += a[i]

print(x-y)
# Judge status: Wrong Answer
x,y = map(int,input().split())
g1=[1,3,5,7,8.10,12]
g2=[4,6,9,11]
g3=[2]
if x in g1 and y in g1:
    print('Yes')
elif x in g2 and y in g2 :
    print('Yes')
elif x in g3 and y in g3 :
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def actual(a, b, h):
    return int((a + b) * h / 2)

a = int(input())
b = int(input())
h = int(input())

print(actual(a, b, h))
# Judge status: Wrong Answer
S = input()
print(len(S))

i = 0
while i < len(S):
    print('*', end='')
    i += 1
# Judge status: Accepted
x, y = map(int, input().split())

if y < 2*x:
    print(1)
    exit()

ans = 1
while x*2 <= y:
    ans += 1
    x = 2*x

print(ans)
# Judge status: Wrong Answer
print("No" if int(input().replace(" ",""))%4 else "Yes")
# Judge status: Accepted
def gcd(x,y):
    if y==0:
        return x
    return gcd(y,x%y)

MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
lcm = 1
for i in A:
    lcm = (lcm*i)//gcd(lcm,i)
lcm %= MOD
ans = 0
for i in A:
    ans += lcm*pow(i,MOD-2,MOD)
    ans %= MOD
print(ans)
# Judge status: Wrong Answer
W, a, b = map(int,input().split())
 
if (a+W)<=b:
  print(b-(a+W))
elif (a<= b)and (b<(a+W)):
  print(b-a)
elif ((a-W)<=b) and(b<a):
  print(a-b)
elif b<(a-W):
  print(a-(b+W))
# Judge status: Accepted
k,a,b=map(int,input().split())
if b-a<=2 or k-1<a:
    print(1+k)
else:
    print((k-a+1)//2*(b-a)+(k-a+1)%2+a)
# Judge status: Accepted
x, y = map(int, input().split())
ax, ay = abs(x), abs(y)


def sign(x):
    if x == 0:
        return 0
    elif x > 0:
        return 1
    else:
        return -1


if x == 0 or y == 0:
    print(abs(x-y)+(x > y))
else:
    if sign(x) != sign(y):
        print(abs(ax - ay) + 1)
    else:
        if x < y:
            print(y - x)
        else:
            print(abs(ax - ay) + 2)
# Judge status: Accepted
n, m = [int(x) for x in input().split()]

temp_list = [[] for _ in range(n + 1)]
for i in range(m):
    p, y = [int(x) for x in input().split()]
    temp_list[p].append((y, i))

ans_list = [""] * m
for p in range(1, n + 1):
    temp_list[p].sort()
    for j in range(len(temp_list[p])):
        _, i = temp_list[p][j]
        ans_list[i] = "{:06}{:06}".format(p, j + 1)

for ans in ans_list:
    print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key=lambda x: x[0])

cnt = 0
ans = 0
for a, b in ab:
    cnt += b
    ans += a*b
    if cnt >= m:
        break
        
print(ans - (cnt - m)*a)
# Judge status: Accepted
n, a = int(input()), list(map(int, input().split()))
a.sort(reverse = True)
alice = 0
bob = 0
for i in range(n):
  if i % 2 == 0:
    alice += a[i]
  else:
    bob  += a[i]
# print(alice)
# print(bob)
print(alice - bob)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
cnt = 0
for i in range(0,N-2):
  for j in range(i+1,N-1):
    for k in range(j+1,N):
      if (i+j)>k and (j+k)>i and (i+k)>j and i!=k and j!=k and i!=j:
        cnt+=1
        
print(cnt)
# Judge status: Accepted
import sys
#import numpy as np
import math
from fractions import Fraction
import itertools

input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))
s=set()
for i in range(n-1):
    if a[n-1-i-1]>1+a[n-i-1]:
        print("No")
        exit()
    elif a[n-i-2]==a[n-i-1]+1:
        a[n-i-2]-=1
        s.add(i)
for i in range(n-1):
    if a[i]>a[i+1] and i in s:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
p = list(map(int, input().split()))
n = int(input())
l = []
s = [0.25, 0.5, 1, 2]

l = [[p[0]*4, 0], [p[1]*2, 1], [p[2], 2], [p[3]/2, 3]]
l.sort()


def only1L():
    return min(p[0]*4, p[0]*2+p[1], p[1]*2, p[2])


if (n == 1):
    print(only1L())
elif (s[l[0][1]] == 2):
    print(int(p[l[0][1]] * (n // s[l[0][1]])) + only1L())
else:
    print(int(l[0][0] * (n // s[l[0][1]])))
# Judge status: Accepted
k = int(input())
seed = 0
flag = 1
for i in range(k):
    seed = (10*seed +7)%k
    if seed == 0: print(i+1); flag = 0; break
if flag: print(-1)
# Judge status: Wrong Answer
n = int(input())
s = list(input())
alp = [chr(ord('A') + i) for i in range(26)]
ans = []
for a in s:
    i = (alp.index(a) + 2) % 26
    ans.append(alp[i])
print(''.join(ans))
# Judge status: Accepted
K, A, B = map(int, input().split())
if A+2 >= B or A >= K:
  print(K+1)
else:
  print(B + ((K-A+1)//2-1)*(B-A) + ((K-A+1)%2))
# Judge status: Wrong Answer
import random
S = input()
a=len(S)
b=[random.randrange(a-2)]
b.append(random.randint(b[0]+1,a-2))
b.append(random.randint(b[1]+1,a-1))
c=[S[b[i]] for i in range(3)]
print(c[0]+c[1]+c[2])
# Judge status: Accepted
s=str(input())
if s.count("W")==0 and s.count("E")==0 and s.count("S")==0 and s.count("N")==0:
    print("Yes")
elif s.count("W")>0 and s.count("E")>0 and s.count("S")==0 and s.count("N")==0:
    print("Yes")
elif s.count("W")==0 and s.count("E")==0 and s.count("S")>0 and s.count("N")>0:
    print("Yes")
elif s.count("W")>0 and s.count("E")>0 and s.count("S")>0 and s.count("N")>0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
cnt = 0
flg = False

for i in range(n):
    d1, d2 = map(int, input().split())
    if cnt == 0 and d1 == d2:
        cnt += 1
    if cnt > 0:
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0
    if cnt == 3:
        flg = True
        
if flg:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import bisect
N = int(input())
L = list(map(int, input().split()))

L = sorted(L)
count = 0
for i in range(1,N-1):
    for j in range(i+1,N):
              posi = bisect.bisect_right(L,L[j]-L[i])
              if i-posi > 0:
                  count += i-posi
print(count)
# Judge status: Accepted
n,q=map(int,input().split())
s=list(input())
ac=[0]*n
for i in range(1,n):
  ac[i]=ac[i-1]
  if s[i-1]+s[i]=='AC':
    ac[i]+=1
#print(*ac)
for _ in range(q):
  l,r=map(int,input().split())
  print(ac[r-1]-ac[l-1])
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))
f = True
now = H[0]
for i in range(0,N - 1):
  #print(i, now)
  #次が1以上小さい
  if now - H[i + 1] >= 1:
    f = not f
    break
  #次の方が1以上大きい
  elif H[i + 1] - now >= 1:
    now = H[i + 1] - 1

if f:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,k = map(int, input().split())

ans = 0

while n > 0:
  n /= k
  n = int(n)
  ans += 1
  
print(ans)
# Judge status: Accepted
a,b = map(int,input().split())

c = (a+b)/2

print(int((a+b+1)/2))
# Judge status: Wrong Answer

# 出力
a, b = map(int, input().split())

# 処理&出力
if a / 3 >= 1 :
    print('Possible')
elif b / 3 >= 1:
    print('Possible')
elif (a + b) /3 >= 1:
    print('Possible')
else:
    print('Impossible')
# Judge status: Wrong Answer
X, Y = map(int, input().split())
if Y % X == 0 or X % Y == 0:
  ans = -1
else:
  ans = X
if ans > 10**18:
  ans = -1
if X == 1:
  ans = Y + 1
print(ans)
# Judge status: Accepted
def f(x, y):
    return x-y, x+y


n = int(input())
p = [list(map(int, input().split())) for i in range(n)]

max_x = -2000000000
min_x = 2000000000
max_y = -2000000000
min_y = 2000000000
for xi, yi in p:
    f1, f2 = f(xi, yi)
    max_x = max(max_x, f1)
    min_x = min(min_x, f1)
    max_y = max(max_y, f2)
    min_y = min(min_y, f2)

print(max(max_x - min_x, max_y - min_y))
# Judge status: Accepted
import math

n = int(input())
s_amount = 0

l = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
  for j in range(i):
    s_amount += math.sqrt((l[i][0] - l[j][0]) ** 2 + (l[i][1] - l[j][1]) ** 2)
    
print(s_amount / sum([i for i in range(n)]) * (n-1))
# Judge status: Wrong Answer
N = input()

for n in N:
    if n == '7':
        ans = 'Yes'
    else:
        ans = 'No'

print(ans)
# Judge status: Accepted
a, b, c, k = map(int, input().split())

print(min(k, a) - max(k - a - b, 0))
# Judge status: Wrong Answer
N = int(input())
a = []
a = list(map(int,input().split()))
index = 0
count = 0
searchNum = 1
for j in range(N):
    if a[j] ==searchNum:
        searchNum += 1
        continue
    else:
        count +=1
print(count)
# Judge status: Wrong Answer
import sys
a,b = map(int,input().split())
s = list(input())
print(s)
if s[a] != "-":
	print("NO")
	sys.exit()
s[s.index("-")] = "1"
print(s)
for i in range(len(s)):
	if s[i].isdigit():
		if int(s[i]) >= 6 or int(s[i]) <= 0:
			print("No")
			sys.exit()
	else:
		print("No")
		sys.exit()
print("Yes")
# Judge status: Accepted
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))


ans_list = []
for k in range (0,N+1):
    A1_sum = 0
    A2_sum = 0
    for i in range(0,N):
        if i <= k-1:
            A1_sum += A1[i]
    for i in range(0,N):
        if i >= k-1:
            A2_sum += A2[i]
    ans = A1_sum + A2_sum
    ans_list.append(ans)

print(max(ans_list))
# Judge status: Wrong Answer
S = input()
T = input()
count = 0
for s, t in zip(S, T):
    if s != t:
        count += 1

print(int((count+1)/2))
# Judge status: Accepted
x = int(input())
ans = x // 11 * 2
nokori = x % 11
if nokori > 6:
    print(ans + 2)
elif nokori == 0:
    print(ans)
else:
    print(ans + 1)
# Judge status: Wrong Answer
N = int(input())

abc = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while N > 0:
    N -= 1
    ans = abc[(N%26)] + ans
    N //= 26
print(ans)
# Judge status: Accepted
n,k,x,y=int(input()),int(input()),int(input()),int(input())
if n<k:print(x*n)
else:print(x*k+y*(n-k))
# Judge status: Accepted
#abc139 c
n=int(input())
h=list(map(int,input().split()))

ans=0
cnt=0
for i in range(n-1):
    if h[i]>=h[i+1]:
        cnt+=1
    else:
        ans=max(ans,cnt)
        cnt=0
ans=max(ans,cnt)
print(ans)
# Judge status: Accepted
H,N = map(int,input().split())
A = list(map(int, input().split()))
#print(H,N)
#print(A)
for i in range(N):
  H -= A[i]
if H <= 0:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N = int(input())
XL = [tuple(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0]+x[1])
right = -float('inf')
ans = 0
s = -1e9
for x,l in XL:
    t = x+l-1
    if s <= right:
        right = t
        ans += 1
print(ans)
# Judge status: Wrong Answer
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
s = rr()
print(s.replace(s[b-1], s[b-1].lower()))
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
s = input()

success = 0
foreigner = 0
count = 0

for i in s:
    if i == "a" and success <= a + b:
        print("Yes")
        success += 1
    elif i == "b" and success <= a + b and foreigner <= b:
        print("Yes")
        success += 1
        foreigner += 1
    else:
        print("No")
    count += 1
    if success == a + b:
        break

for _ in range(n - count):
    print("No")
# Judge status: Wrong Answer
s=list(map(int,input()))
count=0
k=len(s)-2
i=0
while i<=k:
    if s[i]!=s[i+1]:
        s.remove(s[i])
        s.remove(s[i])
        k-=2
        count+=2
    else:
        i+=2
    
print(count)
# Judge status: Accepted
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
  print(A-1, B)
else:
  print(A, B-1)
# Judge status: Accepted
def main():
    word = input()
    target = "keyence"
    target_length = len(target)
    answer = "NO"
    if word[:target_length] == target or word[-target_length:] == target:
        answer = "YES"
    else:
        for i in range(1, target_length):
            if word[:i] == target[:i] and word[-target_length + i:] == target[-target_length + i:]:
                answer = "YES"
                break
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Accepted
s = list(input())
s.reverse()
s += ["0"]
n = len(s)
dp = [[10**7 for _ in range(2)] for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
	for j in range(2):
		x = int(s[i]) + j
		for a in range(10):
			kurisagaru = False
			if a >= x:
				b = 0
			else:
				b = 10 + a - x
				kurisagaru = True
			dp[i+1][kurisagaru] = min(dp[i+1][kurisagaru], dp[i][j]+a+b)
print(dp[n][0])
# Judge status: Accepted
n = int(input())
print(n * (n + 1) // 2)
# Judge status: Wrong Answer
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    print(Counter(input())['R'])

    
main()
# Judge status: Accepted
a,b=map(int,input().split())
print('Possible') if a+b>=3 and (a%3==0 or b%3==0 or (a+b)%3==0) else print('Impossible')