Harryxun/stf_run huggingface dataset:
A = list(map(int, input().split()))

total = sum(A)

if A > 22:
  print("bust")
else:
  print("win)

### FIXED CODE ###

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

total = sum(A)

if total > 21:
  print("bust")
else:
  print("win")
ss, t = input(), input()
lt = len(t)
lss = len(ss)

for i in range(0, lss - lt + 1):
  tss = ss[i : i + lt]
  tb = True
  for a, b in zip(tss, t):
    if a == '?':
      continue
    elif a != b:
      tb = False
      break
  if tb:
    ss = ss[: i] + t + ss[i + lt:]
    break
if tb:
  print(ss.replace('?', 'a'))
else:
  print('UNRESTORABLE')

### FIXED CODE ###

ss, t = input(), input()
lt = len(t)
lss = len(ss)
lst = []
for i in range(lss - 1, lt - 2, -1):
    tss = ss[i - lt + 1:i + 1]
    tb = True
    for a, b in zip(tss, t):
        if a == '?':
            continue
        elif a != b:
            tb = False
            break
    if tb:
        lst.append(ss[:i - lt + 1] + t + ss[i + 1:])
if len(lst):
    lst.sort()
    print(lst[0].replace('?', 'a'))
else:
    print('UNRESTORABLE')
N, K = map(int, input().split())

opes = [0] * (K)
for i in range(2**N):
    blue_cnt = 0
    ope_count = 0
    operating = False
    for j in range(N+1):
        bin2str = format(i, '0' + int(N) + 'b')
        if blue_cnt > K and j == (N + 1):
            break
        if operating and bin2str[j:j+1:] == 0:
            operating = False
            ope_count += 1
        elif !operating and bin2str[j:j+1:] == 1:
            operating = True
            blue_cnt += 1
        elif bin2str[j+2:j+4:] == 1:
            blue_cnt += 1
    if operating == True:
    	ope_count += 1
    if blue_cnt == K:
        opes[ope_count] += 1
for i in opes:
    print(i%100000007)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)

nCr = {}
def combination(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = combination(n-1,r) + combination(n-1,r-1)
    return nCr[(n,r)]

N, K = map(int, input().split())
for i in range(1, K+1):
	if i <= N-K+1:
		A = combination(N-K+1, i)
		P = combination(K-1, i-1)
		B = A * P
		print(B % (10**9+7))
	else:
		print(0)
from random import shuffle
N = int(input())
S = input()

def check(l):
    r = range(N - 2 * l + 1)
    shuffle(r)
    for i in r:
        if S[i : i + l] in S[i + l :]:
            return True

ok = 0
ng = N // 2 + 1

while ng - ok > 1:
    m = (ok + ng) // 2
    if check(m):
        ok = m
    else:
        ng = m

print(ok)

### FIXED CODE ###

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

dp = [[0 for _ in range(N)] for _ in range(N)]

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        if S[i] == S[j]:
            tmp = 1
            if i > 0:
                tmp += dp[i - 1][j - 1]
            if j - i < tmp:
                continue
            dp[i][j] = tmp
        ans = max(ans, dp[i][j])
print(ans)
n = int( input() )
A = []
B = []

for i in range( n ):
  a, b = map( int, input().split() )
  A.append( a )
  B.append( b )

A = sorted( A )
B = sorted( B )

if n % 2 == 0:
  i = n // 2
  print(( B[ i ] + B[ i - 1 ] ) - ( A[ i ] + A [ i - 1 ] ) + 1 )
else:
  i = ( n + 1 ) // 2 - 1
  print( B[ i ] - A[ i ] + 1 )


### FIXED CODE ###

n = int( input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
fact = factorization( n )

cnt = 0
for f in fact:
  if f[0] == 1:
    continue
  fa = f[ 1 ]
  fa -= 1
  i = 2
  while fa >= 0:
    cnt += 1
    fa -= i
    i += 1
print( cnt )
N=int(input())
lamps=[]
for a in range(N):
    _=int(input())
    lamps.append(_)
lamps.insert(0,-1)

if lamps.count(2)==0:
    print("-1")
    exit()

# no2=[i for i , x in enumerate(lamps) if x==2]
PressedButton=[]

num=2
while lamps[1]!=num:
    a=lamps.index(num)
    if PressedButton.count(a)==0:
        PressedButton.append(a)
        num=a
    else:
        print("-1")
        exit()
print(PressedButton)

### FIXED CODE ###

N=int(input())
lamps=[]
for a in range(N):
    _=int(input())
    lamps.append(_)
lamps.insert(0,"aaa")

PressedButtons=[False]*int(N+1)

a=1
count=0

if lamps.count(2)==0:
    print("-1")
    exit()

while PressedButtons[a]==False :
    PressedButtons[a]=True
    count+=1
    a=lamps[a]
    if a==2:
        print(count)
        exit()
print('-1')
a = input()
b= input()
x = a*b

if x%2==0:
    print("Even")
else:
    print("Odd")



### FIXED CODE ###

a,b = map(int,input().split())
if (a*b)%2==0:
    print("Even")
else:
    print("Odd")
l,r=list(map(int, input().split()))
c=[0]*(r-l+1)
for i in range(l,r+1):
	c[i-l]=i%2019
print(min(c)*(min(c)+1))

### FIXED CODE ###

l,r=list(map(int, input().split()))
minmod=2018
if r-l>=2018:
	print(0)
else:
	for i in range(l,r+1):
		for j in range(i+1,r+1):
			minmod=min(minmod,(i*j)%2019)
	print(minmod)
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
s = int(input())
a = s//3
if a == 0:
    print(0)
else:
    m = 10**9+7
    cnt = 1
    for i in range(2, a+1):
        cnt += comb(s-2*i-1, i-1)
print(cnt%m)

### FIXED CODE ###

import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
s = int(input())
a = s//3
if a == 0:
    print(0)
else:
    m = 10**9+7
    cnt = 1
    for i in range(2, a+1):
        cnt += comb(s-2*i-1, i-1)
    print(cnt%m)
a, b = [0] * m, [0] * m
c, d = [0] * k, [0] * k

direct =[[] for _ in range(n)]
uf = UnionFind(n)

for i in range(m):
    a[i], b[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1
    direct[a[i]].append(b[i])
    direct[b[i]].append(a[i])
    uf.union(a[i], b[i])

for i in range(k):
    c[i], d[i] = map(int, input().split())
    c[i] -= 1
    d[i] -= 1
    if uf.same(c[i], d[i]):
        direct[c[i]].append(d[i])
        direct[d[i]].append(c[i])

ans = [0] * n
for i in range(n):
    ans[i] = uf.size(i) - len(direct[i]) - 1

print(*ans)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = [-1] * n
    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.find(x) > self.find(y):
            x, y = y, x
        self.par[x] += self.par[y]
        self.par[y] = x
    def size(self, x):
        return -self.par[(self.find(x))]
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    def roots(self):
        return [i for i, x in enumerate(self.par) if x < 0]
    def group_count(self):
        return len(self.roots())
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m, k = map(int, input().split())
a, b = [0] * m, [0] * m
c, d = [0] * k, [0] * k

direct =[[] for _ in range(n)]
uf = UnionFind(n)

for i in range(m):
    a[i], b[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1
    direct[a[i]].append(b[i])
    direct[b[i]].append(a[i])
    uf.union(a[i], b[i])

for i in range(k):
    c[i], d[i] = map(int, input().split())
    c[i] -= 1
    d[i] -= 1
    if uf.same(c[i], d[i]):
        direct[c[i]].append(d[i])
        direct[d[i]].append(c[i])

ans = [0] * n
for i in range(n):
    ans[i] = uf.size(i) - len(direct[i]) - 1

print(*ans)
import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
import heapq


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

data = getInputListInt()
N = data[0]
K = data[1]
MOD = 1000000000 + 7

# nCa
def choose(n, a):
    if a == 0: return 1
    x = 1
    y = 1
    for i in range(a):
        x *= n-i
        y *= i+1
    return x / y



for i in range(1, K+1, 1):
    blue = choose(K-1, i-1)
    red = choose(N-K+1, i)

    ans = (blue * red) % MOD
    print(int(ans))


### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def fast_pow(num, kata, mod):
        if kata == 0:
            return 0

        res = 1
        while kata > 0:
            if kata & 1 == 1:
                res = res * num % mod
            num = num * num % mod

            kata >>= 1
        return res

    # MODのCombination nがでかくても関係なくrに依存　r<10**6なら回せる
    MOD = 10 ** 9 + 7

    def choose(n, r):
        res = 1
        fac = 1
        for i in range(r):
            res *= n - i
            res %= MOD
            fac *= i + 1
            fac %= MOD
        return res * fast_pow(fac, MOD - 2, MOD) % MOD

    n, k = ns()

    for i in range(1, k + 1):
        blue_pair = choose(k - i + (i - 1), i - 1)
        red_pair = choose((n - k) + 1, i)
        print(blue_pair * red_pair % MOD)


if __name__ == '__main__':
    main()
import math

n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(x,y):
    return (x*y) // math.gcd(x,y)

ans = t[0]

for i in range(1,n):
    ans = lcm(ans,t[i])

print(ans)

### FIXED CODE ###

import fractions

n = int(input())
t = [int(input()) for _ in range(n)]

def lcm(x,y):
    return (x*y) // fractions.gcd(x,y)

ans = t[0]

for i in range(1,n):
    ans = lcm(ans,t[i])

print(ans)
N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        #print(i, flag)
        if(count < num_min):
            #print(count)
            num_min = count
            #print(count)
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                #print(i, flag, N[0]-1-j, G_new, pi[N[0]-1-j], count, -(-G_new//(100*(N[0]-j)))   )
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] < 0):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                       # print(count)
                        num_min = count
                		break

    
print(num_min)


### FIXED CODE ###

N = input().split()
N = [int(i) for i in N]
pi = [0 for i in range(N[0])]
ci = [0 for i in range(N[0])]
for i in range(N[0]):
    buf = input().split()
    pi[i] = int(buf[0])
    ci[i] = int(buf[1])

num_min = 10*100
G_new = N[1]

flag= [0 for i in range(N[0])]
for i in range(0, pow(2, N[0])):
    G_new = N[1]
    count = 0
    #print(bin(i))
    for j in range(N[0]):
        flag[j] = (i>>j & 1)
        if(flag[j]==1):
            G_new -= ci[j]
            G_new -= 100*(j+1)*pi[j]
            count += pi[j]
    #print(flag)

    if(G_new<=0):
        #print(i, flag)
        if(count < num_min):
            #print(count)
            num_min = count
            #print(count)
    else:
        for j in range(N[0]):
            if((flag[N[0]-1-j])==0):
                #print(i, flag, N[0]-1-j, G_new, pi[N[0]-1-j], count, -(-G_new//(100*(N[0]-j)))   )
                if(G_new - 100*(N[0]-j)*pi[N[0]-1-j] < 0):
                    count += -(-G_new//(100*(N[0]-j)))
                    if(count < num_min):
                       # print(count)
                        num_min = count
                break

    
print(num_min)
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]

A.sort()
BC.sort(reverse=True,key = lambda x:x[1])

pt,card,index = 0,BC[0][1],0
while A[pt] < card:
    for i in range(BC[index][0]):
        if A[pt] < card:
            A[pt] = card
        pt += 1
    index += 1
    if index < M:
        card = BC[index][1]
    else:
        break
    if pt >= N:
        break

print(sum(A))


### FIXED CODE ###

#要修正　方針は合っているようだが・・・
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [list(map(int,input().split())) for _ in range(M)]

A.sort()
BC.sort(reverse=True,key = lambda x:x[1])

pt,card,index = 0,BC[0][1],0
while True:
    for i in range(BC[index][0]):
        if pt < N:
            A[pt] = max(A[pt],card)
        else:
            break
        pt += 1

    index += 1
    if index < M:
        card = BC[index][1]
    else:
        break

print(sum(A))
import itertools
import sys
sys.setrecursionlimit(10000)
h, w = map(int, input().split())
s_list = []
for i in range(h):
  s_list.append(list(input()))
res = 0
check_list = set()

def rec_create_area(point, tmp_area, current_str):
  new_point_list = []
  new_point_list.append((point[0] + 1, point[1]))
  new_point_list.append((point[0], point[1] + 1))
  new_point_list.append((point[0] - 1, point[1]))
  new_point_list.append((point[0], point[1] - 1))
  for new_point in new_point_list:
    if new_point[0] >= h or new_point[1] >= w or new_point[0] < 0 or new_point[1]  < 0:
      continue
    if new_point in check_list:
      continue
    new_str = s_list[new_point[0]][new_point[1]]
    if new_str == current_str:
      continue
    if new_str == "#":
      tmp_area[0] += 1
    else:
      tmp_area[1] += 1
    check_list.add(new_point)
    rec_create_area(new_point, tmp_area, new_str)
  
for a, b in itertools.product(range(h), range(w)):
  check_point = (a, b)
  if check_point in check_list:
    continue
  check_list.add(check_point)
  current_str = s_list[check_point[0]][check_point[1]]
  if current_str == "#":
    tmp_area = [1, 0]
  else:
    tmp_area = [0, 1]
  rec_create_area(check_point, tmp_area, current_str)
  res += tmp_area[0] * tmp_area[1]
  
print(res)

### FIXED CODE ###

import itertools
import sys
sys.setrecursionlimit(1000000)
h, w = map(int, input().split())
s_list = []
for i in range(h):
  s_list.append(list(input()))
res = 0
check_list = set()

def rec_create_area(point, tmp_area, current_str):
  new_point_list = []
  new_point_list.append((point[0] + 1, point[1]))
  new_point_list.append((point[0], point[1] + 1))
  new_point_list.append((point[0] - 1, point[1]))
  new_point_list.append((point[0], point[1] - 1))
  for new_point in new_point_list:
    if new_point[0] >= h or new_point[1] >= w or new_point[0] < 0 or new_point[1]  < 0:
      continue
    if new_point in check_list:
      continue
    new_str = s_list[new_point[0]][new_point[1]]
    if new_str == current_str:
      continue
    if new_str == "#":
      tmp_area[0] += 1
    else:
      tmp_area[1] += 1
    check_list.add(new_point)
    rec_create_area(new_point, tmp_area, new_str)
  
for a, b in itertools.product(range(h), range(w)):
  check_point = (a, b)
  if check_point in check_list:
    continue
  check_list.add(check_point)
  current_str = s_list[check_point[0]][check_point[1]]
  if current_str == "#":
    tmp_area = [1, 0]
  else:
    tmp_area = [0, 1]
  rec_create_area(check_point, tmp_area, current_str)
  res += tmp_area[0] * tmp_area[1]
  
print(res)
from fraction import gcd

i = list(map(int,input().split()))
A = i[0]
B = i[1]

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

print(ans)

### FIXED CODE ###

a = [int(input()) for i in range(2)]
A = a[0]
B = a[1]

ans = 6 - (A + B)
print(ans)
ins = False
ans = [0]*N
ok = True
for i in range(M):
    s, c = list(map(int, input().split()))
    if N != 1 and s==1 and c==0:
        ok = False
    if ans[s-1]==0 or ans[s-1]==c:
        ans[s-1] = c
    else:
        ok = False
    if s == 1:
        ins = True
    else:
        ins = False
answer = []
if ok == True:
    for i in range(len(ans)):
        answer.append(str(ans[i]))
    if N != 1 and ins==False:
        answer[0]='1'
    if N == 1 and M == 0:
        print(0)
    else:
        print(''.join(answer))
else:
    print('-1')


### FIXED CODE ###


#C
N, M = list(map(int, input().split()))
ins = False
ans = [0]*N
ok = True
for i in range(M):
    s, c = list(map(int, input().split()))
    if N != 1 and s==1 and c==0:
        ok = False
    if ans[s-1]==0 or ans[s-1]==c:
        ans[s-1] = c
    else:
        ok = False
    if s == 1:
        ins = True
    else:
        ins = False
answer = []
if ok == True:
    for i in range(len(ans)):
        answer.append(str(ans[i]))
    #if N != 1 and ins==False:
    if N != 1 and answer[0]=='0':
        answer[0]='1'
    if N == 1 and M == 0:
        print(0)
    else:
        print(''.join(answer))
else:
    print('-1')
M=10**9+7
n,m=map(int,input().split())
import sys, functools as ft
sys.setrecursionlimit(10**18)
@ft.lru_cache(None)
def f(n):
  if n<2: return 1
  return n*f(n-1)%M
a=0
for k in range(n+1):
  a+=(-1)**k*f(m-k)*pow(f(k)*f(n-k),-1,M)%M
print(a*f(n)*f(m)*pow(f(m-n)**2,-1,M)%M)

### FIXED CODE ###

M=10**9+7
n,m=map(int,input().split())
F=[1]
for i in range(1,m+1): F+=[i*F[-1]%M]
a=0
for k in range(n+1):
  a+=(-1)**k*F[m-k]*pow(F[k]*F[n-k],-1,M)%M
print(a*F[n]*F[m]*pow(F[m-n]**2,-1,M)%M)
from decimal import Decimal
a,b=map(float, input().split())
print(int(Decimal(a)*Decimal(b)))

### FIXED CODE ###

n=int(input())
l=list(map(int, input().split()))
m=1
for i in range(n):
    m*=l[i]
    if m>10**18:
        if 0 in l:
            print(0)
            exit()
        print(-1)
        exit()

print(m)
N,M=map(int, input().split())
AB=list(map(int, open(0).read().split()))
ss=[set()]
for i in range(0, len(AB), 2):
    a=AB[i]
    b=AB[i+1]
    for s in ss:
        if a in s or b in s:
            s.add(a)
            s.add(b)
            break
    else:
        ss.add(set([a,b]))
print(N - len(ss) - M)

### FIXED CODE ###

(N,M),*AB=[list(map(int, x.split())) for x in open(0).readlines() if len(x)>1]

class UnionFind:
    def __init__(self, n):
        self.n=n
        self.parents=[-1 for i in range(n)]

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        if rx == ry:
            return
        if self.parents[rx] > self.parents[ry]:
            rx,ry=ry,rx
        self.parents[rx] = self.parents[ry]
        self.parents[ry] = rx

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i,x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


d=UnionFind(N)
for a,b in AB:
    d.union(a-1,b-1)
print(d.group_count() - 1)
s = input()

s = s.split(" ")

x1 = int(s[0])
y1 = int(s[1])

x2 = int(s[2])
y2 = int(s[3])

 # X1 - X2 の増加量
zouka_x = abs(int(x1) - int(x2))

 # Y1 - Y2 の増加量
zouka_y = abs(int(y1) - int(y2))



if (x1 <= x2 and y1 <= y2):
    x3 = x2 - zouka_y
    y3 = y2 + zouka_x

    x4 = x1 - zouka_y
    y4 = y1 + zouka_x
elif (x1 > x2 and y1 < y2):
    x3 = x2 - zouka_y
    y3 = y2 - zouka_x

    x4 = x1 - zouka_y
    y4 = y1 - zouka_x
elif (x1 < x2 and y1 < y2):
    x3 = x2 - zouka_y
    y3 = y2 - zouka_x

    x4 = x1 + zouka_y
    y4 = y1 + zouka_x
elif (x1 < x2 and y1 > y2):
    x3 = x2 + zouka_y
    y3 = y2 + zouka_x

    x4 = x1 + zouka_y
    y4 = y1 + zouka_x

print(str(x3) + " " + str(y3) + " " + str(x4) + " " + str(y4))


### FIXED CODE ###

x1, y1, x2, y2 = map(int, input().split())
 
vector_x, vector_y = x2 - x1, y2 - y1
print(x2 - vector_y, y2 + vector_x, x1 - vector_y, y1 + vector_x)
s,t = map(str,input().split())
a,b = map(int,input().split())
u = int(input())
if s == u:
  print(a-1,b)
else:
  print(a,b-1)

### FIXED CODE ###

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)
N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
def sn(a,n):
  c=0
  for i in a:
    if i<n:
      c+=1
  return c
def comb(n):
  k=1
  if n<=1:
    return 1
  for i in range(1,n+1):
    k=k*i
  return k
def numberorder(a):
  s={1,2,3,4,5,6,7,8}
  c=0
  for p in range(8):
    c+=(sn(s,a[p]))*comb(7-p)
    s=s-{a[p]}
  return c
P_num=numberorder(P)
Q_num=numberorder(Q)
print(abs(P_num-Q_num))

### FIXED CODE ###

N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))
def sn(a,n):
  c=0
  for i in a:
    if i<n:
      c+=1
  return c
def comb(n):
  k=1
  if n<=1:
    return 1
  for i in range(1,n+1):
    k=k*i
  return k
def numberorder(a,n):
  s=set({})
  for i in range(1,n+1):
    s=s|{i}
  c=0
  for p in range(n):
    c+=(sn(s,a[p]))*comb(n-1-p)
    s=s-{a[p]}
  return c
P_num=numberorder(P,N)
Q_num=numberorder(Q,N)
print(abs(P_num-Q_num))
x = input()
y = input()
##advencedknowledge
a = [["advanceknowledge"]for i in range(10)]
b = ""
for i in a:
    b = b + "".join(i)


if b.count(y) > 0:
    print("Yes")
else: print("No")

### FIXED CODE ###

n = input()
n += n
if input() in n:
    print("Yes")
else:
    print("No")