peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
mod=10**9+7
ans=10**n
ans-=2*(9**n)
ans+=8**n
ans%=mod
print(ans)
# Judge status: Accepted
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    
    if a[0] == 1:
        a[0]+=13
    if a[1] == 1:
        a[1]+=13


    if a[0] > a[1] :
        print("Alice")
    elif a[0] == a[1]:
        print("Draw")
    else:
        print("Bob")
# Judge status: Wrong Answer
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
  print(X*N + Y*(N-K))
else:
  print(X*N)
# Judge status: Accepted
n = int(input())
A = [None] + [int(i) for i in input().split()]  # 1-based index
ans = []
choose = [0] * (n + 1)


for i in range(n, 0, -1): # 大きい数から評価する
    x = sum(choose[2 * i::i]) # その箱の倍数に入っている玉の和を求める
    if x % 2 == A[i]: # 偶奇の一致を確認
        continue
    choose[i] += 1
    ans.append(str(i))

print(len(ans))
print(" ".join(ans))
# Judge status: Accepted
def resolve():
    S = list(input())
    T = list(input())
    cnt = 0
    for i in range(len(S)):
       if S[i] != T[i]:
            cnt += 1
    print(cnt)

if '__main__' == __name__:
    resolve()
# Judge status: Accepted
#!/usr/bin/python3
#coding: utf-8

A, B, C, X, Y = (int(x) for x in input().split())

ret = 0
if A + B > C * 2:
    m = min(X, Y)
    X -= m
    Y -= m
    ret += m * C * 2

if X > 0:
    if A > C * 2:
        ret += X * C * 2
    else:
        ret += X * A

if Y > 0:
    if B > C * 2:
        ret += Y * C * 2
    else:
        ret += Y * B

print(ret)
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())

x = (h2*60 + m2) - (h1*60 + m1)

print(x-k)
# Judge status: Wrong Answer
W, H, N = map(int, input().split())
sx, sy, ex, ey = 0, 0, W, H
for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        sx = max([x, sx])
    elif a == 2:
        ex = min([x, ex])
    elif a == 3:
        sy = max([y, sy])
    else:
        ey = min([y, ey])

print((ex-sx)*(ey-sy))
# Judge status: Wrong Answer
import numpy as np
import math
n, m = map(int, input().split())
a = list(map(int, input().split()))
p = [0] * n

arr = np.array(a)

for i in range(m):
    index = np.argmax(arr)
    tar = arr[index]

    p[index] += 1
    arr[index] = math.floor(tar / 2.0)

ans = 0
for i in range(n):
    ans += a[i] / (2 ** p[i])


#ans = math.floor(np.sum(arr))
print(int(ans))
# Judge status: Accepted
from collections import Counter
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    c = Counter(A)
    ans = 0
    for k,v in c.items():
        if v<k:
            ans += v
        else:
            ans += v-k
    return ans
print(solve())
# Judge status: Accepted
N = str(input())
num = N[-1]
num = int(num)
 
if num == 3:
  print('bon')
elif num == 0 or num==1 or num==6 or num==8:
  print('pon')
elif num ==2:
  print('hon')
elif num == 4:
  print('hon')
elif num==5:
  print('hon')
elif num==7:
  print('hon')
elif num==9:
  print('hon')
# Judge status: Wrong Answer
n = int(input())
ns = list(map(int, input().split()))
rslt = [0] * n
r = n - 1 
while r >= 0:
    if sum(rslt[r:n:r+1]) % 2 == ns[r]:
        rslt[r] += 1
    r -= 1
print(sum(ns))
if sum(ns):
    print(*[i+1 for i, num in enumerate(ns) if num == 1])
# Judge status: Accepted
from math import pi
print(2 * pi * int(input()))
# Judge status: Wrong Answer
n,w=map(int,raw_input().split())
a=[map(int,raw_input().split()) for _ in xrange(n)]
z=[[0]*(w+1)]
for i in xrange(n):
    z.append(z[-1][:])
    for j in xrange(min(w,a[i][0])+1):
		z[i+1][j]=max(z[i+1][j],z[i][j-a[i][0]]+a[i][1])
print max(z[-1])
# Judge status: Accepted
a=int(input())
b=[0]*a
import sys
for i in range(a):
    b[i]=int(input())
b.sort()
c=sum(b)
if c%10==0:
    for i in range(a):
        if b[i]%10!=0:
            c=c-b[i]
            print(c)
            sys.exit()
    print(0)
else:
    print(c)
# Judge status: Wrong Answer
N = int(input())

d = {}
S = set()

for i in range(N):
    s,p = input().split()
    p = int(p)
    S.add(s)
    if s in d:
        d[s].append([p, i+1])
        continue
    d[s] = []
    d[s].append([p, i+1])
print(d)
S = list(S)
S.sort()

for key in S:
    L = d[key]

    L = sorted(L, reverse=True)
    for l in L:
        print(l[1])
# Judge status: Accepted
import math
n,m = map(int,input().split())

if 2 <= abs(n-m):
    print (0)
elif 1 == abs(n-m):
    print ((math.factorial(n)*math.factorial(m))%((10**9)+7))
elif n == m:
    print ((2*(math.factorial(n)*math.factorial(m)))%((10**9)+7))
# Judge status: Accepted
import math
a, b, x = map(int, input().split())

if x / (a * b) * 2 <= a:
    c = x / (a * b) * 2
    print(math.degrees(math.acos(c / math.sqrt(c * c + b * b))))
else:
    c = 2 * x / (a * a) - b
    print(math.degrees(math.acos(a / math.sqrt(a * a + (b -c) * (b - c)))))
# Judge status: Wrong Answer
N, A, B = map(int, input().split())

if A>B or N==0:
    print(0)
    exit()
if A==B:
    print(1)
    exit()
if N==1:
    print(0)
    exit()

print((B-A+1)*2-1)
# Judge status: Wrong Answer
N = int(input())
l = [2, 1]
i = 2
ans =0
while i < N +1:
    l.append(str(int(l[i-1]) + int(l[i-2])))
    ans = l[i]
    i = i+1
print(ans)
# Judge status: Accepted
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
MOD = 10**9+7

def main():
    A, B, K = map(int, readline().split())
    left = set(list(range(A, min(A+K, B+1))))
    right = set(list(range(B, max(B-K, A-1), -1)))
    ans = list(left | right)
    ans.sort()
    for i in ans:
        print(i)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import collections

n, c, k = map(int, input().split())
t = [int(input()) for i in range(n)]

t.sort()

passenger = 0
departure_limit = t[0] + k
bus_cnt = 0

for T in t:
    if passenger+1 > c or T > departure_limit:
        departure_limit = T+k
        passenger = 1
        bus_cnt += 1
    else:
        passenger+=1

print(bus_cnt+1)
# Judge status: Accepted
x,n = map(int, input().split())
p = list(map(int, input().split()))
ab = min(abs(101 - x),abs(x))
if abs(101 - x) >= abs(x):
    answer = 0
else:
    answer = 101
for i in range(1,101):
    if i in p:
        continue
    else:
        if ab > abs(x - i):
            ab = abs(x - i)
            answer = i
        elif ab == abs(x-i) and answer > i:
            answer = i
print(answer)
# Judge status: Accepted
def main():
    from builtins import int, map, list, print, min
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N = input_number()
    ls = []
    for i in range(5):
        ls.append(input_number())
    mini = min(ls)
    cnt = -(-N//mini)+4
    print(cnt)

if __name__ == '__main__':
    main()
# Judge status: Accepted
def solve():
    a, b, x = map(int,input().split())
    print(b // x + 1 - ((a-1) // x + 1))

if __name__ == '__main__':
    solve()
# Judge status: Accepted
data=int(input())
array=list(map(int,input().split()))
counter=0
qwe=1
for i in range(data):
    if array[i]==qwe:
        counter+=1
        qwe+=1
if counter==0:
    print(-1)
else:
    print(data-counter)
# Judge status: Accepted
N = 26
ord_a = ord('a')
S = [ord(s) - ord_a for s in input()]
K = int(input())


for i in range(len(S)):
    r = (N - S[i]) % N
    if K >= r:
        K -= r
        S[i] = 0


S[-1] += K % N
S[-1] %= N

answer = ''.join(chr(s + ord_a) for s in S)
print(answer)
# Judge status: Accepted
n = int(input())
a = 1
while True:
    a *= 2
    if n < a:
        print(int(a / 2))
        break
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
ad=abs(x-a)
bd=abs(x-b)

if ad > bd:
    print("A")
elif ad < bd:
    print("B")
# Judge status: Accepted

def f(n):
	if n == 0:
		return '0'
	r = []

	while(n):
		if n % 2:
			r.append(1)
		else:
			r.append(0)
		n = (n-r[-1])/-2
	return ''.join(map(str,r[::-1]))
print f(int(raw_input()))
# Judge status: Wrong Answer
def rotation(c , c2):

    return "Yes" if c == c2[-1] + c2[1] + c2[0] else "No"

def main():
    c = str(input())
    c2 = str(input())
    print(rotation(c , c2))

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = list(map(int, reversed(input()))) + [0]
ans = 0
for i in range(len(n)-1):
    if n[i] < 5:
        ans += n[i]
    elif n[i] == 5:
        if i != len(n) - 1 and n[i + 1] >= 5:
            n[i+1] += 1
            ans += 10 - n[i]
        else:
            ans += n[i]
    else:
        n[i+1] += 1
        ans += 10 - n[i]
if n[-1] > 0:
    ans += n[-1]
print(ans)
# Judge status: Accepted
N, X, Y = map(int, input().split())
ls = [0] * N
for i in range(1, N+1):
    for j in range(i+1, N+1):
        dis = min([abs(j-i), abs(X-i) + 1 + abs(j-Y), abs(Y-i) + 1 + abs(j-X)])
        ls[dis] += 1
for i in range(1, len(ls)):
    print(ls[i])
# Judge status: Accepted
n=int(input())

for i in range(1,10):
  for j in range(1,10):
    if i*j==n:
      
      print('Yes')
      exit()
print('No')
# Judge status: Accepted

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

print(a - (b + x) if a > b else max(0, b - (a + x)))
# Judge status: Accepted
def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if len(str(i)) % 2 != 0:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s = input()
D = {}
for c in s:
    if c in D.keys():
        D[c] += 1
    else:
        D[c] = 1
for i in range(len(s)+1):
    for k in D.values():
        if k % 1:
            break
    else:
        ans = len(s)-i
        break
    D[s[len(s)-1-i]] -= 1
print(ans)
# Judge status: Accepted
# coding: utf-8
 
s = input()
n = len(s)
f = 1

ss = s[:(n-1)//2]
for i in range((n-1)//4):
    if not ss[i] == ss[-1*(i+1)]:
        f = 0
        break

tt = s[(n+3)//2-1:]
for i in range((n-1)//4):
    if not tt[i] == tt[-1*(i+1)]:
        f = 0
        break

if ss != tt:
    f = 0

if f:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import Counter
n, m = map(int, input().split())
a = Counter(list(map(int, input().split())))

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

num = sorted(a.items(), key=lambda x: x[0], reverse=True)
ans = 0

for key, val in num:
    if n > val:
        ans += key * val
        n -= val
    else:
        ans += key * n
        break

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

ans = 'NO'
total = 0
for i in range(1, 100000, a):
  total += i
  if total%b == c:
    ans = 'YES'
    break
  
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
data = [0 for i in range(N-1)]
for i in range(N-1):
    data[A[i]-1] += 1
for j in range(N-1):
    print(data[j], end = '\n')
# Judge status: Accepted
X,Y,Z = map(int,input().split())
temp = X-Z
ans = temp//(Y+Z)
print(ans)
# Judge status: Accepted
X = int(input())

if X >= 400 and X < 600:
  print(8)
elif X>= 600 and X < 800:
  print(7)
elif X>= 800 and X < 1000:
  print(6)
elif X>= 1000 and X < 1200:
  print(5)
elif X>= 1200 and X < 1400:
  print(4)
elif X>= 1400 and X < 1600:
  print(3)
elif X>= 1600 and X < 1800:
  print(2)
elif X>= 1800 and X < 2000:
  print(1)
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
a, b, c, d = a-1, b-1, c-1, d-1
s = input()

if "##" in s[a:d]:
    print("No")
    exit()

if c < d:
    for i in range(b, d):
        if s[i:i+2] == "##":
            print("No")
            exit()

    print("Yes")

else:
    for i in range(b, d+1):
        if s[i] != "#" and s[i-1] == "." and s[i+1] == ".":
            print("Yes")
            exit()

    print("No")
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    S = input()

    if S == "RRR":
        print(3)
    elif S[1:3] == "RR" or S[0:2] == "RR":
        print(2)
    else:
        ans = 0
        for s in S:
            if s == "R":
                ans = 1
        print(ans)






if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
S, T = input().split()
A, B = [int(i) for i in input().split()]
U = input()
dic = {S: A, T: B}
dic[U] -= 1
print(' '.join(map(str, dic.values())))
# Judge status: Accepted
l,r=map(int,input().split())
m=l//2019
l-=m*2019
r-=m*2019
if r>=2019:
    print(0)
    exit()
ans=2018
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans=min(ans,i*j%2019)
print(ans)
# Judge status: Accepted
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())
S = input()

white_count = [0]*(N+1)
black_count = [0]*(N+1)

for i in range(N):
  black_count[i+1] = black_count[i]
  if S[i] == "#":
    black_count[i+1] += 1
  
S = S[::-1]
for i in range(N):
  white_count[i+1] = white_count[i]
  if S[i] == ".":
    white_count[i+1] += 1

    
answer = 10**6
for i in range(N+1):
  answer = min(answer,black_count[i]+white_count[N-i])
  
print(answer)
# Judge status: Accepted
A = input()
count = 0
for a in range(3):
    if A[a] == 'R':
      count+=1
      
if count == 2 and A[1] == 'S':
      count = 1
print(count)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

cur = 1
cnt = 0
for a in A:
    if (a == cur):
        cur += 1
    else:
        cnt += 1

if cnt == N:
    print(-1)
else:
    print(cnt)
# Judge status: Accepted
n = int(input())
a_set = set(map(int, input().split()))
if len(a_set) == n:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
a = int(input())
lim = a // 2
soma_lista = []
menor = 100000
for i in range(a - 1, lim, -1):
    b = str(a - abs(i)) + str(abs(i))
    soma = 0
    for digit in b:
        soma += int(digit)
    if soma < menor:
        menor = soma
if a == 2:
    print(a)
print(menor)
# Judge status: Accepted
s = input()
count = 0
max_count = 0
for c in s:
  if c in ['A','C','G','T']:
    count += 1
    if max_count < count:
      max_count = count
  else:
    count = 0
print(max_count)
# Judge status: Wrong Answer
s=str(input())
t=str(input())
l=0
for i in range(len(s)-len(t)+1):
    print(s[i:i+len(t)])
    p=0
    for j in range(len(t)):
        if t[j] == s[i:i+len(t)][j]:
            p+=1
    l=max(l,p)
print(len(t)-l)
# Judge status: Accepted
a, b = map(int, input().split())

for i in range(1000):
  if b-a == i:
    print(i*(i-1)//2 - a)
    break
# Judge status: Accepted
n,d = map(int,input().split())
d += d + 1
print((n+d-1)//d)
# Judge status: Accepted
n = int(input())
a = []
b = []
for _ in range(n):
    aa, bb = list(map(int, input().split()))
    a.append(aa)
    b.append(bb)


import numpy as np

if n%2 == 0:
    print(int((np.median(b) - np.median(a)) / 0.5) + 1)
else:
    print(int((np.median(b) - np.median(a))) + 1)
# Judge status: Accepted
# スマホ
l=list(map(int,input().split()))
k=int(input())
s=max(l)
ans=sum(l)-s
ans+=s*pow(2,k)

print(ans)
# Judge status: Accepted
x,y=[int(_) for _ in input().split()]
ans=0
while x<=y:
  x*=2
  ans += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
ans = 0
if N>=105:
    ans = 1
print(ans)
# Judge status: Accepted
x = int(input())
gohyaku = x // 500
goen = (x -500*gohyaku) // 5
print(gohyaku*1000 + 5 * goen)
# Judge status: Accepted
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,M = MI()
A = [0]*(N+2)

for i in range(M):
    l,r = MI()
    A[l] += 1
    A[r+1] -= 1

from itertools import accumulate

A = list(accumulate(A))
print(sum(A[i] == M for i in range(1,N+1)))
# Judge status: Accepted
s=list(input())

while True:
    s.pop()
    l=len(s)
    if l%2==0 and s[0:l//2]==s[l//2:] :
        print(l)
        exit()
# Judge status: Wrong Answer
import numpy as np

D = int(input())
c = np.array( list(map(int, input().split())) )
#
s = [[] for i in range(D)]
for i in range(D):
  s[i] = np.array( list(map(int, input().split())) )
#
v = 0
cc =  np.array( [0]*26 )
last = np.array( [-1]*26 )
for d in range(D):
  cc += c
  av = s[d] - sum( cc ) + cc
  av2 = av + cc*min((D-d-1),13)
  m = max(av2)
  for t in range(26):
    if av2[t] == m:
      cc[t] = 0
      v += av[t]
      print(t+1)
      break
#
print( v )
# Judge status: Accepted
N = int(input())
List = [int(input()) for _ in range(N)]
s_list = sorted(List,reverse=True)
Max1 = s_list[0]
Max2 = s_list[1]

for i in range(N):
    if List[i]==Max1:
        print(Max2)
    else:
        print(Max1)
# Judge status: Wrong Answer
# coding: utf-8
d = {"h":0, "i":0}
S = input()
if len(S) == 1:
    print("No")
    exit()
flag = True
for i in range(len(S)-1):
    if S[i:i+2] != "hi":
        flag = False
        break
print("Yes" if flag else "No")
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a > 8 or b > 8:
  print(":(")
else:
  print("Yey!")
# Judge status: Accepted
N = int(input())
ans = 'No'
for i in range((N // 7) + 1):
  if (N - 7 * i) % 4 == 0:
    ans = 'Yes'
print(ans)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))
f2 = 0
f4 = 0
for a in A:
    #c = collections.Counter(prime_factorize(a))
    if a%4 == 0:
        f4 += 1
    elif a%2 == 0:
        f2 += 1
if n -f2//2 *2 -f4 *2 <= 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#!/usr/bin/env python3

n = int(input())

a = 0

while(1):
    tmp = n - 7*a
    if tmp % 4 == 0:
        print("Yes")
        exit()
    a += 1
    if a*7 > n:
        print("No")
        exit()
# Judge status: Wrong Answer
a = input()
if len(a) == 6:
    print("No")
else:
    if (a[2] == a[3])and(a[4] == a[5]):
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
m_list = []
m_num = 0

ans_ls = [0]*N
for i in range(N):
    temp = 0
    num = N - i
    j = 1
    while num*j <= N:
        temp += ans_ls[num*j-1]
        j += 1
    if (temp + a[num-1])%2 == 1:
        ans_ls[num-1] = 1
        m_list.append(str(num))
        m_num += 1
m_list.sort()

print(m_num)
print(' '.join(m_list))
# Judge status: Accepted
import sys
N=int(sys.stdin.readline().strip())
A=map(int, sys.stdin.readline().split())
A.sort(reverse=True)
N-=1
ans=0
for i,a in enumerate(A):
    if i==0:
        ans+=a
        N-=1
    else:
        if 2<=N:
            ans+=a*2
            N-=2
        elif N==1:
            ans+=a
            N-=1
        elif N==0:
            print ans
            quit()
# Judge status: Wrong Answer
S = input()
if (S[0:3] == 'key' and S[-4:] == 'ence') or (S[0:7] == 'keyence') or (S[-7:] == 'keyence'):
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
n, m = map(int, input().split())

ab = []

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

ab.sort()
ans = 0
if len(ab) == 1:
  if m >= ab[0][1]:
    print(ab[0][0] * ab[0][1])
    exit()
  else:
    print(ab[0][0] * m)
    exit()


for i, j in ab:
  for k in range(j):
    if m != 0:
      print(m)
      m -= 1
      ans += i
    else:
      print(ans)
      exit()
# Judge status: Accepted
a,b=input().split()
a=int(a)
b=int(b[0])*100+int(b[2])*10+int(b[3])
ans=a*b
print(int(ans//100))
# Judge status: Accepted
n = int(input())
l = [int(input()) for i in range(n)]
l2 = sorted(l)
c2 = l.index(l2[-2])
c = l.index(max(l))
d = max(l)
for i in range(n):
  if i != c:
    print(d)
  else:
    print(l2[-2])
# Judge status: Accepted
a = input()

if ord(a) >= 97:
    print("a")
else:
    print("A")
# Judge status: Accepted
n = int(input())

ans = [0] * (n + 1)
ans[0] = 2
ans[1] = 1

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

print(ans[-1])
# Judge status: Accepted
#n = int(input())
#s = input()
n,m = map(int,input().split())
#da = list(map(int,input().split()))

if(n == 1 and m == 1): print(1)
elif (n == 1 or m == 1): print(n*m-2)
else: print((m-2)*(n-2))
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

flag = 0
for num in range(N):
    tmp = A[num]
    flag = 0 if (tmp%2==0 and (tmp%3==0 or tmp%5==0)) or tmp%2==1 else 1
    if flag == 1:
        break

ans = 'APPROVED' if flag==0 else 'DENIED '
print(ans)
# Judge status: Accepted
k = int( input() )

# a = 7
# for _ in range( 30 ):
#     print( a % k )
#     a = 10 * a + 7

rem_list = []
first_rem = 7 % k
a = 7
cnt = 0
while True:
    r = a % k
    cnt += 1
    if r == 0:
        print( cnt )
        break
    elif cnt > 2 and cnt > k:
        print( -1 )
        break
    else:
        a = ( 10 * r + 7 ) % k
# Judge status: Wrong Answer
n,m,x,y=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
if y-x>=1:
  kouho=[t for t in range(y+1)][x+1:]
  p.sort()
  q.sort()
  c=0
  for i in range(0,len(kouho)-1):
    c+=1
    if p[n-1]<kouho[i]<=q[0]:
      print("No War")
      break
    if c==len(kouho):
      print("War")
else:
  print("War")
# Judge status: Wrong Answer
k,s = map(int,input().split())
ans = 0
for i in range(k+1):
	for j in range(k+1):
		if 0 <= s - i - j <= k: ans += 1
		elif s - i - j > k: break
print(ans)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())

if a < c and c < b and b < d:
  print(b-c)
elif a < c and d < b:
  print(b-a)
elif c < a and b < d:
  print(d-c)
else:
  print(0)
# Judge status: Accepted
str = input()

if str.isupper() == True:
  print('A')
else:
  print('a')
# Judge status: Wrong Answer
N,K=map(int,input().split())
p=list(map(int,input().split()))
B=0
p.sort()
N=N-5
K=K-1
for i in range(0,K):
    B=B+p[i]
    i=i+1
    
print(B)
# Judge status: Accepted
N = int(input())
L = [0] * (N + 1)


def f(i):
    if i == 0:
        return 2
    if i == 1:
        return 1
    if L[i] == 0:
        L[i] = f(i - 1) + f(i - 2)
    return L[i]


print(f(N))
# Judge status: Accepted
a = b = 0
for s in input():
  if s == 'S':
    a += 1
  else:
    if a == 0:
      b += 1
    else:
      a -= 1
print(a+b)
# Judge status: Accepted
num_list = [int(i) for i in input().split()]

if num_list[0] <= num_list[1]:
    print('unsafe')
else:
    print('safe')
# Judge status: Accepted
N,M = map(int,input().split())
if(N == M):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, k = map(int, input().split())
h = sorted([int(input()) for _ in range(n)])
min_diff = 10**9
for i in range(n - k + 1):
    min_diff = min(min_diff, h[i + k - 1] - h[i])
print(min_diff)
# Judge status: Wrong Answer
A, B = map(int, input().split())

print(-1 if A*B > 81 else A*B)
# Judge status: Wrong Answer
s = input()
L = "ACGT"
ans = ""
ss = ""
for i in range(len(s)):
  if s[i] in L:
    ans += s[i]
    flag = True
  else:
    if len(ans)>len(ss):
      ss = ans
      break
print(len(ss))
# Judge status: Accepted
n,d=map(int,input().split())
c=0
for _ in range(n):
    x,y=map(int,input().split())
    k=(x**2+y**2)**(1/2)
    if k<=d:
        c+=1
print(c)
# Judge status: Accepted
import sys

N, M = map(int, input().split())
num_map = [None for _ in range(N)]
for _ in range(M):
    s, c = map(int, input().split())
    s -= 1
    if s > N or (num_map[s] is not None and num_map[s] != c) or (s == 0 and c == 0 and N > 1):
        print(-1)
        sys.exit()
    num_map[s] = c
num_map.reverse()

ans = 0
for i, num in enumerate(num_map):
    if num is not None:
        ans += num*(10**i)
    elif i == N-1 and N > 1:
        ans += (10**i)
print(ans)
# Judge status: Wrong Answer
S = input()
T = S.replace("*","x")
print(T)
# Judge status: Accepted
n,a,b=map(int,input().split())
s=input()
j=0#japan
f=0#foreign
for i in s:
    if i=='a':
        if j+f<a+b:
            j+=1
            print('Yes')
        else:
            print('No')
    elif i=='b':
        if j+f<a+b and f<b:
            f+=1
            print('Yes')
        else:
            print('No')
    else:
        print('No')
# Judge status: Wrong Answer
import sys
input = lambda: sys.stdin.readline().rstrip()

A,B,T = map(int, input().split())

T = T + 0.5

times = T // A

print(B*times)
# Judge status: Wrong Answer
n,m=map(int,input().split())
print(n//2+m//2)