peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
s = set()
word = input()
s.add(word)
tmp = word[-1]
is_ng = False
for i in range(N-1):
    word = input()
    if word[0] != tmp:
        is_ng = True
        break
    if word in s:
        is_ng = True
        break
    tmp = word[-1]
    s.add(word)
print('YNeos'[is_ng::2])
# Judge status: Accepted
# -*- coding: utf-8 -*-
import heapq

a,b,c = map(int, input().split())
l = [a,b,c]
l2 = heapq.nsmallest(3, l)
if (l2[0] + l2[1]) == max(l):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
from collections import deque
S = input()
Q = int(input())
li = []
for i in range(Q):
    li.append(list(input().split()))
flag = False
sq = deque(S)
for i in range(Q):
    if li[i][0] == "1":
        flag = not flag
    else:
        if (li[i][1] == "1" and not flag) or (li[i][1] == "2" and flag):
            sq.appendleft(li[i][2])
        else:
            sq.append(li[i][2])
sq = list(sq)
if flag:
    sq.reverse()
for i in range(len(sq)):
    print(sq[i], end="")
# Judge status: Accepted
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

#X = str(raw_input()).split()
AB = str(raw_input()).split()
A = int(AB[0])
B = int(AB[1])

ans = A * B / gcd(A,B)

print(ans);
# Judge status: Wrong Answer
import bisect

n = int(input())
l = list(map(int,input().split()))

l.sort()
a = sorted(list(set(l)))
ans = 0

for b in range(n - 2):
    for c in range(b + 1,n - 1):
        left = bisect.bisect_left(a,l[c] + l[b])
        ans+=left - c - 1

print(ans)
# Judge status: Accepted
s = int(input())
n = s // 3
cnt = [0] * n

import math
def comb(x, y):
    return math.factorial(x) // (math.factorial(x - y) * math.factorial(y))

for i in range(1, n + 1):
    rem = s - 3 * i
    cnt[i - 1] = comb(rem + (i - 1), i - 1)

print(sum(cnt) % (10**9 + 7))
# Judge status: Accepted
# ABC 145: A – Circle
print(int(input()) ** 2)
# Judge status: Wrong Answer
n,k = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]

if len(x) == 1:
    print(abs(0-x[0]))
else:
    ans = 10 ** 8
    for i in range(n-k):
        tmp = min(abs(x[i]), abs(x[i+k-1]))
        ans = min(ans,tmp+abs(x[i+k-1]-x[i]))
    print(ans)
# Judge status: Accepted
S = input()
FLG = True

for i,step in enumerate(S):
    if step in "UD":
        continue
    if step == "L" and i % 2 == 0:
        FLG = False
        break
    if step == "R" and i % 2 == 1:
        FLG = False
        break

if FLG:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
num1=abs(a-b)
if v<=w:
    print("NO")
else:
    num2=v-w
    num3=num1/num2
    if num3<=t:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
A=list(map(int,input().split()))
print("bust" if sum(A)>=22 else "win")
# Judge status: Accepted
X = int(input())
# dp[i]:= ちょうどi円となる買い物が存在するorしない
dp = [0] * (X+1)
dp[0] = 1
for i in range(X):
    if dp[i] == 1:
        for next in [100,101,102,103,104,105]:
            if i+next<=X:
                dp[i+next] = 1
print(dp[X])
# Judge status: Wrong Answer
n = int(input())
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort()
a, b = map(list, zip(*ab))
a.sort()
b.sort(reverse=True)
a1, b1 = a[n//2], b[n//2]
a2, b2 = a[n//2-1], b[n//2-1]
ans = b1 - a1 + 1 if b1 >= a1 else 0
if n % 2 == 0:
    ans += int((b1+b2)/2 - (a1+a2)/2)
    if (b1+b2)%2 or (a1+a2)%2: ans += 1

print(ans)
# Judge status: Accepted
#%%
N, L = map(int, input().split())

aji = [L+i-1 for i in range(1, N+1)]

total = sum(aji)

if aji[0] <= 0 and 0 <= aji[-1]:
    ans = total
elif aji[-1] < 0:
    ans = total - aji[-1]
else:
    ans = total - aji[0]

print(ans)
# Judge status: Wrong Answer
a, b, c, k = list(map(int, input().split()))
if k<=b:
  print(k)
elif b<k<=b+a:
  print(b)
else:
  print(2*b-k+a)
# Judge status: Accepted
x,y,a,b=map(int,input().split())
a=a-x ; b=b-y 

ans="R"*a + "U"*b + "L"*a + "D"*(b+1) + "R"*(a+1) + "U"*(b+1) + "L"
ans+="U" + "L"*(a+1) + "D"*(b+1) + "R"
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt = 0
for n1, i in enumerate(a):
    if n1 % 2 == 0:
        if i % 2 == 1:
            cnt += 1
print(cnt)
# Judge status: Accepted
S = input()

if(S.endswith('s')):
        print(S+'es')
else:
        print(S+'s')
# Judge status: Accepted
import itertools
N, K = map(int, input().split())
t = 0
for i in range(K,N+2):
    st = int((i*(0+i-1))/2)
    ed = int((i*(N-i+N+1))/2)
    t += (ed - st + 1)
    t %= 10**9 + 7
print(t)
# Judge status: Accepted
H = int(input())
n = 0
while 2**n <= H:
    n += 1
print(2**n-1)
# Judge status: Wrong Answer
#基準曜日の取得
S = input()

# 入力された内容をもとに次の日曜日までの日数を表示
if S == "SUT":
  print(1)
elif S == "FRI":
  print(2)
elif S == "THU":
  print(3)
elif S == "WED":
  print(4)
elif S == "TUE":
  print(5)
elif S == "MON":
  print(6)
elif S == "SUN":
  print(7)
else:
  print("入力内容が間違っています。")
# Judge status: Accepted
st = input()
s = ["x" for i in range(len(st))]
print("".join(s))
# Judge status: Accepted
N = input()

if N[0] == '7' or N[1] == '7' or N[2] == '7':
  print("Yes")
else:
  print("No")
# Judge status: Accepted
from numpy import*;f=gcd.outer;r=range(1,int(input())+1);print(sum(f(f(r,r),r)))
# Judge status: Accepted
a, b = map(int, input().split())

a1 = a * str(b)
a2 = b * str(a)
print(min(a1, a2))
# Judge status: Wrong Answer
S=input()
S=S.replace('dreamer','')
S=S.replace('aser','')
S=S.replace('ace','')
S=S.replace('eraser','')
S=S.replace('erase','')
S=S.replace('dream','')
if S=='':
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n = input()

s = "abcdefghijklmnopqrstuvwxyz"

if n in s:
  print("a")
else:
  print("A")
# Judge status: Wrong Answer
N=int(input())
listL=list(map(int,input().split()))
listL.sort()
ans=0
for i in range(N-1,2,-1):
  for k in range(i-1,1,-1):
    t=k//2
    d=listL[i]-listL[k]
    while (d-listL[t]<=0 or d-listL[t-1]>0) and t!=0 and t!=k-1:
      third=listL[t]
      if d-third>0:
        t=t//2
      else:
        t=t+(k-t)//2
    if t<k:    
      ans+=k-t
print(ans)
# Judge status: Accepted
import heapq

cnt, ticket = map(int, input().split())
lst = list(map(lambda i:int(i) * (-1) , input().split()))
heapq.heapify(lst)

for _ in range(ticket):
  tmp_min = heapq.heappop(lst)
  heapq.heappush(lst, (-1) * (-tmp_min//2))
  
print(-sum(lst))
# Judge status: Accepted
from collections import Counter
s = input()
t = input()
#文字の順番入れ替えは可能
#文字の個数は増やせない
#結局はaabbbなら2,3になる
#abcdbならa:1,b:2,c:1,d:1
s_dict = Counter(s)
t_dict = Counter(t)
s_val = list(s_dict.values())
t_val = list(t_dict.values())
s_val.sort()
t_val.sort()
if s_val == t_val:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from math import factorial


def cmb(n,r):
    return factorial(n)//(factorial(n-r)*factorial(r))


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

cnt=A.count(0)
B=2**cnt

ans=0
for i in range(p,n-cnt+1,2):
    ans +=cmb(n-cnt,i)
print(ans*B)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()


def main():
    C = [list(map(int, input().split())) for _ in range(3)]
    rumor = True
    for i in range(1, 3):
        diff1 = C[i][0] - C[0][0]
        diff2 = C[i][1] - C[0][1]
        diff3 = C[i][2] - C[0][2]
        if diff1 != diff2 or diff2 != diff3 or diff1 != diff3:
            rumor = False
            break
    if rumor: print("Yes")
    else: print("No")

if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
res = 1
for i in range(n):
    res *= i+1
    res %= mod
print(res)
# Judge status: Wrong Answer
import math
x,y=map(int,input().split())
print(int(math.log2(y/x))+1)
# Judge status: Accepted
n=int(input())
sum=0
for i in range(n):
	if (i+1) % 3 !=0:
		if (i+1)%5 !=0:
			sum+=i+1
print(sum)
# Judge status: Accepted
n, k = map(int, input().split())

x = n % k
ans = min(x, abs(k - x))
print(ans)
# Judge status: Wrong Answer
N, K = input().split()
p = list(input().split())
p = list(map(int, p))
p = p.sort()
buy = 0
for item in range(int(K)):
  buy += item
print(buy)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

N = int(readline())
P = tuple(map(int,readline().split()))
Q = tuple(map(int,readline().split()))

permutations = list(itertools.permutations(range(1,N+1)))
p = permutations.index(P)
q = permutations.index(Q)

answer = abs(p - q)
print(answer)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,d=map(int, input().split())
    print(-(-n//(2*d+1)))
resolve()
# Judge status: Accepted
a, b, c = map(int, input().split())
if a <= c <= b:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
x,n=map(int,input().split())
p=list(map(int,input().split()))
ans=0
num=0
while ans==0:
    if (x+num) not in p:
        ans=x+num
    if (x-num) not in p:
        ans=x-num
        if ans==0:
            break
    num+=1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
mod = 10**9 + 7
bits = [0]*60
for x in a:
    i = 0
    while x > 0:
        if x % 2 == 1:
            bits[i] += 1
        x //= 2
        i += 1
ans = 0
for i in range(60):
    ans += (bits[i] * (n-bits[i])) * pow(2, i, mod)
    ans %= mod
print(ans)
# Judge status: Accepted
print("No" if input().replace("hi", "") else "Yes")
# Judge status: Wrong Answer
from collections import Counter

N = int(input())
A = sorted(list(map(int,input().split())),reverse=True)
A = Counter(A)
check = 0
for key,value in A.items():
    if value >= 4 and check == 0:
        print(key * 2)
        break
    elif value >= 2 and check == 0:
        tmp = key
        check += 1
    elif value >= 2 and check == 1:
        print(tmp * key)
        break
else:
    print(0)
# Judge status: Wrong Answer
import math
a, b = map(int, input().split())
print(math.ceil(a*b/2))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

M = sum(A)

for i in range(N):
    K = min(A[i], B[i])
    A[i] -= K
    A[i+1] -= B[i] - K
    A[i+1] = max(0, A[i+1])
    
print(M - sum(A))
# Judge status: Accepted
N,A,B = map(int, input().split())

if A == 0:
    print(0)
    exit()

if N <= A:
    print(N)
    exit()

set_count = N // (A+B)
extra = N % (A+B)

if extra <= A:
    print(set_count*A + extra)
    exit()
else:
    print(set_count*A + A)
    exit()
# Judge status: Accepted
s=input()
n=ord(s)
if 65<=n<=90:
    print("A")
else:
    print("a")
# Judge status: Wrong Answer
x = int(input())
if x >= 2000:
  print(1)
elif x < 100*(x//105+1):
  print(0)
else:
  print(1)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def inp():
    return(int(input()))
  
T = inp()
print("NO") if T<30 else print("YES")
# Judge status: Accepted
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
war_flag = True

for z in list(range(X+1, Y+1)):
    if max(x) < z and min(y) >= z:
        war_flag = False
        break

if war_flag:
    print('War')
else:
    print('No War')
# Judge status: Accepted
n = int(input())
c = list(input())


sum_r, sum_w = [0], [0]
s1, s2 = 0, 0
for v in c:
    if v == 'R':
        s1 += 1
    else:
        s2 += 1
    sum_r.append(s1)
    sum_w.append(s2)

res = float('inf')
for i in range(n+1):
    res = min(res, max(sum_w[i], s1 - sum_r[i]))

print(res)
# Judge status: Wrong Answer
#<B>
N = input()
ans = 0
for i in range(1, int(N)):
    if len(str(i)) % 2 != 0:
        ans += 1

print(ans)
# Judge status: Accepted
# a
a,b,c = input().split(" ")
print("{} {} {}".format(c,a,b))
# Judge status: Accepted
N, M = map(int, input().split())
a = [0 for i in range(M)]
b = [0 for i in range(M)]
cnt = [0 for i in range(N)]

for i in range(M):
    a[i], b[i] = map(int, input().split())

for i in range(M):
    cnt[a[i]-1] += 1
    cnt[b[i]-1] += 1

for i in range(N):
    print(cnt[i])
# Judge status: Accepted
N = str(input())

if '7' in N:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import math
if __name__=="__main__":
    # Problem c
    A, B, H, M = map(int, input().split(' '))

    total_min = H*60 + M
    A_rad = 2*math.pi/720 * total_min
    B_rad = 2*math.pi/60 * M
    angle = A_rad-B_rad
    length_pow = A**2 + B**2 - 2*A*B*math.cos(angle)
    print(length_pow**(1/2))
# Judge status: Accepted
S = input()

if S == "ABC":
  print("ARC")
elif S == "ARC":
  print("ABC")
# Judge status: Accepted
N,K = map(int,input().split())

cnt = 0
d = []
for _ in range(N):
    a,b = map(int,input().split())
    d.append((a,b))

for i,j in sorted(d):
    cnt += j
    if cnt >= K:
        print(i)
        break
# Judge status: Wrong Answer
n = int(input())
a = 26
c = 1
res =""
t = ""

num2alpha = lambda c: chr(c+64)

while True:
    if n <= a:
        break
    a *= 26
    c += 1

for i in range(c):
    t = num2alpha(int(n % 26))
    if t == "@":
        t = "z"
    res = t + res
    n = n / 26

print(str.lower(res))
# Judge status: Wrong Answer
# ABC148D - Brick Break
def main():
    N, *A = map(int, open(0).read().split())
    remaining = 0
    cur = 0  # current index
    for target in range(1, N + 1):
        be_kept = False
        for i in range(cur, N):
            if A[i] == target:
                remaining += 1
                cur += 1
                be_kept = True
                break
        if not be_kept:
            break
    print(N - remaining if remaining else -1)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))
pos = 0
temp = 0
cnt = 0
i = 1
while i < N:
    pos = min(a[i - 1], a[i])
    if a[i] == pos:
        cnt += 1
    else:
        if cnt > temp:
            temp = cnt
        cnt = 0
    i += 1

print(cnt)
# Judge status: Accepted
n = int(input())
a = []
from collections import Counter
for _ in range(n):
    a.append(int(input()))
a = [0] + a
    
cursum = 0
ans = 0
for i in range(1,n+1):
    if a[i] == 0:
        ans += cursum // 2
        cursum = 0
    else:
        cursum += a[i]
        
ans += cursum // 2
print(ans)
# Judge status: Accepted
import sys
#from collections import deque
input = sys.stdin.buffer.readline

x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int,input().split())),reverse=True)
q = sorted(list(map(int,input().split())),reverse=True)
r = sorted(list(map(int,input().split())),reverse=True)
ans = p[:x]
ans[x:x] = q[:y]
ans += r
ans = sorted(ans,reverse=True)
print(sum(ans[:x+y]))
# Judge status: Accepted
a,b,c=map(int,input().split())
k = int(input())
max_num = max(max(a,b),c)
print(a+b+c+max_num*2**k-max_num)
# Judge status: Accepted
N = input()[::-1]

dp1 = [0]
dp2 = [1]

for x in N:
    x = int(x)

    r = dp1[-1]+x
    if x<9: r = min(r, dp2[-1]+x+1)
    dp1.append(r)
    dp2.append(min(dp1[-2]+10-x, dp2[-1]+9-x))

print(min(dp1[-1],dp2[-1]+1))
# Judge status: Accepted
n, m = map(int, input().split())
fset = set([i for i in range(1, m + 1)])
allset = fset
for i in range(n):
  temp = set(list(map(int, input().split()))[1:])
  fset = fset - (allset - temp)
print(len(fset))
# Judge status: Wrong Answer
#!/usr/bin/python3
import sys

n = input()
l = list(map(int, input().split()))

loop = 0

while (1):
  for i in l:
    print('loop', loop)
    if i % (2 ** loop + 1) != 0:
      print(loop)
      sys.exit(0)
  loop = loop + 1
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

biggerA = 0
biggerB = 0
for ai, bi in zip(a, b):
  if ai > bi:
    biggerA += ai - bi
  if ai < bi:
    biggerB += (bi - ai) // 2
if biggerB >= biggerA:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
#nの約数列挙
#-------------------------------------------------------------------------
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない
#-------------------------------------------------------------------------
# テスト
N = int(input())
cnt = 0

for i in range(N+1):
    if i%2 == 1 and len(divisor(i)) == 8:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
s = int(input())
sl = [s]
count = 2
for i in range(100):
  s_next = 0
  if sl[i]%2 == 0:
    s_next = sl[i]//2
    sl.append(s_next)
  else:
    s_next = 3*sl[i]+1
    sl.append(s_next)
  if sl.count(s_next) > 1:
    print(count)
    break
  count += 1
# Judge status: Wrong Answer
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
MOD = 10**9 + 7

n = int(input())

ret = pow(10, n, MOD)
ret -= pow(9, n, MOD)
ret -= pow(9, n, MOD)
ret += pow(8, n, MOD)

print(ret)
# Judge status: Accepted
n = int(input())
li = list(map(int,input().split()))
s = sum(li)
sum_li = []
for i,l in enumerate(li):
    if i == 0:
        sum_li.append(l)
        continue
    sum_li.append(sum_li[-1]+l)
all_li = []
for ii,ss in enumerate(sum_li):
    if ii == len(sum_li)-1:
        break
    all_li.append(abs(s-2*ss))
#print(all_li)
print(min(all_li))
# Judge status: Accepted
N=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i] and l[i]+l[j]>l[k] and l[i]+l[k]>l[j] and l[k]+l[j]>l[i]:
                ans+=1
print(ans)
# Judge status: Accepted
N = int(input())
l = []

for i in range(N):
    s, p = input().split()
    l.append((s, int(p), i+1))

l.sort(key=lambda x:(x[0],-x[1]))
for _, _, i in l:
    print(i)
# Judge status: Accepted
from bisect import bisect_left


n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in range(n-2):
    a = l[i]
    for j in range(i+1, n-1):
        b = l[j]
        cnt += bisect_left(l, a+b) - j - 1
        # bisec_left(l, x)でlの中にxを挿入できる点を探す
print(cnt)
# Judge status: Accepted
import sys
import heapq
import math
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)
for i in range(m):
    max_a = heapq.heappop(a)
    max_a /= 2
    heapq.heappush(a, max_a)
for i in range(n):
    a[i] = math.floor(-a[i])
print(sum(a))
# Judge status: Wrong Answer
n = int(input())
s = list(input())
half = int(n/2)

max1 = 0
for i in range(half):
  f = set(s[:half-i])
  b = set(s[half-i:])
  union = len(f&b)
  if max1 > union:
    break
  else:
    max1 = union

max2 = 0
for i in range(half):
  f = set(s[:half+i])
  b = set(s[half+i:])
  union = len(f&b)
  if max2 > union:
    break
  else:
    max2 = union
    
ans = max1 if max1>max2 else max2
print(ans)
# Judge status: Accepted
n = int(input())

def div(x):
    global count
    if x%2==1:
        return count
    else:
        count += 1
        return div(x//2)
m = -1
for i in range(n):
    count = 0
    r = div(i+1)
    if m < r:
        m = r
        ans = i+1

print(ans)
# Judge status: Accepted
import sys
from math import sqrt
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    ans=0
    for i in range(1,int(sqrt(M))+1):
        if M%i==0:
            if M//i>=N:
                ans=max(ans,i)
            if i>=N:
                ans=max(ans,M//i)
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
x = int(input())
if x in [7,5,3]:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
import collections
n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
p = list(c.items())
p.sort(reverse = True)
tate = 0
yoko = 0
for k , v in p:
    if tate == 0 and v >= 4:
        tate = k
        yoko = k
        break
    elif tate == 0 and 2 <= v <= 3:
        tate = k
    elif tate != 0 and v >= 2:
        yoko = k
        break
    
print(tate*yoko)
# Judge status: Accepted
n,m = map(int,input().split())
stairs = [True for _ in range(n+1)]
broken_stairs = [int(input()) for i in range(m)]
mod = 10**9+7

for i in broken_stairs:
    stairs[i] = False

dp = [0]*(n+1)

if stairs[1]:
    dp[1] = 1
    
if stairs[0]:
    dp[0] = 1


for i in range(2,n+1):
    if stairs[i]:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
    
    else:
        dp[i] = 0

print(dp[-1])
# Judge status: Accepted
[N,R] = list(map(int,input().split()))
if N>=10:
    I=R  #内部レーティング
    
else:
    I=R+100*(10-N)
print(I)
# Judge status: Accepted
a = input().split()
q = int(a[0]) * 4
h = int(a[1]) * 2
s = int(a[2])
t = int(min([q,h,s]))
d = int(a[3])
b = int(input())

if min([t,d/2]) == t:
  print(int(b * t))
else:
  print(int((b // 2) * d + (b % 2) * t))
# Judge status: Accepted
s = input()
n = len(s)
s1 = s[:(n-1)//2]
s2 = s[(n+3)//2-1:n]

if s != s[::-1] or s1 != s1[::-1] or s2 != s2[::-1]:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
al = [0]*(10**5+2)

for i in a:
    al[i] += 1
    al[i+1] += 1
    al[i+2] += 1

print(max(al))
# Judge status: Accepted
N,H = map(int,input().split(" "))
a = [0] * N
b = [0] * N

for i in range(N):
    a[i],b[i] = map(int,input().split(" "))
a.sort(reverse = True)
b.sort(reverse = True)
c = 0
while(b[c] > a[0]):
    H -= b[c]
    c += 1
    if c == len(b):break
    if H <= 0:break
if H > 0:
    if (H % a[0] != 0):c += 1
    c += H // a[0]
print(c)
# Judge status: Accepted
a,b=map(int, input().split())
print(max(a+b,2*a-1,2*b-1))
# Judge status: Accepted
N, K = map(int, input().split())
X = [0 for i in range(N)]
for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(d):
    X[A[j]-1] += 1

print(X.count(0))
# Judge status: Accepted
n = input()
print("Yes" if n[0] == n[1] == n[2] or n[1] == n[2] == n[3] else "No")
# Judge status: Wrong Answer
a, b, c, d = list(map(int, input().split()))

if b <= 0 and d <= 0:
    print(a*c)
elif b < 0 and d >= 0:
    print(max(c, 1)*b)
elif b >= 0 and d < 0:
    print(max(a, 1)*d)
else:
    print(b*d)
# Judge status: Wrong Answer
A = list(map(int,input().split()))
K = int(input())
N = sorted(A)[-1]
print(sorted(A)[0] + sorted(A)[1] +N*2*K)
# Judge status: Wrong Answer
print("Chiristmas"+"Eve"*(25-int(input())))
# Judge status: Accepted
N = int(input())
args = list(map(int, input().split()))

ans = [''] * N

for i in range(N):
  ans[args[i] - 1] = i + 1

for s in ans:
  print(s)
# Judge status: Wrong Answer
from decimal import Decimal
A,B,C=map(int,input().split())
if Decimal(A**0.5+B**0.5)<Decimal(C**0.5):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
k = int(input())
a = 0
for i in range(k-1):
    a = (a*10+7)%k
    if a == 0:
        print(i+1)
        break
else:
    print(-1)
# Judge status: Accepted
A, B, C = map(int, input().split())

count_5 = 0
count_7 = 0

if A == 5:
  count_5 += 1
elif A == 7:
  count_7 += 1
  
if B == 5:
  count_5 += 1
elif B == 7:
  count_7 += 1
  
if C == 5:
  count_5 += 1
elif C == 7:
  count_7 += 1
  
if count_5 == 2 and count_7 == 1:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
n = int(input())
S_List = [input() for _ in range(n)]
S = [ [X[j] for j in range(len(X))] for X in S_List]
common = []
common = S[0].copy()
for s in S:
    for c in common:
        if c in s:
            s.remove(c)
        else:
            common.remove(c)
common.sort()
ans = ""
for c in common:
    ans += c
print(ans)