peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
ans = ''
while n!=0:
    bit = '0'
    if n%2:
        n -= 1
        bit = '1'
    ans = bit + ans
    n//=-2
if ans == '': ans = '0'
print(ans)
# Judge status: Accepted
import collections

n = int(input())
a = list(map(int, input().split()))
count = collections.Counter(a)
ans = sum(a)

q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    diff = (c - b) * count[b]
    count[c] += count[b]
    count[b] = 0
    ans += diff
    print(ans)
# Judge status: Accepted
import itertools
N,M,Q = map(int,input().split())
a = [0]*Q
b = [0]*Q
c = [0]*Q
d = [0]*Q
for i in range(Q):
  a[i],b[i],c[i],d[i] = map(int,input().split())
ans = 0
for A in itertools.combinations_with_replacement(range(1,M+1),N):
  value = 0
  for i in range(Q):
    if A[b[i]-1] - A[a[i]-1] == c[i]:
      value += d[i]
  ans = max(ans,value)
print(ans)
# Judge status: Accepted
X, Y = map(int, input().split())
r = 0
A = X
while True:
    if A > Y:
        break
    A *= 2
    r += 1
print(r)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))


res = a[0]
ans = 0
for i in range(n-1):
  if a[i]-a[i+1]>=0:
    ans += res-a[i+1]
  else:
    res = a[i+1]
    
print(ans)
# Judge status: Accepted
N=int(input())
A=[int(input())for _ in range(N)]
A2=sorted(A,reverse=True)
for i in range(N):
    if A[i]==A2[0]:
        print(A2[1])
    else:
        print(A2[0])
# Judge status: Wrong Answer
H,N = map(int,input().split())
p = []
for i in range(N):
    t = list( map( int, input().split() ) )
    p.append(t)

a = sorted(p, key = lambda x:x[1] , reverse = True)[0][0]
dp = [10**9] * (H+1+a)
dp[0] = 0

for i in range(H+1+a):
    for j in range(N):
        if i-p[j][0] >= 0:
            dp[i] = min(dp[i],dp[i-p[j][0]]+p[j][1])

print(min(dp[H:H+a]))
# Judge status: Accepted
H, A = map(int, input().split())

if H % A == 0:
    ans = H // A
else:
    ans = H // A + 1
    



print(ans)
# Judge status: Accepted
N = int(input())
if 1 <= N < 10:
  print(N)
elif 10 <= N < 100:
  print(9)
elif 100 <= N < 1000:
  print(9 + N - 99)
elif 1000 <= N < 10000:
  print(909)
elif 10000 <= N < 100000:
  print(N - 9999 + 909)
elif N == 100000:
  print(90909)
# Judge status: Accepted
x = int(input())
if x == 1:
    print(0)
else:
    print(1)
# Judge status: Accepted
# -*- coding: utf-8 -*-

N, K = map(int, input().split())

def f(x, n):
    if int(x / n):
        return f(int(x / n), n) + str(x % n)
    return str(x % n)

ans = f(N, K)
print(len(ans))
# Judge status: Accepted
N=int(input())
a=[int(x) for x in input().split()]
Alice=0
Bob=0
for i in range(N):
  if i%2==0:
    Alice=Alice+max(a)
    a.remove(max(a))
  else:
    Bob=Bob+max(a)
    a.remove(max(a))
print(Alice-Bob)
# Judge status: Accepted
base_txt = input()
base_txt_to_P = base_txt.replace("?","P")
base_txt_to_D = base_txt.replace("?","D")
index_count_base_txt_to_P = base_txt_to_P.count("D") + base_txt_to_P.count("PD")
index_count_base_txt_to_D = base_txt_to_D.count("D") + base_txt_to_D.count("PD")
if index_count_base_txt_to_P >index_count_base_txt_to_D:
    print(base_txt_to_P)
else:
    print(base_txt_to_D)
# Judge status: Wrong Answer
n = input()
if n.isupper:
  print("A")
elif n.islower:
  print("a")
# Judge status: Wrong Answer
s = input()
k = int(input())
for i in range(min(k,len(s))):
    if s[i] != 1:
        print(s[i])
        exit()
else:
    print(1)
# Judge status: Accepted
def main():
  A, B, C, K = map(int, input().split())
  if A > K:
    print(K)
  elif A + B >= K:
    print(A)
  else:
  	print(A - (K - A - B))
main()
# Judge status: Wrong Answer
N = int(input())
d = list(map(int, input().split()))

same = N / 2

d.sort()

distribution = [0] * d[len(d) - 1]
total = 0
for di in d:
    num = d.count(di)
    distribution[di - 1] = num

# total = 0
# totals = [0] * d[len(d) - 1]
# num = 0
# for i in range(len(distribution)):
#     total += distribution[i]
#     totals[i] = total

#     if totals[i] == same:
#         num += 1
#     elif num >= 1:
#         break

print(1)
# Judge status: Accepted
n,l = list(map(int,input().split()))
a = [input() for i in range(n)]
b = sorted(a)
print(''.join(b))
# Judge status: Accepted
a,b=map(int,input().split())
def gcd(x,y):
    if x==y:
        return x
    elif x>y:
        r=-1
        while r!=0:
            r=x%y
            x=y
            y=r
        return x
    else:
        r=-1
        while r!=0:
            r=y%x
            y=x
            x=r
        return y

print(a*b//gcd(a,b))
# Judge status: Accepted
import sys
input = sys.stdin.readline

(n, k), s, res, sm = map(int, input().split()), list(map(lambda x: (int(x) + 1) / 2, input().split())), 0, 0
for i in range(n):
	if i < k: sm += s[i]
	else: sm += s[i]; sm -= s[i-k]
	res = max(res, sm)
print(f'{res:.10f}')
# print(f'{max([sum(s[i:i+k]) for i in range(n - k + 1)]):.10f}')
# Judge status: Accepted
s=set(input())
for i in range(97,97+26):
    c=chr(i)
    if not c in s:
        print(c)
        exit()
print('None')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

ans = 'NO'
for n in range(1, b+1):
    if (a*n -1) % b == 0:
        ans = 'YES'
        break
print(ans)
# Judge status: Wrong Answer
a = [(input()) for i in range(2)]
tmp=a[0].split(' ')
tmp_s=a[1].split(' ')
score=[]
for i in range(int(tmp[0])-int(tmp[1])):
  t=1
  for j in range(int(tmp[1])):
    t=t*int(tmp_s[j])
  score.append(t)
for i in range(len(score)-1):
  if score[i]<score[i+1]:
    print('yes')
  else:
    print('no')
# Judge status: Wrong Answer
print("Yes" if input() in "A" else "No")
# Judge status: Accepted
if __name__=='__main__':
	N=int(input())
	happiness=[]
	for i in range(N):
		cost=list(map(int,input().split()))
		happiness.append(cost)
	dp=[[0 for j in range(3)] for i in range(N+1)]
#j:0 is from A, 1 is from B, 2 is from C
	for i in range(N):
		for j in range(3):
			for k in range(3):
				if j != k:
					dp[i+1][k] = max(dp[i+1][k], dp[i][j]+happiness[i][k])
				else:
					continue
			
	print(max(dp[-1]))
# Judge status: Accepted
n,a,b = map(int,input().split(" "))
s = input()
accept = a+b
for i in range(len(s)):
  if s[i] == "c":
    print("No")
  elif accept <= 0:
    print("No")
  elif s[i] == "a":
    print("Yes")
    accept -= 1
  elif s[i] == "b" and b > 0:
    print("Yes")
    b -= 1
    accept -= 1
  else:
    print("No")
# Judge status: Accepted
h, n = map(int, input().split())

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

if h <= sum(a):
    print('Yes')

else:
    print('No')
# Judge status: Accepted
O = input()
E = input()
a = str()
if len(O)==len(E):
    for i in range(len(O)):
        a += O[i] + E[i]
else :
    for i in range(len(O)-1):
        a += O[i] + E[i]
    a += O[-1]
print(a)
# Judge status: Accepted
from collections import defaultdict

N = int(input())
d = defaultdict(int)
A = list(map(int, input().split()))
for a in A:
    d[a] += 1
Q = int(input())
ans = 0
for k, v in d.items():
    ans += k * v
for _ in range(Q):
    B, C = map(int, input().split())
    d[C] += d[B]
    ans -= B * d[B]
    ans += C * d[B]
    del d[B]
    print(ans)
# Judge status: Accepted
N_gyou, M_retu = map(int, input().split())

if (N_gyou == 2 or M_retu == 2):
    ans = 0
elif (N_gyou == 1 and M_retu == 1):
    ans = 1
elif (N_gyou == 1):
    ans = M_retu - 2
elif (M_retu == 1):
    ans = N_gyou - 2
else:
    ans = (N_gyou - 2) * (M_retu - 2)

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline
#input = sys.stdin.readline

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())

def main():
	n=II()
	li=[105,135,165,189,195]
	ans=0
	for i in range(n+1):
		if i in li:
			ans+=1
	print(ans)















if __name__ == "__main__":
	main()
# Judge status: Accepted
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())


ans = 0
commands = [''] * N
for i, t in enumerate(T):
    if t == 'r':
        command = 'p'
        point = P

    elif t == 's':
        command = 'r'
        point = R

    elif t == 'p':
        command = 's'
        point = S

    if (i - K >= 0) and (commands[i -  K] == command):
        command = ''
        point = 0

    ans += point
    commands[i] = command

print(ans)
# Judge status: Accepted
import string
S = input()
K = int(input())
LEN = len(S)
ans = ''
for pos, s in enumerate(S, 1):
    idx = string.ascii_lowercase.find(s)
    if pos < LEN:
        if idx > 0 and 26-idx <= K:
            ans += 'a'
            K -= (26 - idx)
        else:
            ans += s
    else:
        # 残りのKをすべて消費する
        ans += string.ascii_lowercase[(idx + K)%26]

print(ans)
# Judge status: Accepted
import math
n = int(input())
li = []
for i in range(5):
    li.append(int(input()))

if min(li) >= n:
    print(5)
else:
    print(math.ceil(n/min(li)) + 4)
# Judge status: Accepted
A, B = map(int, input().split())

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Wrong Answer
A, B, T = map(int, input().split())

print(int(B/A * T))
# Judge status: Wrong Answer
import numpy as np
n,m = list(map(int, input().split()))
info = list(list(map(int, input().split())) for i in range(m))

info = np.array(info)
p,y = info[:,0],info[:,1]
y[np.argsort(y)] = np.arange(1,m+1)

for num in range(1,n+1):
    filt = (p==num)
    if sum(filt):
        y[filt] -= min(y[filt])-1
for i in range(m):
    print(str(p[i]).zfill(6) + str(y[i]).zfill(6))
# Judge status: Wrong Answer
l,r = map(int, input().split())

def solve(l,r):
    num = float("inf")
    for i in range(l, r):
        current = (i*(i+1)) % 2019
        num = min(num,current)
        if num == 0:
            print(num)
            return
    
    print(num)

solve(l,r)
# Judge status: Accepted
n=int(input())
i=0
pl=list()
while True:
    i=i+1
    if (26*(1-26**(i-1)))/(1-26)+1<=n and n<=(26*(1-26**(i-1)))/(1-26)+26**i:
        break
a=n-(26*(1-26**(i-1)))/(1-26)-1
for l in range (i):
    a,b=divmod(a,26)
    pl.insert(0,(chr(int(b)+97)))
print("".join(pl))
# Judge status: Wrong Answer
import datetime
t = datetime.datetime.strptime("2019/04/30","%Y/%m/%d")
s = datetime.datetime.strptime(input(),"%Y/%m/%d")
print("Heise") if t>=s else print("TBD")
# Judge status: Accepted
n = int(input())
def dfs(s, i):
    if i == n:
        print(s)
    else:
        for j in range(ord("a"), max(map(ord, list(s))) + 2):
            dfs(s + chr(j), i + 1)
dfs("a", 1)
# Judge status: Wrong Answer
S=str(input())
if int(S[5:7])<=4:
  print('HEISEI')
else:
  print('TBD')
# Judge status: Accepted
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
idx=0
m=1000000000
for i in range(n):
    tmp=t-(h[i]*0.006)
    if abs(a-tmp)<m:
        idx=i
        m=abs(a-tmp)
print(idx+1)
# Judge status: Wrong Answer
S,T=map(str,input().split())
A,B=map(int,input().split())
U=str(input())

if "S"=="U":
  print(A-1,B)
else:
  print(A,B-1)
# Judge status: Accepted
n=int(input())
li=list(map(int,input().split()))
dp=[0]*(n)
dp[0]=0
dp[1]=dp[1]+abs(li[1]-li[0])

for i in range(2,n):
  dp[i]=min((dp[i-1]+abs(li[i]-li[i-1])),dp[i-2]+abs(li[i]-li[i-2]))
print(dp[n-1])
# Judge status: Wrong Answer
import collections
def solve():
  n = int(input())
  a = list(map(int, input().split()))
  b = collections.deque()
  for i in range(n):
    if i % 2 == n % 2:
      b.append(a[i])
    else:
      b.appendleft(a[i])
  if n % 2 == 1:
    b.reverse()
  b = map(str, b)
  print(" ".join(b))
  return 0
 
if __name__ == "__main__":
  solve()
# Judge status: Accepted
import fractions
from functools import reduce
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

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

n,m = map(int, input().split())
a = list(map(int, input().split()))
lcm_a = a[0]
for i in a[1:]:
  lcm_a = lcm_a * i // fractions.gcd(lcm_a,i)
  if lcm_a > m * 2:
    print(0)
    exit()
if all([(lcm_a // i) % 2 for i in a]):
  ans = (m - lcm_a // 2) // lcm_a + 1
  print(ans)
else:
  print(0)
# Judge status: Accepted
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
A=Counter(a)
s=set(a)
S=sorted(list(s))
S.reverse()
h=0
w=0
for i in S:
  res=A[i]
  if res>=4:
    if h==0:
      h=i
    if w==0:
      w=i
  elif 2<=res<4:
    if w==0:
      w=i
    elif w!=0 and h==0:
      h=i
print(h*w)
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
b = sorted(a, reverse=True) 
Alice = 0
Bob = 0

for i in range(N):
  if i % 2 == 0:
    Alice += b[i]
  else:
    Bob += b[i]
    
print(Alice - Bob)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

ans = pos = 0
flag = [0] * N
while True:
    #print(pos,a[pos]-1)
    pos = a[pos] - 1
    ans += 1
    if a[pos] == 2:
        ans += 1
        break
    if flag[pos] > 0:
        ans = -1
        break
    else:
        flag[pos] = 1

print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
if (n>=2)and(m>=2):
  print((n-2)*(m-2))
else:
  print(m*n-2)
# Judge status: Wrong Answer
S = input()
c1 = [s in ['R', 'U', 'D'] for s in S[::2]]
c2 = [s in ['L', 'U', 'D'] for s in S[1::2]]
print('Yes' if c1 and c2 else 'No')
# Judge status: Wrong Answer
n = int(input())

a = [[0] * 3 for i in range(n+1)]
dp = [[0] * 3 for i in range(n+1)]

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

for i in range(n):
  for j in range(3):
    for k in range(3):
      if j == k:
        continue
      else:
        dp[i+1][j] = max(dp[i+1][j],dp[i][j]+ a[i][k])
print(max(dp[n]))
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, c, k = map(int, readline().split())
t = [int(readline()) for _ in range(n)]
t.sort()
ans = 1
tmp = [t[0], 0]
for tt in t:
    if tmp[0] + k < tt or tmp[1] + 1 > c:
        ans += 1
        tmp = [tt, 0]
    tmp[1] += 1
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())

nx = x*2
if nx > y:
    print(1)
else:
    i = 2
    while nx*2 <= y:
        nx = nx*2
        i += 1
    print(i)
# Judge status: Wrong Answer
A, V =map(int, input().split())
B, W =map(int, input().split())
T=int(input())

d=abs(B-A)
dv=V-W

if dv<=0:
    print("NO")
elif d%dv !=0 :
    print("NO")
elif d/dv > T-1:
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
N, K = map(int,input().split())
A = sorted(map(int,input().split()))
start = 0
end = A[-1]
l = (start + end)/2
while end - start >= 1:
   l = (start + end)/2
   count = 0
   for i in range(N):
      count += (A[i]-1)//l
   if count > K:
      start = l
   else:
      end = l
print(int(l)+1)
# Judge status: Accepted
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

import itertools

A = [i+1 for i in range(N)]
all_permutation_list = list(itertools.permutations(A))
a = all_permutation_list.index(P)
b = all_permutation_list.index(Q)
print(abs(a - b))
# Judge status: Wrong Answer
s = input()

t_list = ['dreamdream', 'dreamdreamer', 'dreamerase', 'dreameraser', 'dreamerdream', 'dreamerdreamer', 'dreamererase', 'dreamereraser', 'erasedream', 'erasedreamer', 'eraseerase', 'eraseeraser', 'eraserdream', 'eraserdreamer', 'erasererase', 'erasereraser']

if s in t_list:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
unit_price=300

quantity=5

# unit_price:単価/quantity:量
total_price=unit_price*quantity

print(total_price)

print(300*5)
# Judge status: Accepted
sx, sy ,tx, ty = map(int,input().split())
momo=""
xz = abs(tx-sx)
yz = abs(ty-sy)
momo += "U" * yz + "R" * xz + "D" * yz + "L" * xz
momo += "L" * 1 + "U" * (yz+1) + "R" * (xz+1) + "D" * 1
momo += "R" * 1 + "D" * (yz+1) + "L" * (xz+1) + "U" * 1
print(momo)
# Judge status: Wrong Answer
from collections import Counter

n = int(input())
a_L = list(map(int,input().split()))
q = int(input())

L = Counter(a_L)
all_sum = sum(a_L)

print(0)

# ans_L = []
# for i in range(q):
#     b,c = map(int,input().split())
#     if L[b] != 0:
#         diff = (c-b) * L[b]
#         all_sum = all_sum+diff
#         L[c] += L[b]
#     ans_L.append(all_sum+1)


# for i in ans_L:
#     print(i)
# Judge status: Accepted
a, b, c = map(int, input().split())
d = a-b
e = c-d
if e>0:
    print(e)
else:
    print("0")
# Judge status: Accepted
x = int(input())
for i in range(1, 360+1):
    if (x*i)%360 == 0:
        print(i)
        exit()
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
a=sum(L)
flag=True
for i in range(N):
  if a<=2*L[i]:
    flag=False
    break
if flag:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

inf=float('inf')

ans=inf

for b in range(-100,101):
  ch=0
  for i in range(n):
    ch+=(b-a[i])**2
    
  ans=min(ans,ch)
  
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a*b >81:
    print(-1)
else:
    print(a*b)
# Judge status: Wrong Answer
n, q = list(map(int, input().split()))
s =  input()
a = [0]*n

for i in range(1, n):
  if s[i-1] == "A":
    if s[i] == "C":
      a[i] = a[i-1]+1
  else:
    a[i] = a[i-1]

for i in range(q):
  b, c = list(map(int, input().split()))
  print(a[c-1]-a[b-1])
# Judge status: Wrong Answer
a, b = map(int,input().split())
if b >= a:
  a = str(a)
  print(a*b)
else:
  b = str(b)
  print(b*a)
# Judge status: Wrong Answer
N = int(input())
S = input()
answer = 0
for i in range(1,N-1):
  X = S[:i]
  Y = S[i:]
  Z = 0
  for c in 'abcdefghijklmnopqrstuvwxyz':
    if c in X and c not in Y or c in Y and c not in X:
      Z += 1
  answer = max(answer,Z)
print(answer)
# Judge status: Accepted
a, b = map(int, input().split())
if a <= 0 and b >= 0:
  print('Zero')
else:
  if a > 0 and b > 0:
    print('Positive')
  elif a < 0 and b < 0:
    if (b - a) % 2:
      print('Positive')
    else:
      print('Negative')
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
a = []
c = [0,0,0]
for a_i in A:
    cnt = 0
    while a_i % 2 == 0:
        a_i //= 2
        cnt = min(2,cnt+1)
    c[cnt] += 1
    a.append(cnt)

if (c[2] + c[1] // 2) >= (n // 2):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ab.sort(key=lambda x: x[1])
s = 0
for i in ab:
    s += i[0]
    if s > i[1]:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
a,b=map(int,input().split())
if b==1:
	print(0)
else:
	ans=1
	bb=b-a
	while bb>0:
  		bb=bb-(a-1)
  		ans+=1
	print(ans)
# Judge status: Wrong Answer
#---------------
#  argv.py
#---------------
import sys

# コマンドライン引数を変数argsに代入
args = sys.argv

print(args)
# Judge status: Wrong Answer
n=int(input())
print((n/2)*((n+1)/2))
# Judge status: Accepted
k = int(input())

from math import gcd

s = 0
for a in range(1, k+1):
  for b in range(1, k+1):
    g = gcd(a, b)
    for c in range(1, k+1):
      s += gcd(g, c)

print(s)
# Judge status: Wrong Answer
import math
List = input().split()
HP_T = int(List[0])
AT_T = int(List[1])
HP_A = int(List[2])
AT_A = int(List[3])
result = 0

Turn_T = math.ceil(HP_A/AT_T)
Turn_A = math.ceil(HP_T/AT_A)
print(Turn_T, Turn_A)
if Turn_T - Turn_A == 0:
  result = "Yes"  
if Turn_T - Turn_A < 0:
  result = "Yes"
if Turn_T - Turn_A > 0:
  result = "No"

print(result)
# Judge status: Accepted
N, M = [ int(i) for i in input().strip().split(' ') ]
H    = [ int(i) for i in input().strip().split(' ') ]
paths = []
max_neighbor = [ 0 for _ in range(N)]

for _m in range(M):
    path = input().strip().split(' ')
    path = int(path[0]), int(path[1])
    max_neighbor[path[0]-1] = max(max_neighbor[path[0]-1], H[path[1]-1])
    max_neighbor[path[1]-1] = max(max_neighbor[path[1]-1], H[path[0]-1])
count = 0
for n in range(N):
    if max_neighbor[n] < H[n]:
        count += 1
print(count)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a%2==0 or b%2==0:
    print("odd")
else:
    print("Even")
# Judge status: Accepted
N = int(input())

ans = (10 ** N - 2 * (9 ** N) + 8 ** N) % (10 ** 9 + 7)

print(ans)
# Judge status: Wrong Answer
x = int(input())
ans = x // 11 * 2

if x % 11 != 0:
    if x % 11 >= 5:
       ans += 2
    else:
        ans += 1
print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if x in a and y in a or x in b and y in b or x in c and y in c:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = list(map(int, list(input())))
cnt = 0

for i, j in enumerate(n[::-1]):
    if i == len(n) - 1:
        if j < 6:
            cnt += j
        if j > 5:
            cnt += (10 - j) + 1
            
    else:
        if j < 5:
            cnt += j
        if j > 4:
            cnt += (10 - j)
            n[i+1] += 1

print(cnt)
# Judge status: Accepted
from math import gcd
key = int(input())
sin = 0
for i in range(1,key+1):
    for j in range(1,key+1):
        temp = gcd(i,j)
        for m in range(1,key+1):
            sin += gcd(m,temp)
print(sin)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

print(max(min(b, d) - max(a, c), 0))
# Judge status: Accepted
N = int(input(""))
if N <= 999:
    print("ABC")
elif 1000 <= N <= 1998:
    print("ABD")
else:
    print("error")
# Judge status: Accepted
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range(n-m+1) for j in range(n-m+1))
print('Yes' if r else 'No')
# Judge status: Accepted
#白昼夢
s = input()
words = ['dream','dreamer','erase','eraser']
#evaluate
while True:
  for i in range(4):
    if s.endswith(words[i]):
      s = s[:-len(words[i])]
      break #inner loop
  else:
    print('NO')
    break #outerloop
  if not s: 
    print('YES')
    break #outerloop
# Judge status: Accepted
n,m = map(int, input().split())
l,r = 0,n
for i in range(m):
    L,R = map(int, input().split())
    l = max(l,L)
    r = min(r,R)

print(r-l+1 if l<=r else 0)
# Judge status: Accepted
s = int(input())

a = [0,s]
for n in range(2,10**6+1):
  if a[n-1] % 2 == 0:
    an = a[n-1] // 2
  else:
    an = a[n-1] * 3 + 1
  
  if an in a:
    m = n
    break
  
  a.append(an)
  
print(m)
# Judge status: Wrong Answer
N=int(input())
A=int(input())
if N%500<A:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())
l=[[] for i in range(n)]
l[0]=[[0]]
for i in range(n-1):
  for j in l[i]:
    for k in range(max(j)+2):
      l[i+1].append(j+[k])

for i in range(len(l[n-1])):
  for j in range(n):
    print(chr(l[n-1][i][j]+97), end="")
  print()
# Judge status: Wrong Answer
s1 = input()
s2 = input()

for i in range(len(s1)):
  count = 0
  if s1[i] != s2[i]:
    count += 1
    
print(count)
# Judge status: Accepted

def B():
    k = int(input())
    s = input()
    if k<len(s):
        print(s[:k] + "...")
    else:
        print(s)
    
B()
# Judge status: Wrong Answer
import math
n, d = map(int, input().split())

print(math.ceil(n/(d*2)))
# Judge status: Wrong Answer
s=input()
s.split()
d={}
for i in s.split():
    d[i]=1
print(len(d)-1)
# Judge status: Accepted
mod = 7+10**9
def ncr(n,c,mod):
  x = 1
  y = 1
  for i in range(n-c+1,n+1):
    x = x*i%mod
  for j in range(1,c+1):
    y = y*j%mod
  return (x * pow(y, mod-2, mod)) % mod

X, Y = map(int, input().split())
if (X+Y) % 3 != 0:
  print(0)
  exit()

n = (2*Y-X) // 3
m = (2*X-Y) // 3
if n < 0 or m < 0:
  print(0)
  exit()

ans = ncr(n+m,n,mod)
print(ans)
# Judge status: Wrong Answer
a,b,c=list(map(int,input().split()))
print(a*b/2)
# Judge status: Accepted
N=int(input())

def num2alpha(num):
    if num<=26:
        return chr(96+num)
    elif num%26==0:
        return num2alpha(num//26-1)+'z'
    else:
        return num2alpha(num//26)+chr(96+num%26)
print(num2alpha(N))
# Judge status: Wrong Answer
n = int(input())
can_tax = False
for i in range(1, n):
  if round(i * 1.08) == n:
    x = i
    can_tax = True
    
if can_tax:
  print(x)
else:
  print(":(")
# Judge status: Accepted
num = list(map(int,input().split()))
K = int(input())
num.sort()
for i in range(K):
    num[-1] = num[-1]*2

print(sum(num))