peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
h = int(input())
count = 0
ans = 1
while h >1:
    h //= 2
    count += 1
    ans += 2**count
print(ans)
# Judge status: Accepted
def resolve():
    A, s, C = input().split()
    print(A[0]+s[0]+C[0])

resolve()
# Judge status: Wrong Answer
n = int(input())
s = list(input())
ans = 0
for i in range(n-1, 0, -1):
    if s[i] == '.' and s[i-1] == '#':
        ans += 1
        s[i] = '#'
print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    abc = [list(map(int,input().split())) for _ in range(N)]
    abc.insert(0,[0,0,0])
    dp = [[0]*3 for _ in range(N+1)]
    for i in range(1,N+1):
        for j in range(3):
            for k in range(3):
                if j != k:
                    dp[i][j] = max(dp[i][j],dp[i-1][k]+abc[i][j])
    print(max(dp[N]))


if __name__ == '__main__':
    main()
# Judge status: Accepted
#!/usr/bin/env python3
l, r, d = map(int, input().split())
print(r // d - (l - 1) // d)
# Judge status: Wrong Answer
num = int(input())

ext = num%10
if ext == 2 or ext == 4 or ext == 5 or ext == 7 or ext == 9:
  print("hon")
if ext == 3:
  print("bon")
else:
  print("pon")
# Judge status: Wrong Answer
A,B = map(int, input().split())

if A>=13:
    print(B)
elif A>=6:
    print(B/2)
else:
    print(0)
# Judge status: Accepted
n=int(input())
h=list(map(int,input().split()))
maximum=h[0]
ans="Yes"
for i in range(1,n):
  maximum = max(maximum,h[i])
  if h[i]+1<maximum:
    ans="No"
    break
print(ans)
# Judge status: Wrong Answer
sum1 = 0
i = 1
while i <=3:
    a,b,c = map(int,input().split())
    sum1 += a+b+c
    i +=1
    
if sum1%3 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a, b, c, x = map(int, [input() for i in range(4)])
cnt = 0
for a in range(a+1):
    for b in range(b+1):
        for c in range(c+1):
            if 500*a + 100*b + 50*c == x:
                cnt += 1
                print(cnt)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
while(a>0 and c>0):
    c-=b
    if(c<=0):
        print("Yes")
        break
    a-=d
    if(a<=0):
        print("No")
        break
# Judge status: Wrong Answer
n=int(input())
ans=[]
if n==1:
    print(1)
else:
    for i in range(1,10**6):
        if i>=n:
            break
        elif n%i==0:
            ans.append(i+(n//i))
    print(min(ans)-2)
# Judge status: Accepted
N,C,K=map(int,input().split())
T=sorted([int(input()) for i in range(N)])
lt=T[0]+K
m=0
b=0
for t in T:
    if lt>=t and m<C:
        m+=1
    else:
        m=1
        b+=1
        lt=t+K
if m>=1:
    b+=1
print(b)
# Judge status: Accepted
import math

n = int(input())
folia = list(map(int, input().split()))
#print(n, folia)

seq = [[folia[-1], folia[-1]]]

for i in range(n): # 深さ'n'分
    tmp = folia[-(i+2)]
    sml = math.ceil(seq[i][0] / 2) + tmp 
    big = seq[i][1] + tmp
    seq += [[sml, big]]
#print(seq)

if not (seq[-1][0] <= 1 <= seq[-1][1]):
    print(-1)
    exit()

ans =[1]
for j in range(n): # 深さ'n'分
    tmp = min((ans[j] - folia[j]) * 2, seq[-(j+2)][1])
    ans.append(tmp)
print(sum(ans))
# Judge status: Wrong Answer
N = int(input())
S = input()

wl = 0
for i in range(N):
  if S[i] == "W":
    wl += 1

rl = N - wl
    
l = 0
if N % 2 == 0:
  for i in range(N//2):
    if S[i] == "W":
      l += 1
else:
  for i in range(N//2):
    if S[i] == "W":
      l += 1

print(min([wl, rl, l]))
# Judge status: Accepted
import math
N = int(input())
flag = True
for i in range(1,50001):
    if N == math.floor(i*1.08):
        print(i)
        flag = False
        break
if flag:
    print(':(')
# Judge status: Wrong Answer
n, k = map(int, input().split())
s = []
prev = "-"
cnt = 0
for i in input():
    if prev!=i:
        s.append(cnt)
        cnt = 0
    else:
        cnt += 1
    prev = i
s.append(cnt)
ans = sum(s)
if len(s)-1==k+1: ans -= 1
elif len(s)-1<=k: ans -= 2
print(ans + 2*min(k, len(s)))
# Judge status: Accepted
n,k=map(int,input().split())
x=list(map(int,input().split()))
ans=10**9

for i in range(n-k+1):
    st=x[i]
    ed=x[i+k-1]
    
    if ed<=0:
        ans=min(ans,abs(st))
    elif st>=0 and ed>=0:
        ans=min(ans,ed)
    else:
        t=(min(abs(st),ed)*2)+max(abs(st),ed)
        ans=min(t,ans)

print(ans)
# Judge status: Accepted
S = input()
K = int(input())

for i in range(len(S)):
    if S[i] != "1":
        print(S[i])
        break
    else:
        if i == K - 1:
            print("1")
            break
# Judge status: Wrong Answer
a, b = map(int, input().split())
temp = 0
bar_heights = []
for i in range(1, 1000):
    temp += i
    bar_heights.append(temp)

for i in range(1, 499501):
    if (a + i) in bar_heights and (b + i) in bar_heights:
        print(i)
        break
# Judge status: Accepted
H,A=map(int,input().split())

a=0

while H>0:
  H=H-A
  a+=1
  
print(a)
# Judge status: Accepted
x = int(input())
if x==0:
    print(1)
else:
    print(0)
# Judge status: Accepted
import math

number_of_people = int(input())
minutes = [int(input()) for i in range(5)]

minimum_throughput = min(minutes)
total_elapsed_minute = 4 + math.ceil(number_of_people / minimum_throughput)

print(total_elapsed_minute)
# Judge status: Accepted
s = input()

print("Yes" if len(s.replace("hi","")) == 0 else "No")
# Judge status: Accepted
# coding: utf-8
# Your code here!

n = int(input())
num_list = list(map(int, input().split()))
sum=1

if 0 in num_list:
    print(0)
    exit()

for i in num_list:
    
    if i==0:
        print(0)
        exit()
    i=str(i)
    sum=str(sum)
    
    if len(i)+len(sum)>21:
        print(-1)
        exit()
    i=int(i)
    sum=int(sum)
    sum=sum*i
    if sum>10**18:
        print(-1)
        exit()
print(sum)
# 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
a, b = map(int,input().split())

print(a*b)
# Judge status: Accepted
word = input()
if word == 'a':
    print('vowel')
elif word == 'i':
    print('vowel')
elif word == 'u':
    print('vowel')
elif word == 'e':
    print('vowel')
elif word == 'o':
    print('vowel')
else:
    print('consonant')
# Judge status: Wrong Answer
import numpy as np

N=int(input())
A=np.array([int(x) for x in input().split()])

ans=0
M=pow(10,9)+7
for i in range(100):
  one=np.sum((A>>i)&1)
  zero=N-one
  ans+=(one*zero)*pow(2,i)
  #ans%=M
  #print(one,zero)
print(ans%M)
# Judge status: Accepted
n,m=map(int,input().split())
s=[]
S=[]
for i in range(m):
    l,r=map(int,input().split())
    s.append(l)
    S.append(r)

if max(s)<=min(S):
    print(min(S)-max(s)+1)
else:
    print('0')
# Judge status: Accepted
x = int(input())
for i in range(400):
  for j in range(400):
    ii = i - 200
    jj = j - 200
    if ii**5 - jj**5 == x:
      print(ii,jj)
      exit()
assert false, "final"
# Judge status: Accepted
n,m=list(map(int,input().split()))
p=[]
for i in range(n):
  a=list(map(int,input().split()))
  p.append(a)
p.sort(key=lambda x:x[0])
num=0
ans=0
i=0
while num<m:
  ans=ans+p[i][0]*p[i][1]
  num=num+p[i][1]
  
  i=i+1
  
print(ans-(-m+num)*p[i-1][0])
# Judge status: Wrong Answer
N=int(input())
d=[int(s) for s in input().split(" ")]

d.sort()

if (N//2)%2==0:
    print(0)
else:
    K=d[(N//2)]-d[(N//2)-1]
    print(K)
# Judge status: Wrong Answer
n,k = map(int,input().split())
arr = [int(i) for i in input().split()]
dp = [float("inf") for j in range(n)]
dp[0] = 0
for i in range(n):
    dp[i] = float("inf")
    for j in range(i+1,i+k+1):
        if j < n:
            val = (abs(arr[i]-arr[j]) + dp[i]) 
            dp[j] = min(dp[j],val)
print(dp[n-1])
# Judge status: Accepted
#!/usr/bin python3
# -*- coding: utf-8 -*-

k = int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    ret = 1
    res = 7%k
    while res != 0:
        res = (res * 10 + 7) % k
        ret += 1
    print(ret)
# Judge status: Accepted
import numpy as np
w,h,n=map(int,input().split())
ans=np.ones((h,w),dtype=np.int)
for _ in range(n):
    x,y,a=map(int,input().split())
    if a == 1:
        ans[:,:x]=0
    elif a == 2:
        ans[:,x:]=0
    elif a ==3:
        ans[:y,:]=0
    else:
        ans[y:,:]=0
print(np.count_nonzero(ans))
# Judge status: Accepted
n, m = map(int, input().split())
ans = 0
if 2 * n <= m:
    ans += n
    m -= 2 * n
    ans += m // 4
else:
    ans += m // 2
print(ans)
# Judge status: Accepted
def myAnswer(a:int,b:int,c:int) -> str:
   A = ( a + b - c) ** 2
   B = 4 * a * b

   return "Yes" if( A - B > 0 and (c - a - b) > 0) else "No"

def modelAnswer():
   return
def main():
   a,b,c = map(int,input().split())
   print(myAnswer(a,b,c))

if __name__ == '__main__':
   main()
# Judge status: Accepted
k = int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    ans = 1
    res = 7
    while True:
        if res%k == 0:
            print(ans)
            break
        res = res*10+7
        res %= k
        ans += 1
# Judge status: Accepted
s = input()

s_1 = int(s[0:2])
s_2 = int(s[2:4])

if (s_1>12 or s_1<1) and (s_2>12 or s_2<1):
    print('NA')
elif s_1<=12 and s_1>=1 and s_2<=12 and s_2>=1:
    print('AMBIGUOUS')
elif s_1<=12 and s_1>=1:
    print('MMYY')
else:
    print('YYMM')
# Judge status: Accepted
a,b,x = list(map(int, input().split()))
print(b//x  - (a-1)//x)
# Judge status: Wrong Answer
s = list(set(input()))
print(s[-1]*3)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    L = list(map(int, input().split()))

    max_L = max(L)
    sum_L = sum(L)
    if max_L < sum_L - max_L:
        ans = "Yes"
    else:
        ans = "No"

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,x=map(int,input().split())
s=list(map(int,input().split()))
b,c=0,0
while b<=x and len(s)>0:
    c+=1
    b+=s[0]
    del s[0]
print(c)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
c = (10 ** 5 + 1) * [0]

for i in range(N):
  c[A[i]] += 1
  if A[i] > 0:
    c[A[i] - 1] += 1
  if A[i] < 10 ** 5:
    c[A[i] - 1] += 1

print(max(c))
# Judge status: Accepted
a,b,x=map(int,input().split())
a-=1
c=(a-a%x)//x
d=(b-b%x)//x
print(d-c)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
m = 0
res = []
# 1 idx
for i in range(n, 0, -1):
    # i の倍数でbit立っているものの個数を数える
    cnt = 0
    idx = 2
    while i * idx <= n:
        if ans[i * idx - 1]:
            cnt += 1
        idx += 1
    debug = cnt
    if cnt % 2 != a[i - 1]:
        ans[i - 1] = 1
        m += 1
        res.append(i)
print(m)
if m:
    print(*res)
# Judge status: Accepted
N=int(input())

xlist=[1]
for d in range(1,10**9):
  if 6**d>100000:
    break
  xlist.append(6**d)
for d in range(1,10**9):
  if 9**d>100000:
    break
  xlist.append(9**d)
xlist.sort()
#print(xlist)

dp=[0]*(N+1)
for i in range(1,N+1):
  min_dp=10**9
  for x in xlist:
    if i-x<0:
      break
    min_dp=min(min_dp,dp[i-x])
  dp[i]=min_dp+1
  
#print(dp)
print(dp[-1])
# Judge status: Accepted
N, M, X = map(int, input().split())
books = [list(map(int, input().split())) for _ in range(N)]

p = []

for i in range(1, 2**N):
    buff = [0] * (M + 1)

    for j in range(N):
        if i >> j & 1:
            buff = [a + b for a, b in zip(buff, books[j])]

    for a in buff[1:]:
        if a < X:
            break
    else:
        p.append(buff[0])

if len(p) > 0:
    ans = min(p)
else:
    ans = -1

print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
X=list(map(int,input().split()))
answers=[]
whole=0
for n in range(N-K+1):
    if X[K-1+n]>0 and X[n]<0:
        whole += (X[K - 1 + n] - X[n])
        whole+=min(X[K-1+n],-X[n])
    elif X[K-1+n]<0:
        whole-=X[n]
    elif X[n]>0:
        whole+=X[K-1+n]
    answers.append(whole)
    whole=0
print(min(answers))
# Judge status: Wrong Answer
s = str(input())[-1]
if s == '3':
  print('hon')
elif s in ['0','1','6','8']:
  print('pon')
else:
  print('pon')
# Judge status: Wrong Answer
s = open(0).read()
print("x" * len(s))
# Judge status: Accepted
from sys import stdin
import sys
import math

n = int(input())
a = list(map(int, stdin.readline().rstrip().split()))

dict_count = {}
for i in a:
    dict_count[i] = 0

for j in a:
    dict_count[j] += 1

#print(dict_count)

max_count = 0

for key in dict_count.keys():
    max_count = max(max_count, dict_count.get(key - 1, 0) + dict_count.get(key, 0) + dict_count.get(key + 1, 0))

print(max_count)
# Judge status: Wrong Answer
N = int(input())
S = [str(input()) for _ in range(N)]

S = list(S)

for i in range(N):
    for j in range(i,N-1):
        if S[i] == S[j+1]:
            N = N - 1

print(N)
# Judge status: Accepted
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(string):
    n, m, *a = map(int, string.split())
    c = 2**len(bin(a[0]).split("1")[-1])
    l = reduce(lcm, (2 * m + 1 if _a % c or not _a // c % 2 else _a for _a in a))
    return str(max((m - l // 2) // l + 1, 0))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# Judge status: Accepted
A, B =  map(int, input().split())
print((-(-(B-A)//(A-1)))+1)
# Judge status: Wrong Answer
n=int(input())
x=[]
for _ in range(n):
    a,b=map(int,input().split())
    x.append([a,b,b-a])
 
x.sort(key=lambda x:(x[2],x[1]))
t=0
ans='Yes'
for i in range(n):
    if t<=x[i][2]:
        t+=x[i][0]
    else:
        ans='No'
        break
print(ans)
# Judge status: Wrong Answer
N=int(input())
C=0
for i in range(1,N):
  if i**2<=N:
    C=i**2
  elif i**2>N:
    break
print(C)
# Judge status: Accepted
N = int(input())

checkpoint = 0
summation = 0

for i in range(1, N+1):
    checkpoint = i
    summation = summation + checkpoint
    if summation >= N:
        break

unn = summation - N
for a in range(1, checkpoint+1):
    if a != unn:
        print(a)
# Judge status: Wrong Answer
x,y,z = map(int,input().split())
i = 1
while(y+z*2+(z+y)*i < x):
    i += 1
print(i)
# Judge status: Accepted
N = int(input())
S = input()

result = S
while True:
    while True:
        t = S.replace('()', '')
        if t == S:
            break
        S = t
    if S == '':
        break
    elif S[0] == ')':
        S = '(' + S
        result = '(' + result
    elif S[0] == '(':
        S = S + ')'
        result = result + ')'
print(result)
# Judge status: Wrong Answer
#!/usr/bin/env python3
S, C = map(int, input().split())
ret = 0
if 2 * S <= C:
    ret += S
    C -= 2 * S
    S = 0

ret += C // 4
print(ret)
# Judge status: Accepted
s = input()

cnt = 1
pre = s[0]
i = 1
while i < len(s):
    if i == len(s)-1 and s[i] == pre:
        break
    elif s[i] == pre:
        pre = s[i:i+2]
        i += 2
        cnt += 1
    else:
        pre = s[i]
        i += 1
        cnt += 1

print(cnt)
# Judge status: Accepted

s = "abcdefghijklmnopqrstuvwxyz"

def fA(N):
  if N <= 26: return s[N-1]
  a = (N-1) // 26
  b = N % 26

  return fA(a) + fA(b)

N = int(input())
print(fA(N))
# for N in range(710):
#   print(N, fA(N))
# Judge status: Accepted
n,m,x,y=map(int,input().split())
xx=list(map(int,input().split()))
yy=list(map(int,input().split()))
mx=max(xx)
my=min(yy)
if mx>=my:
  print("War")
elif mx>=y or x>=my:
  print("War")
else:
  print("No War")
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(n - 1):
    if p[i] == i+1:
        ans += 1
        if p[i+1] == i+2:
            ans -= 1
if p[n-1] == n:
    ans += 1

print(ans)
# Judge status: Accepted
c = str.lower(input())
n = ('a', 'e', 'i', 'o', 'u')

if c in n:
    print('vowel')
else:
    print('consonant')
# Judge status: Wrong Answer
s = str(input())
alphabet = ["a","b","c","d","e","f"
,"g","h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x","y","z"]

for i in s:
    if i in alphabet:
        alphabet.remove(i)
if len(alphabet)!=0:
    print(alphabet[0])
else:
    print("Nome")
# Judge status: Accepted
# Problem B - A to Z String

# input process
s = input()
s_len = len(s)

# initizalization
a_pos = 0
z_pos = 0

# first a search
for i in range(s_len):
    a = s[i]
    if a=='A':
        a_pos = i
        break

# second z search
for i in range(s_len):
    z = s[i]
    if z=='Z':
        z_pos = i

print(z_pos - a_pos + 1)
# Judge status: Wrong Answer
n = int(input())
print(1000-n%1000)
# Judge status: Accepted
S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")
# Judge status: Wrong Answer
def main():
    sx, sy, tx, ty = map(int, input().split())

    ans = ''
    ans += 'R' * (tx - sx - 1) + 'U' * (ty - sy) + 'R'
    ans += 'D' * (ty - sy + 1) + 'L' * (tx - sx) + 'U'
    ans += 'U' * (ty - sy + 1) + 'R' * (tx - sx) + 'D'
    ans += 'R' + 'D' * (ty - sy + 2) + 'L' * (tx - sx + 2) + 'UUR'

    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
# Judge status: Accepted
x,y,z = map(int,input().split())
print(z,x,y)
# Judge status: Accepted
n = int(input())
s = input()
ans = 0
mans = 0

for i in range(n):
    if s[i] == "I":
        ans += 1
        mans = max(mans, ans)
    else:
        ans -= 1

print(mans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

subtotal = sum(b)
bonus = 0

for i in range(n - 1):
    if a[i + 1] - a[i] == 1:
        bonus = bonus + c[a[i] - 1]

total = subtotal + bonus
print(total)
# Judge status: Accepted
A,B,C=map(int,input().split())
if A+B>=C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = list(map(int,input().split()))
if(sum(a) == 17 and 7 in a):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
def solution(K: int) -> int:
    sevens: int = 0
    for i in range(1, K + 1):
        sevens = (sevens*10 + 7) % K
        if sevens == 0:
            return i
    return -1


K: int = int(input())

print(solution(K))
# Judge status: Accepted
a,b,c=1,0,0
exec('a,b,c=b,c,a+c;'*int(input()))
print(a%(10**9+7))
# Judge status: Accepted
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

I = list(map(int, input().split()))
I.sort(reverse=True)
print(I[0] * 10 + sum(I[1:3]))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.sort()

ans=0
lastnum=a[0]
cnt=1
for num in a[1:]:
    if num==lastnum:
        cnt+=1
    else:
        ans+=min(cnt,abs(cnt-lastnum))
        cnt=1
    lastnum=num
ans+=min(cnt,abs(cnt-lastnum))
print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3

# input
n, k = map(int, input().split())
d = [-1 for _ in range(k)]
A = [[] for _ in range(k)]
for i in range(k):
    d[i] = int(input())
    A[i] = list(map(int, input().split()))

# calc
okashi = [0 for _ in range(n)]
for i in range(k):
    for j in range(d[i]):
        okashi[j] += 1

ans = 0 
for i in range(len(okashi)):
    if okashi[i] == 0:
        ans += 1
print(ans)
# Judge status: Accepted
import collections

n = int(input())
KeyLst = ('AC','WA','TLE','RE')
resultLst = (str(input()) for _ in range(n))
countedDic = collections.Counter(resultLst)
for key in KeyLst:
  print('{} x {}'.format(key,countedDic[key]))
# Judge status: Accepted
import math
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
l = 0 
h = a[0]
def pos(b):
  c = 0
  for i in range(n):
    if a[i] <= b:
      break
    c += math.ceil(a[i]/b)-1
    if c > k:
      return False
  return True
while l+1 < h:
  m = (l+h)//2
  if pos(m):
    h = m
  else:
    l = m
print(h)
# Judge status: Accepted
D, N = map(int, input().split())

def calc(n):
    count = 0
    while n % 100 == 0:
        count += 1
        n /= 100
    return count

count = 0
val = 0
while count < N:
    val += 1
    if calc(val) == D:
        count += 1

print(val)
# Judge status: Accepted
S = input()
tmp = []
ans = "yes"

for i in range(len(S)):
  if (S[i] in tmp):
    ans = "no"
    break
  else:
    tmp.append(S[i])
print(ans)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
*A, = map(int, input().split())
A = [a-1 for a in A]

path = []
visited = {}


def dfs(v, k):
    if v in visited:
        return v

    visited[v] = k
    path.append(v)
    return dfs(A[v], k+1)


origin = dfs(0, 0)
i = visited[origin]
loop = path[i:]


if K <= i:
    print(path[K] + 1)
else:
    j = (K - i) % len(loop)
    print(loop[j] + 1)
# Judge status: Accepted
#!/usr/bin/env python3

#(a^b) % (1e9 + 7)を求める
def powmod(a, b):
    result = 1;
    for i in range(b):
        result *= a
        result %= 1e9 + 7
    return result


n = int(input())

if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    # print(10 ** n - 2 * (9 ** n) + 8 ** n)
    r = powmod(10, n) - 2 * powmod(9, n) + powmod(8, n)
    r = int(r % (1e9 + 7))
    print(r)
# Judge status: Accepted
A,B = map(int,input().split())
print(A*B if A <= 9 and B <= 9 else -1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
x = 0
y = 0
z = 0
for i in range(n):
    if a[i]%4 == 0:
        x += 1
    elif a[i]%2 == 0:
        y += 1
    else:
        z += 1
if y == 0:
    if x+1 >= z:
        print("Yes")
    else:
        print("No")
else:
    if x >= z:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
N, Y = map(int, input().split())
a = 0
b = 0
c = 0
for i in range(N+1):
    for j in range(N+1):
        if 10000*i + 5000*j + 1000*(N-i-j) == Y and N-i-j>=0:
            a = i
            b = j
            c = N-i-j
if a == 0 and b == 0 and c == 0:
    print(-1,-1,-1)
else:
    print(a,b,c)
# Judge status: Accepted
S = str(input())

if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
else:
    print(1)
# Judge status: Accepted
import sys
import os
import re
import datetime

card = {}

N = int(input())
for _ in range(N):
	s = input()
	if s in card:
		card[s] += 1
	else:
		card[s] = 1
		
M = int(input())
for _ in range(M):
	t = input()
	if t in card:
		card[t] -= 1
	else:
		card[t] = -1

maxCount = 0
#print(card)
for count in card:
	maxCount = max(maxCount, max(card.values()))

print(maxCount)
# Judge status: Wrong Answer
S = input()
odd = S[1::2]
even = S[::2]
print(min(odd.count("1") + even.count("0"), even.count("1") + odd.count("0")))
# Judge status: Accepted
A, B = map(int, input().split())

if A == B:
    print('Draw')
elif B!=1 and A>B or A==1:
    print('Alice')
else:
    print('Bob')
# Judge status: Wrong Answer
import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)

from fractions import gcd


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n, m = geta(int)
    a = tuple(geta(int))

    g = a[0] // 2
    for ai in a[1:]:
        ai2 = ai // 2
        g = (g * ai2) // gcd(g, ai2)

    print((m + g) // (g * 2))


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
scores = []
for i in range(N):
  scores.append(list(map(int, input().split())))
D = scores[0]
for day in range(1, N):
  D = [max(D[:i] + D[i+1:]) + scores[day][i] for i in range(len(D))]

print(max(D))
# Judge status: Accepted
N, M, K = map(int, input().split())
f = 0
for i in range(0, N+1):
  if N == 2 * i:
    if K == i * M:
      print("Yes")
      f = 1
      break
  elif (K - i * M) % (N - 2 * i) == 0 and 0 <= (K - i * M) // (N - 2 * i) <= M:
    print("Yes")
    f = 1
    break
if f == 0:
  print("No")
# Judge status: Accepted
x, y, z = map(int, input().split())
i = 1

while True:

	if x < (i * y) + ((i + 1) * z):
		print(i-1)
		exit()

	i += 1