peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from math import factorial
def count(n, r):
    if n == r:
        return 2
    else:
        return 1

N, M = map(int, input().split())
mod = 10**9 + 7
print(((factorial(N) % mod) * (count(N, M) % mod) * (factorial(M) % mod)) % mod if abs(N - M) < 2 else 0)
# Judge status: Wrong Answer
n=int(input())
t=1
while t*t<n:
  t+=1
print(t-1)
# Judge status: Accepted
import sys

H, W = map(int, input().split())
if H == 1 or W == 1:
    print(1)
    sys.exit()

a = H * W
if a % 2 == 0:
    answer = a // 2
else:
    answer = a // 2 + 1
print(answer)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print(c-(a-b))
# Judge status: Accepted
n=int(input())
mv=[]
for i in range(5):
    mv.append(int(input()))

print(-(-n//min(mv))+4)
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(a+b if a+b <= 24 else a+b-24)
# Judge status: Accepted
from collections import defaultdict

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

MOD = 998244353

p = defaultdict(int)
for d in D:
    p[d] += 1

if p[0] == 1 and D[0] == 0:
    ans = 1
    for i in range(max(D)):
        ans *= pow(p[i], p[i + 1], MOD)
        ans %= MOD
        if ans == 0:
            break

    print(ans)

else:
    print(0)
# Judge status: Accepted
N,X,Y = map(int,input().split())
ans = [0] * (N-1)
for i in range(1,N):
    for j in range(i+1,N+1):
        min_distance = min(abs(i-j), abs(i-X)+abs(j-Y)+1, abs(j-X)+abs(i-Y)+1)
        ans[min_distance-1] += 1
for i in range(N-1):
    print(ans[i])
# Judge status: Accepted
K, S = map(int, input().split())
ans = 0
for x in range(K + 1):
    for y in range(K + 1):
        rest = S - (x + y)
        if rest >= 0 and rest <= K:
            ans += 1
print(ans)
# Judge status: Accepted
str = input().split()
n = int(str[0])
k = int(str[1])
t = n%k
other = abs(k-t)
print(min(t,other))
# Judge status: Accepted
#064_A
r,g,b=input().split()
print('YES' if int(r+g+b)%4==0 else 'NO')
# Judge status: Wrong Answer
import math
a, b, x = map(int, input().split())
print(math.degrees(math.atan(2*(pow(a,2)*b-x)/pow(a,3))))
# Judge status: Accepted
a,b = map(int, input().split())
print(a*(a-1)//2 + b*(b-1)//2)
# Judge status: Accepted
from collections import Counter
n=int(input())
string_list = [input() for i in range(n)]
str_counter = Counter(string_list)
most_count = 0
l = []
for v in str_counter.values():
  if v > most_count:
    most_count = v

for k,v in str_counter.items():
  if v == most_count:
    l.append(k)
l.sort()
for i in l:
  print(i)
# Judge status: Accepted
def resolve():
    r, g, b = map(int, input().split())
    k = int(input())

    c = 0
    # gがrより大きくなるまで2倍する
    while r >= g:
        g *= 2
        c += 1
    
    # bがgより大きくなるまで2倍する
    while g >= b:
        b *= 2
        c += 1

    if c <= k:
        print("Yes")
    else:
        print("No")

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

if a <= 0 <= b:
    print('Zero')
elif 0 < a <= b or not (b - a + 1) % 2:
    print('Positive')
else:
    print('Negative')
# Judge status: Accepted
x,a,b = map(int,input().split())
print('delicious') if b-a<=0 else print('safe') if b-a<=x else print('dangerous')
# Judge status: Accepted
n,k=map(int,input().split())
ans=[]
a=1
b=n
s=set()
for _ in range(k):
  s.add(abs(a-b))
  s.add(abs(n+a-b)%n)
  ans.append([a,b])
  a+=1
  b-=1
  if abs(a-b) in s or abs(n+a-b)%n in s or abs(a-b)==abs(n+a-b):
    b-=1
for i in range(k):
  print(*ans[i])
# Judge status: Wrong Answer
import math
a=input()
b=input()
c=input()
if int(a)>int(b):
 print(math.ceil(int(c)/int(a)))
elif int(a)<int(b):
 print(math.ceil(int(c)/int(b)))
# Judge status: Accepted
N = int(input())
numbers = list(map(int, input().split()))
odd_num_cnt = 0
even_num_cnt = 0
four_mal_cnt = 0
for i in numbers:
    if i % 4 == 0:
        four_mal_cnt += 1
    elif i % 2 == 0:
        even_num_cnt += 1
    else:
        odd_num_cnt += 1
if four_mal_cnt >= odd_num_cnt or (four_mal_cnt == odd_num_cnt - 1 and even_num_cnt == 0):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n,l=map(int,input().split())
s=0
list=[]
for i in range(1,n+1):
  s+=i
  list.append(abs(l+i-1))
sum=n*(l-1)+s
if l-1<-n:
  print(sum+min(list))
elif l-1<=0<=l-1+n:
  print(sum)
else:
  print(sum-min(list))
# Judge status: Accepted
ABC=list(map(int,input().split()))
print("Yes" if min(ABC[0],ABC[1])<ABC[2]<max(ABC[0],ABC[1]) else "No")
# Judge status: Wrong Answer
import numpy as np

N,M = list(map(int,input().split()))
a = list(np.array([input().split() for i in range(M)]).reshape(-1))
a = [int(i) for i in a]

for i in range(1,M+2):
	print(a.count(i))
# Judge status: Accepted
input()
s = input(); l = len(s)
if l % 2:
    print('No')
else:
    print('Yes' if (s[:(l//2)] == s[l//2:]) else  'No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
m = 0
ma = a[0]
for i in range(1, n):
    ma = max(ma, a[i])
    m = max(m, ma-a[i])
print(m)
# Judge status: Accepted
n, l = map(int, input().split())
taste = [l+i-1 for i in range(1, n+1)]
sm = sum(taste)
mn = 10**4
ans = 0
for i in range(n):
  if abs(sm - (sm-taste[i])) < mn:
    mn = abs(sm - (sm-taste[i])) 
    ans = sm-taste[i]
print(ans)
# Judge status: Accepted
def main():
    w, h = map(int, input().split())
    f = w%2==0
    g = h%2==0
    a = w*h//2
    if w==1 or h==1:
        print(1)
        exit()
    if not f and not g:
        print(a+1)
    else:
        print(a)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n, k = map(int, input().split())
d = list(map(int, input().split()))
for i in range(n, 10 * n + 1):
    flag = False
    for j in str(i):
        if int(j) in d:
            flag = True
            break
    if flag:
        continue
    exit(print(i))
# Judge status: Wrong Answer
S = list(input())
a = S[0] + S[1]
b = S[2] + S[3]
A = int(a)
B = int(b)

if (0 < A < 13 and 0 < B < 13):
  print("AMBIGUOUS")
elif (0 < A < 13 and 12 < B <= 99):
  print("MMYY")
elif (0 < B < 13 and 12 < A <= 99):
  print("YYMM")
else:
  print("NA")
# Judge status: Accepted
S = input()

a = S.count("a")
b = S.count("b")
c = S.count("c")
m = max(a,b,c)

if m-a <= 1 and m-b <= 1 and m-c <= 1 :
    print("YES")
else :
    print("NO")
# Judge status: Wrong Answer
A, B, C, K = map(int, input().split()) 
if K==0:
    if abs(A-B)<=10**18:
        print(A-B)
    else:
        print("Unfair")
else:
    if abs(B-A)<=10**18:
        print(B-A)
    else:
        print("Unfair")
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
ans = set([_ for _ in range(A, min(A + K, B))])
ans |= set([_ for _ in range(B, max(A, B-K), -1)])
for num in sorted(list(ans)):
    print(num)
# Judge status: Accepted
import math
n = int(input())
ans = 0
for i in range(int(math.sqrt(n)) + 1):
  if i ** 2 > n:
    exit()
  elif i ** 2 > ans and i ** 2 <= n:
    ans = i ** 2
print(ans)
# Judge status: Wrong Answer
import itertools

N, M, Q = map(int, input().split())
list_q = []
for i in range(Q):
    list_q.append(list(map(int, input().split())))
ans = 0

for A_ in itertools.combinations([i for i in range(1, M+1)], N):
    A = list(A_)
    tmp_ans = 0
    for i in range(Q):
        if A[list_q[i][1]-1] - A[list_q[i][0]-1] == list_q[i][2]:
            tmp_ans += list_q[i][3]
    if ans < tmp_ans:
        ans = tmp_ans

print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
py = [list(map(int,input().split()))+[_] for _ in range(m)]
py.sort()
flag = py[0][0]
flag_2 = 1
for i in range(m):
  if flag != py[i][0]:
    flag = py[i][0]
    flag_2 = 1
  py[i][0] = (6-len(str(py[i][0])))*"0"+str(py[i][0])
  py[i][1] = (6-len(str(flag_2)))*"0"+str(flag_2)
  flag_2 += 1
py.sort(key = lambda py:py[2])
for j in range(m):
  print("".join(py[j][:2]))
# Judge status: Wrong Answer
red,blue=input().split()
a,b=list(map(int,input().split()))
s = input()
if s == "red":
    print(a-1,b)
else:
    print(a,b-1)
# Judge status: Accepted
X = input()
N = len(X)
c = 0
s, t = 0, 0
for k in range(N):
    if X[k] == "S":
        s += 1
    else:
        t += 1
        if s > 0 and t > 0:
            s -= 1
            t -= 1
            c += 2
print(N-c)
# Judge status: Accepted
#input
X = int(input())

#output
a = X//500
b = (X - 500*a)//5

print(1000 * a + 5 * b)
# Judge status: Wrong Answer
# max 2 100 -> 1000000 (intで表現可能)
# list[1]の数にlist[1]回100をかければよいはず
list = [int(i) for i in input().split(" ")]
for i in range(list[0]):
    list[1] = list[1] * 100
print(list[1])
# Judge status: Wrong Answer
import math
N = int(input())
digit = int(math.log10(N)) + 1
ans = 0
for i in range(1, digit, 2):
  ans += 9 * (10 ** (i-1))

if digit % 2 == 1:
  ans += N % (10 ** (digit - 1)) + 1

print(ans)
# Judge status: Accepted
# 131 A

s = input()
cnd = True

for i in range(0, len(s)-1):
    # print(i)
    if int(s[i]) == int(s[i+1]):
        cnd = False
        break

if cnd == True:
    print("Good")
else:
    print("Bad")
# Judge status: Accepted
n = int(input())

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

a_sum = sum(a)
b_sum = sum(b)

if a_sum > b_sum:
    print("No")
    exit(0)

less_a_cnt = 0
less_b_cnt = 0

for i in range(n):
    if a[i] < b[i]:
        less_a_cnt += int((b[i] - a[i]) / 2)
    else:
        less_b_cnt += a[i] - b[i]

if less_a_cnt < less_b_cnt:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
n,k=map(int,input().split())
nm=[0 for i in range(200010)]
a=list(map(int,input().split()))
for i in a:
  nm[i]+=1
a.sort(reverse=True)
for i in range(k):
  n-=a[i]
print(n)
# Judge status: Wrong Answer
n, k = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

ans = 1
ptr = A.index(1)
left = max(ptr - 1, 0)
right = max(n - ptr - 2, 0)

ans += left // (k - 1)
if left % (k - 1) > 0:
    ans += 1

ans += right // (k - 1)
if right % (k - 1) > 0:
    ans += 1

print(ans)
# Judge status: Accepted
k = int(input())
a, b = map(int, input().split())
ka = a // k
kb = b // k
if b - a >= k - 1:
  print("OK")
elif kb - ka > 0:
  print("OK")
elif a % k == 0 or b % k == 0:
  print("OK")
else:
  print("NG")
# Judge status: Accepted
S = "0" + input()

ans = 0
b = 0
c = 0
for a in S[::-1]:
    A = int(a) + b
    if A == 5 and c == 0:
        ans += 5
        b = 0
        c = 1
    elif A < 5:
        ans += A
        b = 0
        c = 0
    else:
        ans += 10 - A - c
        b = 1
        c = 0

print(ans)
# Judge status: Accepted
import sys
A, B = map(int, input().split())
ans = -1
for x in range(1010):
    a = int((x*0.08))
    b = int(x*0.1)
    if a == A and b == B:
        print(x)
        sys.exit()
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
print(min(a+b,b+c,c+a))
# Judge status: Accepted
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
N, T = map(int, input().split())
L = []
for _ in range(N) :
  L.append(list(map(int, input().split())))
#print (L)

ans = sys.maxsize
TLEflag = True
for i in range(N) :
  if L[i][1] <= T :
    ans = min(ans, L[i][0])
    TLEflag = False

if TLEflag == True :
  print ("TLE")
else :
  print (ans)
# Judge status: Accepted
import math
n = int(input())

round_n = math.ceil(n/1000)*1000

print(round_n-n)
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(200):
        if all(i % 2 == 0 for i in a):
            a = [i // 2 for i in a]
        else:
            print(i)
            break

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import math

input = str(input()).split(" ")
for index in range(len(input)):
    input[index] = int(input[index])
x = input[0]
y = input[1]


def test(x, y):
    for index in range(-abs(y), abs(y) + 1):
        if (x * index % y != 0 and abs(x * index) <= 10**(18)):
            return x * index
    return -1
print(test(x,y))
# Judge status: Accepted
def main():
    X, Y = map(int, input().split())

    if X % Y == 0:
        print("-1")
    else:
        print(X)

if __name__ == '__main__':
    main()
# Judge status: Accepted
x, y=map(int, input().split())
ans=[]

while x<=y:
    ans.append(x)
    x*=2

print(len(ans))
# Judge status: Accepted
n = int(input())
s = input()

t = s
while "()" in t:
    t = t.replace("()", "")

a = t.count(")"); b = t.count("(")

print("(" * a + s + ")" * b)
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
sum = 0
if n>=k:
  sum = k*x + (n - k)*y
  print(sum)
	
else:
  sum = n*x
  print(sum)
# Judge status: Accepted
n = int(input())
k =  input()
stone = list(k)
w = 0
r = 0
for i in range(n):
    if stone[i] == 'R':
        r += 1
    else:
        w += 1

ans = 0
w_s = 0
r_s = 0
for i in range(n):
    if i <= r-1 and stone[i] ==  'W':
        w_s += 1
    elif i > r-1 and stone[i] == 'R':
        r_s += 1
ans = max(w_s, r_s)
print(ans)
# Judge status: Accepted
S=set(sorted(list(input())))
if S=={'E','N','S','W'} or S=={'N','S'} or S=={'E','W'}:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A, B, K = map(int, input().split())
ans = []

for i in range(1, max(A, B) + 1):
    if A % i == 0 and B % i == 0:
       ans.append(i)

print(ans[-K])
# Judge status: Wrong Answer
n,a,b = map(int,input().split())

mod = 10**9+7

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

sum = pow(2,n,mod)
case = combination(n,a,mod) + combination(n,b,mod) + 1
ans = sum-case
if ans < 0 :
    ans += mod

print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())

if a%3 == 0 or b %3 == 0 or (a + b)%3 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
print(((a+b)*h)//2)
# Judge status: Wrong Answer
S = input()
result = 0
for i in range(int(len(S) / 2)):
    print(i, S[i], S[-(i+1)])
    if S[i] != S[-(i+1)]:
        result += 1
print(result)
# Judge status: Accepted
import numpy as np
s = list(map(int, input().split()))
n=s[0]
m=s[1]
student=[]
check=[]
for i in range(n):
    s = list(map(int, input().split()))
    student.append(s)
for i in range(m):
    s = list(map(int, input().split()))
    check.append(s)
student=np.array(student)
check=np.array(check)
for i in student:
    c=np.copy(check)
    c=np.abs(c-i)
    c=c[:,0]+c[:,1]
    print(np.argmin(c)+1)
# Judge status: Wrong Answer
n,l = map(int,input().split())
n_l = []
for i in range(n):
    n_l.append(i+l)
min_a = 1000
for i in n_l:
    min_a = min(abs(i),abs(min_a))

print(sum(n_l)-min_a)
# Judge status: Accepted
N,K = map(int,input().split()) #N = 4,K=5
A = [int(i)-1 for i in input().split()]
log_K = K.bit_length() #3bit (5 = 101)
next = [[-1]*N for _ in range(log_K)]

for i in range(N):
    next[0][i] = A[i]
    
for k in range(log_K - 1):
    for i in range(N):
        next[k+1][i] = next[k][next[k][i]]  

now = 0
for i in range(log_K)[::-1]: 
    if ((K >> i) & 1) == 1: 
        now = next[i][now]
print(now + 1)
# Judge status: Wrong Answer
N, M = map(int, input().split())
ab = [tuple(map(int, input().split())) for i in range(N)]

cd = [tuple(map(int, input().split())) for i in range(M)]


for a, b in ab:
    ret = 0
    dis = 10**17
    for i, x in enumerate(cd):
        c, d = x
        if dis > (c-a)**2 + (d-b)**2:
            dis = (c-a)**2 + (d-b)**2
            ret = i
    print(ret+1)
# Judge status: Accepted
n=int(input())
li=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
  li[i].append(li[i][0]-li[i][1])
  li[i].append(li[i][0]+li[i][1])

from operator import itemgetter
li=sorted(li, key=itemgetter(3))

ans=0
now=0

for i in range(n-1):
  if li[now][3]>=li[i+1][3]: #今調査してるやつが、次のやつを覆ってしまってる場合
    ans+=1
    now=i+1
  elif li[now][3]>li[i+1][2]:
    ans+=1
  else:
    now=i+1

print(n-ans)
# Judge status: Accepted
n = int(input())
A = [int(i) for i in input().split()]
cnt_x = [0] * (10**5 + 2)
for a in A:
    cnt_x[a - 1] += 1
    cnt_x[a] += 1
    cnt_x[a + 1] += 1
print(max(cnt_x))
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())

for i in range(1,101):
	if i/2 % 1 :
		c = c-b
		print('c',c)
	else:
		a = a-d
		print('a',a)
	
	if a <= 0:
		print('No')
		break
	elif c <= 0:
		print('Yes')
		break
# Judge status: Accepted
N = int(input())
count = 0
while N > 1:
    N //= 2
    count += 1
print(2**count)
# Judge status: Accepted
N, M = map(int, input().split())

R = [0 for _ in range(N+1)] # possibility to include the red ball
C = [1 for _ in range(N+1)] # number of balls
R[1] = 1


for i in range(M):
    x, y = map(int, input().split())
    if R[x] == 1:
        R[y] = 1
        if C[x] == 1:
            R[x] = 0
    C[x] -= 1
    C[y] += 1
#    print('R', R)
#    print('C', C)
print(R.count(1))
# Judge status: Wrong Answer
mod = 10 ** 9 + 7
fact = [i for i in range(10**5+1)]
fact[0] = 1
for i in range(10 ** 5-1):
  fact[i+1] *= fact[i]
  fact[i+1] %= mod
n,m = map(int,input().split())
if abs(n-m)>1:
  print(0)
else:
  if n!=m:
    print(fact[n]*fact[m]%mod)
  else:
    print(fact[n]*fact[m]*2%mod)
# Judge status: Accepted
from sys import stdin


def get_result(data):
    X, Y, A, B, C = data[0]
    p = sorted(data[1], reverse=True)
    q = sorted(data[2], reverse=True)
    r = sorted(data[3], reverse=True)
    tmp = p[0:X] + q[0:Y] + r
    ans = sum(sorted(tmp, reverse=True)[0:(X+Y)])
    return ans


if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = []
flg = True
for a in A:
  i = 0
  while flg:
    if a % 2 ** i == 0:
      i += 1
    else:
      B.append(i - 1)
      flg = False
B.sort()
print(B[0])
# Judge status: Accepted
K,N=map(int,input().split())
A = [int(v) for v in input().split()]
D = []
for i in range(len(A)-1):
  D.append(A[i+1]-A[i])
D.append(A[0]+(K-A[-1]))
print(K-max(D))
# Judge status: Accepted
a = []
for i in range(5):
    a.append(int(input()))
k = int(input())
isOK = True
for i in range(5):
    for j in range(i+1,5):
        if abs(a[i]-a[j])>k:
            isOK = False
            break
if isOK:
    print('Yay!')
else:
    print(':(')
# Judge status: Wrong Answer
N,x = map(int,input().split())
a=list(map(int,input().split()))

a.sort()

ans=0
for i in range(N):
    if x >= a[i]:
        ans+=1
        x-=a[i]
    else:
        break
if x != 0:
    ans -= 1
print(ans)
# Judge status: Accepted
s = input()
ans = 'NO'
flag = False
for i in range(len(s)):
    if flag:
        break
    for j in range(i,len(s)+1):
        if s[:i]+s[j:] == 'keyence':
            ans = 'YES'
            flag = True
            break
print(ans)
# Judge status: Wrong Answer
s = input()

if s[0]==s[1] and s[2] == s[3]:
    print("Yes")
elif s[0]==s[2] and s[1] == s[3]:
    print("Yes")
elif s[0] == s[3] and s[1] == s[2]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
k = int(input())

while k > 0:
  if a > b:
    b *= 2
    k -= 1
  else:
    break

while k > 0:
  if b > c:
    c *= 2
    k -= 1
  else:
    break
    
if a < b and b < c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
w = list(input())
count_w = list(set(w))

count_number = 0
for i in range(len(count_w)):
  if w.count(count_w[i]) % 2 == 0:
    count_number += 1

print("Yes" if count_number == len(count_w) else "No")
# Judge status: Accepted
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools



sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

A, B =  map(int,input().split())
if(A<=8 and B<=8):
    print("Yay!")
else:
    print(":(")
# Judge status: Wrong Answer
a, b = map(int, input().split())
# intは入力に対しての関数、出力ではない

if (a+b)%3 >= 0:
    print("Possible")
if a%3 >= 0:
    print("Possible")
if b%3 >= 0:
    print("Possible")
else:
    print("Impossible")
# Judge status: Wrong Answer
x = int(input())

ans = x//11*2
x %= 11
if x <= 6:
    ans += 1
else:
    ans += 2

print(ans)
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
num = [0 for i in range(9)]
for i in a:
    if i >= 3200:
        num[8] += 1
    else:
        num[i//400] += 1

zero = num[:8].count(0)
print(max(8-zero,1), end = ' ')
print(8-zero + num[8])
# Judge status: Accepted
S = input()
n = len(S)

length = 0

for s in range(n):
    for e in range(s, n):
        if all("ACGT".count(c)==1 for c in S[s:e+1]):
            length = max(length, e-s+1)

print(length)
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split(' '))

P = sorted(list(map(int, input().split(' '))), reverse=True)[:X]
Q = sorted(list(map(int, input().split(' '))), reverse=True)[:Y]
R = sorted(list(map(int, input().split(' '))), reverse=True)

apples = sorted(P + Q + R, reverse=True)[:X + Y]

print(sum(apples))
# Judge status: Accepted
x = int(input())
ans = 0
ans += 1000 * (x // 500)

x = x % 500
ans += 5 * (x // 5)
print(ans)
# Judge status: Accepted
import sys
import itertools

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    X = list(itertools.accumulate(A))
    Y = sum(A)

    ans = float("inf")
    for i in range(N - 1):
        x = abs(X[i] - (Y - X[i]))
        ans = min(ans, x)

    print(ans)



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

l1 = [500*i for i in range(0, a+1)]
l2 = [100*i for i in range(0, b+1)]
l3 = [50*i for i in range(0, c+1)]

count = 0
for i in l1:
   for j in l2:
      y = x - i - j
      if (y in l3):
         count += 1
print(count)
# Judge status: Accepted
from collections import Counter
N = int(input())
Ac = Counter(list(map(int, input().split())))

ans = []
for k in sorted(Ac.keys())[::-1]:
  if len(ans) == 2:
    break
  if Ac[k] >=4:
    if ans:
      ans.append(k)
    else:
      ans.append(k)
      ans.append(k)
  elif Ac[k] >= 2:
    ans.append(k)
if len(ans) == 2:
  print(ans[0]*ans[1])
else:
  print(0)
# Judge status: Accepted
s = input()
t = input()
s = sorted(s)
t = sorted(t, reverse=True)
if s < t:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s = input()
mr = s[::-1]
n = len(s)
f = 1

if s == mr:
  pass
else:
  f = 0
  
# ------------------------------

s2 = s[:((n-1)//2)]
mr = s2[::-1]

if s2 == mr:
  pass
else:
  f = 0


# ------------------------------
  
s3 = s[((n+3)//2)-1:]
mr = s3[::-1]

if s3 == mr:
  pass
else:
  f = 0
  
if f == 1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,m = map(int,input().split())
x = list(map(int,input().split()))

if n >= m:
    print(0)
    exit()

x.sort()

dists = []
point = x.pop(0)
for xs in x:
    dists.append(xs-point)
    point = xs
dists.sort(reverse=True)

print(sum(dists[(n-1):]))
# Judge status: Accepted
N, M = map(int, input().split())

if N % 2 ==  1:
    for i in range(M):
        print (i + 1, N - 1 - i)
elif N == 4:
    print (1, 2)
else:
    lst = [True] * N

    #奇数の個数
    n = (M + 1) // 2
    for i in range(n):
        print (1 + i, 1 + i + 2 * n - 1 - 2 * i)
    
    #偶数の個数
    m = M // 2
    for i in range(m):
        print (2 * n + 1 + i, 2 * n + 1 + i + 2 * (m - i))
# Judge status: Wrong Answer
from fractions import gcd
n = int(input())
a = [int(i) for i in input().split()]

mx = 0
for i in range(n):
    l = 0
    r = 0
    for j in range(i-1): l = gcd(l, a[j])
    for j in range(i, n): r = gcd(r, a[j])
    mx = max(mx, gcd(l, r))

print(mx)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ca = 0
cb = 0
for aa, bb in zip(a, b):
    if aa < bb:
        cb += (bb - aa)//2
    if bb < aa:
        ca += aa - bb
# print(ca, cb)
if cb <= aa:
    print('Yes')
else:
    print('No')