peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())

paper = []
numbers = sorted([int(input()) for _ in range(N)])

# for n in numbers:
for i in range(N - 1):
    if numbers[i] == numbers[i + 1]:
        numbers[i] = -1
        numbers[i + 1] = -1
    if numbers[i] != -1:
        paper.append(numbers[i])

if numbers[N - 1] != -1:
    paper.append(numbers[N - 1])
print(len(paper))
# Judge status: Wrong Answer
import itertools

n = int(input())

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

zzz = list(itertools.combinations(l,2))


cnt = 0
print(zzz)

for z in zzz:

    b = z[0]
    c = z[1]

    b_flg = True

    c_flg = True

    for i in l:
        if b_flg and i == b:
            continue

        if c_flg and i == c:
            continue
                
        if abs(b-c) < i < b+c:
            cnt += 1

print(cnt / 3)
# Judge status: Accepted
n, m = map(int,input().split())
lst = []
for i in range(m):
    lst.append(list(map(int,input().split())))

min = lst[0][0]
max = lst[0][1]
for v in lst:
    if v[0] > min:
        min = v[0]
    if v[1] < max:
        max = v[1]
if min <= max:
    print(max-min + 1)
elif min > max:
    print(0)
# Judge status: Accepted
def solve():
    N, M = map(int, input().split())
    
    if N == 1 and M == 1:
        print(1)
    elif N == 1 or M == 1:
        print(N * M - 2)
    else:
        print(N * M - (N * 2 + M * 2 - 4))

if __name__ == '__main__':
    solve()
# Judge status: Accepted
N = int(input())
l_x = list(map(int, input().split()))
d_min = 999999999999999
left = min(l_x)
right = max(l_x)
for p in range(left, right + 1):
  total = 0
  for x in l_x:
    total += (p - x) ** 2
  if total < d_min:
    d_min = total

print(d_min)
# Judge status: Accepted
a = input().split()
dist = int(a[0])
time = int(a[1])
speed = int(a[2])
if(speed * time < dist):
	print("No")
else:
	print("Yes")
# Judge status: Wrong Answer
k = input()
s = input()
print(s)
if(len(s) <= int(k)):
  print(s)
else:
  print(s[:int(k)])
# Judge status: Accepted
n = int(input())
ans = 0

for i in range(1, n + 1):
    y = n // i
    ans += y * (y+1) * i // 2
print(ans)
# Judge status: Wrong Answer
n=int(input())
s=input()
x=""
y=""
saidai=0
for i in range(n):
    x=s[:i+1]
    y=s[i:]
    #print(x,y)
    x_y_and=set(x)&set(y)
    if len(x_y_and)>saidai:
        saidai=len(x_y_and)
    x=""
    y=""
    x_y_and=""
print(saidai)
# Judge status: Accepted
N = int(input())
T = [int(input()) for _ in range(N)]

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

ans = 1
for i in T :
    ans = lcm(ans, i)

print(ans)
# Judge status: Accepted
n = int(input())
V = list(map(int, input().split()))

V = sorted(V)

for i in range(n-1):
  V[0] = (V[0] + V[1]) / 2
  del V[1]

print(V[0])
# Judge status: Wrong Answer
n = str(input())
if len(n) <= 2:
    print(0)
else:
    a = n[0:-2]
    tens = int(n[-2])
    need = tens*2
    ones = int(n[-1])
    if ones < 5:
        need += 1
    else:
        need +=2

    if need < int(a):
        print(1)
    else:
        print(0)
# Judge status: Accepted
S=str(input())
print('x'*len(S))
# Judge status: Accepted
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)

ans = 0

for i in range(1, 2*n, 2):
    ans += a[i]

print(ans)
# Judge status: Accepted
#B - Making Triangle
N = int(input())
L = list(map(int,input().split()))
count = 0
for i in range(N-2):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[i]+L[j]>L[k] and L[i]+L[k]>L[j] and L[k]+L[j]>L[i] and L[i] != L[j] and L[j] != L[k] and L[k]!=L[i]:
                count += 1
            else:
                pass

print(count)
# Judge status: Accepted
N = int(input())
Monster = list(map(int, input().split()))
Yusha = list(map(int, input().split()))

total = 0

for i in range(N+1):
    if i > 0:
        Min = min(Monster[i], Yusha[i-1])
        Monster[i] -= Min
        Yusha[i-1] -= Min
        total += Min

    if i < N:
        Min = min(Monster[i], Yusha[i])
        Monster[i] -= Min
        Yusha[i] -= Min
        total += Min

print(total)
# Judge status: Accepted
import numpy as np
from fractions import gcd
n,x=map(int,input().split())
xl=list(map(int,input().split()))

xl.append(x)


p=min(xl)
ans=x-p
for i in range(n+1):
    ans=gcd(xl[i]-p,ans)
print(ans)
# Judge status: Wrong Answer
import itertools

def main():
    n = int(input())
    nums = []
    for i in range(2):
        nums.append(list(map(str, input().split())))
    kumi = list(itertools.permutations([str(i) for i in range(1, n+1)], n))
    f, t = 0, 0
    for i, s in enumerate(kumi):
        if ''.join(nums[0]) == ''.join(s):
            f = i
        elif ''.join(nums[1]) == ''.join(s):
            t = i
    print(abs(f - t))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N,M = map(int, input().split())

ans = 0
if M>=2*N:
    ans = ans + N
    M = M - 2*N
    N = N - N
    ans = ans + M//4
    print(ans)
else:
    print(0)
# Judge status: Wrong Answer
##import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
a,b,c,x,y=map(int,input().split())
if x<y:
    ans=min((a*x+b*y),2*x*c+a*(y-x),2*y*c)
    
else:
    ans=min((a*x+b*y),2*y*c+b*(x-y),2*x*c)
print(ans)
# Judge status: Accepted
s = input()
t = input()
ls = len(s)
lt = len(t)

def match(k):
    for i in range(lt):
        if t[i] != s[i+k] and s[i+k] != '?':
            return False
    return True

c = -1
for i in range(ls-lt+1):
    if match(i):
        c = i

if c == -1:
    print('UNRESTORABLE')
else:
    ans = s[:c]
    ans += t
    ans += s[len(ans):]
    print(ans.replace('?', 'a'))
# Judge status: Accepted
def main():
    N, M = map(int, input().split())
    answer = [[0]*M for n in range(N)]
    for i in range(N):
        K, *A = map(int, input().split())
        for a in A:
            answer[i][a-1] = 1
    count = 0
    for j in range(M):
        same = 0
        for i in range(N):
            same += answer[i][j]
        if same == N:
            count += 1
    print(count)
main()
# Judge status: Accepted
n,*l=map(int,open(0).read().split())
t=0
for i in l:
  if i<t: print('No'); break
  if i>t: i-=1
  t=i
else: print('Yes')
# Judge status: Accepted
n,m = map(int,input().split())
if n == m == 1:
    print(1)
elif min(n,m) == 1:
    print(max(0, max(n,m) - 2))
else:
    print((n-2) * (m-2))
# Judge status: Accepted
import sys
import numpy as np

# input = sys.stdin.readline

s = input()

if (s == "AAA") or (s == "BBB"):
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
s=list(input())
s.sort()
if s[0]==s[1] and s[2]==s[3]:print('Yes')
else:print('No')
# Judge status: Wrong Answer
#A
n,m=map(int,input().split())
if n<=1:
    n_ans=0
else:
    n_ans=n*(n-1)/2

if m<=1:
    m_ans=0
else:
    m_ans=m*(m-1)/2
    

print(n_ans+m_ans)
# Judge status: Accepted
n, m = map(int, input().split())

print("Yes" if n == m else "No")
# Judge status: Accepted
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    *A, d = nm()
    a = A[0]
    c = A[2]
    A = sorted(A)
    D = [A[i + 1] - A[i] for i in range(2)]
    if all([dd <= d for dd in D]) or abs(a - c) <= d:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N, x = map(int, input().split())
a = list(map(int, input().split()))

cont = 0

for y in sorted(a):
    if x >= y:
        cont += 1
        x -= y

if x != 0:
    cont = cont-1
print(cont)
# Judge status: Wrong Answer
n = int(input())
arr = list(map(int,input().split()))
t = int(input())
while t:
    t-=1
    k,r = map(int,input().split())
    arr.sort()
    if k in arr:
        for i in range(n):
            if arr[i]>k:
                break
            if arr[i]==k:
                arr[i]=r
            
    print(arr)
    print(sum(arr))
# Judge status: Accepted
S, W = map(int, input().split())
print("unsafe" if S <= W else "safe")
# Judge status: Accepted
import queue

k = int(input())

lunlun = queue.Queue()
for i in range(1,10):
    lunlun.put(i)

def make_lunlun(p):
    last = p%10
    if last != 0:
        lunlun.put(p * 10 + last - 1)
    lunlun.put(p*10 + last)
    if last != 9:
        lunlun.put(p * 10 + last + 1)

i = 0
while i < k:
    p = lunlun.get()
    make_lunlun(p)
    i += 1
    if i == k:
        print(p)
        break
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))

for i in range(n - 1):
    if h[i] - h[i + 1] > 1:
        print('No')
        break

    elif h[i] - h[i + 1] == 1:
        if x == 1:
            print('No')
            break
        else:
            x = 1


    elif h[i] - h[i + 1] < 1:
        x = 0

else:
    print('Yes')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

cnt = 0
cnt4 = 0
for i in a:
    if i%2==1:
        cnt+=1
    if i%4==0:
        cnt4+=1
    
if n-cnt == cnt4:
    if cnt4>=n//2:
        print('Yes')
    else:
        print('No')
elif cnt4>=cnt:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a = input()
if a==1:
  print(0)
else:
  print(1)
# Judge status: Accepted
import math

N=input()

if N[0]==N[1]==N[2] or N[1]==N[2]==N[3]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
L = [2, 1]
for i in range(N):
    L.append(L[-2] + L[-1])
print(L[N])
# Judge status: Accepted
n,k = map(int,input().split())
n += 1
p = 0
for i in range(k,n+1):
    p += i * (n - i)+1
    p %= 1000000007
print(p)
# Judge status: Wrong Answer
n,k =list(map(int,input().split()))
A=1

while True:
    n =n//k
    A+=1
    if n//k<1:
        break
print(A)
# Judge status: Accepted
# -*- coding: utf-8 -*-
N, R = map(int, input().split())

print(100 * (10 - N) + R if N < 10 else R)
# Judge status: Accepted
L = list(map(int,list(input())))
L = [0] + L
N = len(L)
dp1 = [0 for _ in range(N+1)]
dp2 = [0 for _ in range(N+1)]

for i in range(N):
    dp1[i+1] = min(dp1[i] + L[i], dp2[i] + 10 - L[i])
    dp2[i+1] = min(dp2[i] + 10 - L[i] - 1, dp1[i] + L[i] + 1)

print(dp1[-1])
# Judge status: Accepted
N=list(input())
if N[0]=='9' or N[1]=='9':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = list(map(str,input()))
a,b,c = 0,0,0

for i in range(len(s)):
    if s[i] == "a":
        a += 1
    elif s[i] == "b":
        b += 1
    else:
        c += 1

if abs(a-b) <= 1 and abs(b-c) <= 1 and abs(c-a) <= 1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N, M = map(int, input().split())
ITEMS = list(map(int, input().split())) 
MAX = sum(ITEMS)
def solve():
    count = 0
    for item in reversed(list(sorted(ITEMS))):
        if item >= MAX * (1 / (4 * M)):
            count += 1
        if count >= M:
            print("Yes")
            return 
    
    print("No")
    
solve()
# Judge status: Accepted
#!/usr/bin/env python3
a = int(input()) 
print(a + a ** 2 + a ** 3)
# Judge status: Accepted
N = int(input())
for i in range(int(N * 0.9), N + 1):
    if int(i * 1.08) == N:
        print(i)
        break
else:
    print(':(')
# Judge status: Accepted
n = int(input())

c0 = 0
c1 = 0
c2 = 0
c3 = 0

for i in range(n):
  s = input()
  if s == "AC":
    c0 += 1
  elif s == "WA":
    c1 += 1
  elif s == "TLE":
    c2 += 1
  elif s == "RE":
    c3 += 1
print("AC x {}".format(c0))
print("WA x {}".format(c1))
print("TLE x {}".format(c2))
print("RE x {}".format(c3))
# Judge status: Accepted
n = int(input())
d = {tuple(map(str, input().split())):i for i in range(1,n+1)}
sort_d = sorted(d.items(), key=lambda x:(x[0][0],-int(x[0][1]))) #点数に－で降順でマイナス順になる
r = []
for i in sort_d:
  print(i[1])
# Judge status: Wrong Answer
n=int(input())
print(int((n*(n-1))/2))
# Judge status: Wrong Answer
x, n = map(int, input().split())
if n ==0:
    print(x)
else:
    p = list(map(int, input().split()))
    q = list(range(101))
    a = x
    for i in range(x, 0, -1):
        if p.count(i) == 0:
            a = i
            break

    b = x
    for i in range(x, 101):
        if p.count(i) == 0:
            b = i
            break

    if abs(x-a) > abs(x-b):
        print(b)
    else:
        print(a)
# Judge status: Wrong Answer
N, K, S = map(int, input().split())
A = []
for i in range(K):
  A.append(S)
for i in range(K, N):
  A.append(S+2)
print(*A)
# Judge status: Accepted
from collections import defaultdict
d = defaultdict(int)
for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      a = i**2+j**2+k**2+i*k+k*j+j*i
      d[a] += 1
      
n = int(input())
for i in range(1,n+1):
  print(d[i])
# Judge status: Accepted
N = int(input())
A = [int(_) for _ in input().split()]

cnt = 0
for i in range(N):
    if A[i] < 0:
        cnt += 1
        A[i] *= -1

if cnt % 2 == 0:
    print(sum(A))
else:
    print(sum(A) - min(A) * 2)
# Judge status: Wrong Answer
INF = 10 ** 4 + 10

n = int(input())
H = list(map(int, input().split()))
DP = [INF] * n
DP[0] = 0
DP[1] = abs(H[1] - H[0])
for i in range(2, n):
    DP[i] = min(DP[i], DP[i-1] + abs(H[i] - H[i-1]))
    DP[i] = min(DP[i], DP[i-2] + abs(H[i] - H[i-2]))
print(DP[-1])
# Judge status: Accepted
S = input()
a = [0 for i in range(len(S)+1)]
for i, x in enumerate(S):
    if x == '<':
        a[i+1] = max(a[i+1], a[i]+1)
for i in range(len(S)):
    if S[-i-1] == '>':
        a[-i-2] = max(a[-i-2], a[-i-1]+1)
print(sum(a))
# Judge status: Wrong Answer
K,X=map(int,input().split())
ans=list(range(X-(K-1),X+K))
print(ans)
# Judge status: Accepted
n, m = [int(x) for x in input().split()]

xs = []
for i in input().split():
    xs.append(int(i))

bound = 1/4/m * sum(xs)

count = 0
for x in xs:
    if x >= bound:
        count += 1

print('Yes') if count >= m else print('No')
# Judge status: Accepted
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input_int()
    x0 = y0 = 0
    x1 = 1
    x2 = 10**9
    y2 = -S % 10**9
    y1 = (S + y2) // 10**9

    print(x0, y0, x1, y1, x2, y2)
    return


if __name__ == "__main__":
    main()
# Judge status: Accepted
letters = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
L = len(letters)

n = int(input())
word = input()
result = ''

for letter in word:
  idx = letters.index(letter)
  f_idx = (idx + n) % L
  result += letters[f_idx]

print(result)
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    S = input().rstrip()

    ans = 0
    for i in range(N):
        if S[i] == "#":
            ans = S[i + 1:].count(".")
            break

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
x,y,z = map(int,input().split())
if (y-x)==(z-y):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N, C, K = list(map(int, input().split()))
T = [int(input()) for _ in range(N)]
T.sort()
i = 0
res = 0
while i < N:
    j = 0
    while i < N and j < C and T[i] - T[i - j] <= K:
        i += 1
        j += 1
    res += 1
print(res)
# Judge status: Accepted
N,A,B = map(int,input().split())
S = input()
pas = 0
num = A + B
kaigai = 0
for i in range(len(S)):
    if S[i] == "a":
        if pas < num:
            pas += 1
            print("Yes")
        else:
            print("No")
    elif S[i] == "b":
        kaigai += 1
        if pas < num and kaigai <= B:
            pas += 1
            print("Yes")
        else:
            print("No")
    else:
        print("No")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

count = 0
for i in range(n):
    count += min(a[i], b[i])
    b[i] = max(b[i]-a[i], 0)

    count += min(a[i+1], b[i])
    b[i] = max(b[i] - a[i+1], 0)
    a[i+1] = max(a[i+1] - b[i], 0)

print(count)
# Judge status: Accepted
# ABC144A

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

print(a * b if 1 <= a <= 9 and 1 <= b <= 9 else -1)
# Judge status: Accepted
n, k = map(int, (input().split()))
arr = [0] * 100100
for i in range(n):
    a, b = map(int, input().split())
    arr[a] += b

cur = 0
for i in range(100100):
    cur += arr[i]
    if cur >= k:
        print(i)
        break
# Judge status: Accepted
from collections import Counter
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)


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 = gete(int)
    s = []
    for _ in range(n):
        s.append(gete())

    c = Counter(s)

    for v in ['AC', 'WA', 'TLE', 'RE']:
        print(v, "x", c[v])


if __name__ == "__main__":
    main()
# Judge status: Accepted
import collections
n=int(input())
l=list(map(int, input().split()))
q=int(input())
s=sum(l)
d=collections.Counter(l)
for i in range(q):
    a,b=map(int, input().split())
    s=s-(a*d[a])
    s=s+(b*d[a])
    d[b]=d[b]+d[a]
    d[a]=0
    print(s)
# Judge status: Accepted
a= list(str(input()))


for i in range(2**3):
    x = ["+","+","+"]
    for j in range(len(a)):
        if (i >> j) & 1 == 1:
            x[j] = "-"
    if eval(a[0]+x[0]+a[1]+x[1]+a[2]+x[2]+a[3]) == 7:
        print(a[0]+x[0]+a[1]+x[1]+a[2]+x[2]+a[3]+"=7")
        break
# Judge status: Accepted
W, a, b = map(int, input().split())
if(a > b):
  [a,b] = [b,a]

print(max(b-a-W,0))
# Judge status: Accepted
n, m = map(int, input().split())
mod = 10 ** 9 + 7
if abs(n - m) >= 2:
    ans = 0
elif abs(n - m) == 1:
    if m > n:
        m, n = n, m
    c = 1
    for i in range(1, n):
        c *= i
        c %= mod
    l = (c * n) % mod
    ans = c * l % mod
else:
    c = 1
    for i in range(1, n + 1):
        c *= i
        c %= mod
    ans = (c * c * 2) % mod
print(ans)
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(N)]

G = [1]
for i in range(N):
    G.append(A[G[-1]-1])
    
ans = 0
ok = False
for i in range(N+1):
    if G[i]==2:
        ok = True
        break
    ans += 1

if not ok:
    ans = -1
    
print(ans)
# Judge status: Accepted
s = input()

a = s.count("a")
b = s.count("b")
c = s.count("c")

mx = max(a, b, c)
mn = min(a, b, c)

if mx - mn > 1:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
pre = a[0]
for ai, bi in zip(a[1:], b):
    if pre <= bi:
        ans += pre
        bi -= pre
    else:
        ans += bi
        bi = 0
    pre = ai
    if pre <= bi:
        ans += pre
        pre = 0
    else:
        ans += bi
        pre -= bi
print(ans)
# Judge status: Accepted
N = int(input())

ans = 0
L = []
ans_L = {}

for i in range(N):
    L.append(int(input()))

for j in L:
    if not j in ans_L.keys():
        ans_L[j] = 0
    
    if ans_L[j]==0:
        ans_L[j] += 1
    elif ans_L[j]== 1:
        ans_L[j] -= 1

print(sum(ans_L.values()))
# Judge status: Accepted
n = int(input())
d = {}

for _ in range(n):
    s = input()
    if(s in d):d[s] += 1
    else:d[s] = 1

d = sorted(d.items(),key=lambda x:(x[1],x[0]),reverse=True)

m = d[0][1]
l = []
for i in range(len(d)):
    if(d[i][1] < m):break
    l.append(d[i][0])
l.sort()
for r in l:print(r)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a > k:
    print(":(")
elif e - b > k:
    print(":(")
elif e - c > k:
    print(":(")
elif e - d > k:
    print(":(")
else:
    print("Yay!")
# Judge status: Wrong Answer
s = input() 
print(s[0]+s[8]+s[10])
# Judge status: Wrong Answer
import sys

n = int(input())
cnt = 0
for i in range(n):
    a,b = map(int,input().split())
    if cnt == 3:
        print('Yes')
        sys.exit()
    if a == b:
        cnt += 1
    else:
        cnt = 0
print('No')
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for _ in range(n)]
print(a)
ans = 0
lst = [a[0]]*2
for aa in a:
    if aa <= lst[0]:
        lst[0] = aa
        ans += 1
    elif lst[0] < aa <= lst[1]:
        lst[0] = aa
    elif aa > lst[1]:
        lst[1] = aa
    else: lst[0] = aa
print(ans)
# Judge status: Accepted
T = input()
print(''.join(['D' if s=='?' else s for s in T]))
# Judge status: Accepted
n, k = map(int, input().split())
s, p, r = map(int, input().split())
t = input()

cnt = 0
for i in range(k):
    f = 0
    pre = ""
    for j in range(i, n, k):
        if pre != t[j] or f == 1:
            cnt += eval(t[j])
            f = 0
        else:
            f = 1
        pre = t[j]
print(cnt)
# Judge status: Wrong Answer
n=int(input())
a = [int(input()) for _ in range(n)]
ans=0
a.sort()
for i in a:
    if sum(a)%10 == 0:
        a.remove(i)
    else:
        print(sum(a))
        exit(0)
print(0)
# Judge status: Accepted
S = input()
print(len([True for i in range(len(S)//2) if S[i] != S[-1-i]]))
# Judge status: Accepted
A=[int(i) for i in input().split()]
K=int(input())
print(max(A)*(2**(K)-1)+sum(A))
# Judge status: Accepted
import numpy as np

n, m = map(int, input().split())

As = np.asarray(input().split(), dtype=np.int32)

ans = n - np.sum(As)

if ans < 0:
    print(-1)
else:
    print(ans)
# Judge status: Wrong Answer
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

cnt1 = 0
cnt4 = 0
for a in A:
    if a%4 == 0:
        cnt4 += 1
    else:
        cnt1 += 1

if cnt1 <= cnt4:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(input())
D = list(map(int, input().split()))
D.sort()

num = N // 2
arc = 0
for _ in range(N):
    arc_first = D.pop()
    arc += 1
    if arc == num:
        break
abc_last = D.pop()

if abc_last == arc_first:
    # 同じ数にできない
    ans = 0
else:
    ans = arc_first - abc_last

print(ans)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, A, B, C, D = map(int, rl().split())
    S = input()
    
    if C < D:
        if S[A - 1:D].find('##') == -1:
            print('Yes')
        else:
            print('No')
    else:
        if S[B - 2:D + 1].find('...') == -1:
            print('No')
        else:
            print('Yes')


if __name__ == '__main__':
    solve()
# Judge status: Accepted
import itertools
N = int(input())
nums = map(int, input().split(" "))
num_comb = list(itertools.combinations(nums, 3))

counter = 0
for _nums in num_comb:
    nums = list(_nums)
    nums.sort()
    n_pure = len(set(nums))
    # print(nums, n_pure)
    if (nums[0] + nums[1] > nums[2]) & (n_pure == 3):
        counter += 1
        
print(counter)
# Judge status: Accepted
A,B,C = map(int,input().split())
A,B = B,A

A,C = C,A
print(A,B,C)
# Judge status: Accepted
import numpy as np
import functools
import math
import collections
import scipy
import fractions
import itertools
 
def solve():
  a, b, c, d = map(int, input().split())
  a -= 1
  lc = (c*d)//fractions.gcd(c,d)
  ans = (b-a)-(b//c-a//c)-(b//d-a//d)+(b//lc-a//lc)
  print(ans)
  return 0
 
if __name__ == "__main__":
  solve()
# Judge status: Accepted
import collections

def main():
    S = list(input())
    Sset = set(S)
    if len(Sset) in [1, 3]:
        print('No')
    elif Sset == set(['S', 'N']) or Sset == set(['W', 'E']):
        print('Yes')
    elif len(Sset) == 4:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
# Judge status: Accepted
from statistics import median

n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]

a = [ab[i][0] for i in range(n)]
b = [ab[i][1] for i in range(n)]

if n % 2 == 0:
    ma, mb = median(a), median(b)
    print(int(2 * mb - 2 * ma + 1))
if n % 2 == 1:
    ma, mb = median(a), median(b)
    print(int(mb - ma + 1))
# Judge status: Wrong Answer
D,N = map(int,input().split())
print(N*100**D)
# Judge status: Accepted
r = int(input())

print((r**2)//1)