Harryxun/stf_run huggingface dataset:
hoge = [int(x) for x in input().split()]
moji = ''
char = {}
for i in range(hoge[0]):
    moji += input()
for m in moji:
    if m in char:
        char[m] += 1
    else:
        char.update({m:1})

four = 0
two = 0
one = 0
for c in char:
    while(char[c] > 0):
        four += char[c] / 4:
        two += char[c]%4/2:
        one += char[c]%2:

if four*4+two*2+one == hoge[0]*hoge[1]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

H,W = list(map(int, input().split()))
moji = ''
char = {}
for i in range(H):
    moji += input()
for m in moji:
    if m in char:
        char[m] += 1
    else:
        char.update({m:1})

four = 0
two = 0
one = 0
for c in char:
    four += int(char[c] / 4)
    two += int(char[c]%4/2)
    one += int(char[c]%2)

ans = [(H//2)*(W//2), (H//2)*(W%2)+(H%2)*(W//2), (H%2)*(W%2)]
four -= ans[0]
while(four > 0):
    four -= 1
    ans[1] -= 2
if two == ans[1] and one == ans[2]:
    print("Yes")
else:
    print("No")
A = int(input())
A_array = map(int, input().split())
A_sum = A_array[0] + A_array[1] + A_array[2]
if(A_sum < 22):
    print('win')
else:
    print('bust')


### FIXED CODE ###

# coding: utf-8
A = list(map(int, input().split()))
A_sum = sum(A)
if(A_sum > 21):
    print('bust')
else:
    print('win')
n,a,b = map(int,input().split())
print(min(a*n, b)

### FIXED CODE ###

n,a,b = map(int,input().split())
print(min(a*n, b))
import sys
import heapq

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N, K = na()

A_array = na()

cusum = 0
mod_array = [0]
for i, a in enumerate(A_array):
    cusum = (cusum + a) % K
    mod = (cusum + K - (i+1)) % K
    mod_array.append(mod)

# print(mod_array)

ans = 0
mod_queue = []
cnt_array = [0] * N
for i, v in enumerate(mod_array):
    heapq.heappush(mod_queue, (i, 1, v))

while(len(mod_queue)):
    i, q, v = heapq.heappop(mod_queue)
    if q == 1:
        ans += cnt_array[v]
        cnt_array[v] += 1
        heapq.heappush(mod_queue, (i+K-0.5, 2, v))
    else:
        cnt_array[v] -= 1
    # print(i, v, q, ans)

print(ans)


### FIXED CODE ###

import sys
import heapq
from collections import defaultdict

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N, K = na()

A_array = na()

cusum = 0
mod_array = [0]
for i, a in enumerate(A_array):
    cusum = (cusum + a) % K
    mod = (cusum + K - (i+1)) % K
    mod_array.append(mod)

# print(mod_array)

ans = 0
mod_queue = []
cnt_dic = defaultdict(int)
for i, v in enumerate(mod_array):
    heapq.heappush(mod_queue, (i, 1, v))

while(len(mod_queue)):
    i, q, v = heapq.heappop(mod_queue)
    if q == 1:
        ans += cnt_dic[v]
        cnt_dic[v] += 1
        if i + K <= N:
            heapq.heappush(mod_queue, (i+K-0.5, 2, v))
    else:
        cnt_dic[v] -= 1
    # print(i, v, q, ans)

print(ans)
n,m=map(int,input().split())
mx =[0 for i in range(0,n)]
for z in range(0,m):
  a,b=map(int,input().split())
  mx[b]=max(mx[b],a)
cnt=0
cn=0
for z in range(0,n):
  if cut<mx[z]:
   	cut=z
    cn=cn+1
print(cn)

### FIXED CODE ###

n,m=map(int,input().split())
mx =[-1 for i in range(0,n)]
for z in range(0,m):
  a,b=map(int,input().split())
  mx[b-1]=max(mx[b-1],a-1)
cut=-1
cn=0
for z in range(0,n):
	if cut<mx[z]:
		cut=z-1
		cn=cn+1
print(cn)
a = int(raw_input())
b = int(raw_input())
 
if a != 3 and b != 3:
  print(str(3))
elif a != 2 and B != 2:
  print(str(2))
else:
  print(str(1))

### FIXED CODE ###

a = int(input())
b = int(input())
 
if (a != 1 and b != 1):
  print(1)
elif (a != 2 and b != 2):
  print(2)
else:
  print(3)
N=int(imput())
K=int(imput())
if N%K =0:
  print("0")
  else:
    print("1")

### FIXED CODE ###

N, K = map(int, input().split())
if N%K == 0:
  print(0)
else:
  print(1)
import math
n, d = map(input().split())
se = d * 2 + 1
print(math.ceil(n/se))


### FIXED CODE ###

import math
n, d = map(int, input().split())
se = d * 2 + 1
print(math.ceil(n/se))
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    def comb(a,b):
        return fact[a]*inv_fact[b]*inv_fact[a-b]%mod
    mod = 998244353
    n,a,b,k = LI()
    fact = [1]*(n+1)
    for i in range(1,n+1):
        fact[i] = fact[i-1]*i%mod
    inv_fact = [None]*(n+1)
    inv_fact[n] = pow(fact[n],mod-2,mod)
    for i in range(n)[::-1]:
        inv_fact[i] = inv_fact[i+1]*(i+1)%mod

    ans = 0
    for x in range(n+1):
        if (k-a*x)%b == 0:
            y = (k-a*x)//b
            ans += comb(n,x)*comb(n,y)%mod
    print(ans)

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    return

#B
def B():
    def comb(a,b):
        return fact[a]*inv_fact[b]*inv_fact[a-b]%mod
    mod = 998244353
    n,a,b,k = LI()
    fact = [1]*(n+1)
    for i in range(1,n+1):
        fact[i] = fact[i-1]*i%mod
    inv_fact = [None]*(n+1)
    inv_fact[n] = pow(fact[n],mod-2,mod)
    for i in range(n)[::-1]:
        inv_fact[i] = inv_fact[i+1]*(i+1)%mod

    ans = 0
    for x in range(n+1):
        if (k-a*x)%b == 0 and k >= a*x and k-a*x <= n*b:
            y = (k-a*x)//b
            ans += comb(n,x)*comb(n,y)%mod
        ans %= mod
    print(ans)

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()
from collections import defaultdict

def seq():
    a = 1
    while True:
        yield a
        a += 1

def dfs(here, went, connect, discovery, low, answer, seq):
    went |= {here}
    discovery[here] = low[here] = next(seq)
    child = 0
    for con in connect[here]:
        if con not in went:
            parent[con] = here
            child += 1
            dfs(con, went, connect, discovery, low, answer, seq)
            low[here] = min(low[here], low[i])
            if parent[here] is None and child >= 2:
                answer.append(here)
            elif parent[here] is not None and discovery[here] <= low[con]:
                answer.append(here)
        elif parent[here] != parent[con]:
            low[here] = min(low[here], discovery[con])

vertices, edges = (int(n) for n in input().split(" "))
connect = defaultdict(list)
for _ in range(edges):
    v1, v2 = (int(n) for n in input().split(" "))
    connect[v1].append(v2)
    connect[v2].append(v1)
answer = []
new_seq = seq()
went = set()
discovery = [None for n in range(vertices)]
low = [None for n in range(vertices)]
parent = [None for n in range(vertices)]
dfs(0, went, connect, discovery, low, answer, new_seq)
for a in sorted(answer):
    print(a)

### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(100000)

def seq():
    a = 1
    while True:
        yield a
        a += 1

def dfs(here, went, connect, discovery, low, answer, seq):
    went |= {here}
    discovery[here] = low[here] = next(seq)
    child = 0
    for con in connect[here]:
        if con not in went:
            parent[con] = here
            child += 1
            dfs(con, went, connect, discovery, low, answer, seq)
            low[here] = min(low[here], low[con])
            if parent[here] is None and child >= 2:
                answer[here] = 1
            elif parent[here] is not None and discovery[here] <= low[con]:
                answer[here] = 1
        elif parent[here] != con:
            low[here] = min(low[here], discovery[con])

vertices, edges = (int(n) for n in input().split(" "))
connect = defaultdict(list)
for _ in range(edges):
    v1, v2 = (int(n) for n in input().split(" "))
    connect[v1].append(v2)
    connect[v2].append(v1)
answer = [0 for n in range(vertices)]
new_seq = seq()
went = set()
discovery = [0 for n in range(vertices)]
low = [float("inf") for n in range(vertices)]
parent = [None for n in range(vertices)]
dfs(0, went, connect, discovery, low, answer, new_seq)
for i,n in enumerate(answer):
    if n:
        print(i)
def par(a):
    L = []
    while P[a] != a:
        L.append(a)
        a = P[a]
    for l in L:
        P[l] = a
    return a
def unite(a, b):
    pa = par(a)
    pb = par(b)
    if pa == pb: return
    if LEN[pa] < LEN[pb]:
        a, b, pa, pb = b, a, pb, pa
    P[pb] = pa
    if LEN[pa] == LEN[pb]: LEN[pa] += 1
    CNT[pa] += CNT[pb]
def cnt(a):
    return CNT[par(a)]

N = int(input())
P = [i for i in range(N)]
LEN = [1] * N
CNT = [1] * N
FULL = [0] * N
A = [int(a) - 1 for a in input().split()]
for i, a in enumerate(A):
    if a < 0: continue
    if par(i) != par(a):
        unite(i, a)
    else:
        FULL[i] = 1
for i in range(N):
    if FULL[i]:
        FULL[par(i)] = 1
X = []
Y = []
for i in range(N):
    if par(i) == i:
        if FULL[i] == 0:
            X.append(CNT[i])
        else:
            Y.append(CNT[i])
M = len(X)
mod = 10 ** 9 + 7
K = 96
m = int(("1" * 32 + "0" * 64) * 5050, 2)
pa = (1 << 64) - ((1 << 64) % mod)
modP = lambda x: x - ((x & m) >> 64) * pa
ans = (sum(X) + sum(Y) - len(Y)) * pow(N - 1, M, mod) % mod
x = 1
for i, a in enumerate(X):
    x *= (a << K) + 1
    x = modP(x)

sx = bin(x)[2:] + "_"
L = [int(sx[-(i+1) * K - 1:-i * K - 1], 2) % mod for i in range((len(sx)+K-2) // K)]
fa = 1
ans = (ans + M * pow(N - 1, M - 1, mod)) % mod
for i, l in enumerate(L):
    if i == 0: continue
    ans = (ans - l * fa * pow(N - 1, M - i, mod)) % mod
    fa = fa * i % mod
print(ans)

### FIXED CODE ###

def par(a):
    L = []
    while P[a] != a:
        L.append(a)
        a = P[a]
    for l in L:
        P[l] = a
    return a
def unite(a, b):
    pa = par(a)
    pb = par(b)
    if pa == pb: return
    if LEN[pa] < LEN[pb]:
        a, b, pa, pb = b, a, pb, pa
    P[pb] = pa
    if LEN[pa] == LEN[pb]: LEN[pa] += 1
    CNT[pa] += CNT[pb]
def cnt(a):
    return CNT[par(a)]

N = int(input())
P = [i for i in range(N)]
LEN = [1] * N
CNT = [1] * N
FULL = [0] * N
A = [int(a) - 1 for a in input().split()]
for i, a in enumerate(A):
    if a < 0: continue
    if par(i) != par(a):
        unite(i, a)
    else:
        FULL[i] = 1
for i in range(N):
    if FULL[i]:
        FULL[par(i)] = 1
X = []
Y = []
for i in range(N):
    if par(i) == i:
        if FULL[i] == 0:
            X.append(CNT[i])
        else:
            Y.append(CNT[i])
M = len(X)
mod = 10 ** 9 + 7
K = 96
m = int(("1" * 32 + "0" * 64) * 5050, 2)
pa = (1 << 64) - ((1 << 64) % mod)
modP = lambda x: x - ((x & m) >> 64) * pa
ans = (sum(X) + sum(Y) - len(Y)) * pow(N - 1, M, mod) % mod
x = 1
for i, a in enumerate(X):
    x *= (a << K) + 1
    x = modP(x)

sx = bin(x)[2:] + "_"
L = [int(sx[-(i+1) * K - 1:-i * K - 1], 2) % mod for i in range((len(sx)+K-2) // K)]
fa = 1
ans = (ans + M * pow(N - 1, M - 1, mod)) % mod
for i, l in enumerate(L):
    if i == 0: continue
    ans = (ans - l * fa * pow(N - 1, M - i, mod)) % mod
    fa = fa * i % mod
print(ans)
print("Christmas"+" Eve"*int(input())%5)

### FIXED CODE ###

print("Christmas"+" Eve"*(25-int(input())))
N, M = map(int, input().split())
students = [list(map(int, input().split())) for i in range(N)]
checkpoints = [list(map(int, input().split())) for i in range(M)]

for s in students:
    min_distance = 2 * 10**8 + 1
    for i, c in enumerate(checkpoints):
        distance = abs(s[0] - c[0]) + abs(s[1]- c[1]) 
        if min_distance > distance:
            min_distance = distance
            point = i+1
    print(point)

### FIXED CODE ###

N, M = map(int, input().split())
students = [list(map(int, input().split())) for i in range(N)]
checkpoints = [list(map(int, input().split())) for i in range(M)]

for s in students:
    min_distance = 4 * 10**8 + 1
    for i, c in enumerate(checkpoints):
        distance = abs(s[0] - c[0]) + abs(s[1] - c[1]) 
        if min_distance > distance:
            min_distance = distance
            point = i+1
    print(point)
a = int(input())
b = int(input())
c = int(input())
if any([a+b ==c,a+c==b,b+c == a]):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a =  list(map(int, input().split()))
if any([a[0]+a[1] ==a[2] ,a[0]+a[2] ==a[1] ,a[1]+a[2] == a[0]]):
    print('Yes')
else:
    print('No')
H,W = map(int,input().split())
s = [input() for i in range(H)]
precount = 0
for i in range(H):
    precount += s[i].count("#")
if precount == 0:
    print("Yes")
else:
    ans = "Yes"
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
               count = 0
               for k in range(4):
                   nx = j+dx[k]
                   ny = i+dy[k]
                   if 0 <= nx < W and 0 <= ny < H:
                      if s[ny][nx] == "#":
                         count += 1
               if count == 0:
                  ans = "No"

print(ans)

### FIXED CODE ###

H,W = map(int,input().split())
s = [input() for i in range(H)]
precount = 0
for i in range(H):
    precount += s[i].count("#")
if precount == 0:
    print("Yes")
else:
    ans = "Yes"
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    for i in range(H):
        for j in range(W):
            if s[i][j] == "#":
               count = 0
               for k in range(4):
                   nx = j+dx[k]
                   ny = i+dy[k]
                   if 0 <= nx < W and 0 <= ny < H:
                      if s[ny][nx] == "#":
                         count += 1
               if count == 0:
                  ans = "No"

    print(ans)
cond=input().split(" ")
n=int(cond[0])
m=int(cond[1])
q=int(cond[2])
train=[[0 for i in range(2)] for j in range(m)]
sect=[[0 for i in range(2)] for j in range(q)]


def judge(arr_m,arr_q):
    a=0
    
    if int(arr_q[0])<=int(arr_m[0]) and int(arr_m[1])<=int(arr_q[1]):
        a=1
    return a

for i in range(m):
    train[i]=input().split(" ")
for i in range(q):
    sect[i]=input().split(" ")
for i in range(q):
    ans=0
    for j in range(m):
        ans+=judge(train[j],sect[i])
    print(ans)

### FIXED CODE ###

nums=input().split(" ")
print((int(nums[0])-1)*(int(nums[1])-1))
N = int(input())
p = list(map(int, input().split()))

q = []
summation = [p[i] + p[i + 1] for i in range(N - 1)]
for i in range(int(N / 2)):
    if len(p) == 2:
        q = p + q
    else:
        index = summation.index(max(summation))
        q = p[index:index + 2] + q
        p = p[:index] + p[index + 2:]
        print(index, summation)
        if index == 0:
            summation = summation[2:]
        elif index == len(summation):
            summation = summation[:index - 1]
        else:
            summation = summation[:index - 1] + [p[index - 1] + p[index]] + summation[index + 2:]

[print(i, end=' ') for i in q]

### FIXED CODE ###

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

count1 = 0
count2 = 0
count4 = 0
for i in range(N):
    value = a[i] % 4
    if value == 0:
        count4 += 1
    elif value == 2:
        count2 += 1
    else:
        count1 += 1

if count1 <= count4 or (count1 - count4 == 1 and count2 == 0):
    print('Yes')
else:
    print('No')
h, w = map(int, input().split())
s = [list(input()) for i in range(h)]
output = "Yes"

for i in range(1, w - 1):
    for k in range(1, h - 1):
        if s[i - 1][k] == "." and s[i + 1][k] == "." and s[i][k - 1] == "." and s[i][k + 1] == ".":
            output = "No"

print(output)


### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
ans = True

for i in range(h):
    for k in range(w):
        if s[i][k] == "#":
            count = True
            d = [[0, 1], [1, 0], [0, -1], [-1, 0]]
            for l in d:
                if 0 <= i + l[0] < h and 0 <= k + l[1] < w:
                    if s[i + l[0]][k + l[1]] == "#":
                        count = False
                        break

            if count:
                ans = False

print("Yes") if ans else print("No")
N = int(input())
A = list(map(int, input().split()))

tar = 1
for i in range(A):
    tar *= i

if tar > 10 ** 18:
    print(-1)
else:
    print(tar)


### FIXED CODE ###


import sys
N = int(input())
A = list(map(int, input().split()))
A.sort()
tar = 1
for i in A:
    tar *= i
    if tar > 10 ** 18:
        print('-1')
        sys.exit()

print(tar)
rom math import floor,ceil
def f(b,n):
    if n < b:
        return n
    else:
        return f(b,floor(n/b))+n%b
n = int(input())
s = int(input())

for b in range(2,320000):
    if f(b,n)==s:
        print(b)
        exit()

if n==s:
    print(s+1)
    exit()

d = {}
for i in range(1,ceil(n**0.5)):
    m = f(n//i,n)
    if n//i==n//(i+1):
        d[i] = (m,m)
    else:
        M = f(n//(i+1)+1,n)
        d[i] = (m,M)

for i in range(ceil(n**0.5)-1,0,-1):
    m,M = d[i]
    if m<=s<=M and (s-m)%i==0:
        print(n//i-(s-m)//i)
        exit()

print(-1)

### FIXED CODE ###

from math import floor,ceil
def f(b,n):
    if n < b:
        return n
    else:
        return f(b,floor(n/b))+n%b
n = int(input())
s = int(input())

for b in range(2,320000):
    if f(b,n)==s:
        print(b)
        exit()

if n==s:
    print(s+1)
    exit()

d = {}
for i in range(1,ceil(n**0.5)):
    m = f(n//i,n)
    if n//i==n//(i+1):
        d[i] = (m,m)
    else:
        M = f(n//(i+1)+1,n)
        d[i] = (m,M)

for i in range(ceil(n**0.5)-1,0,-1):
    m,M = d[i]
    if m<=s<=M and (s-m)%i==0:
        print(n//i-(s-m)//i)
        exit()

print(-1)
N , M = map(int,input().split())

ans += N * (N - 1) / 2
ans += M * (M - 1) / 2

print( ans )

### FIXED CODE ###

N , M = map(int,input().split())
ans = 0
ans += N * (N - 1) // 2
ans += M * (M - 1) // 2

print( ans )
l=input.split()
a=int(l[0])
b=int(l[1])
if a<9 and b<9:
    print('Yay!')
else:
    print(':(')

### FIXED CODE ###

l=input().split()
a=int(l[0])
b=int(l[1])
if a<9 and b<9:
    print('Yay!')
else:
    print(':(')
import math
n, k = map(int, input().split())
x = math.ceil( n/k )
if abs(n - k*x) < n:
    n = abs(n - k*x)
print(n)

### FIXED CODE ###

x, y, z = map(int, input().split())
x, y = y, x
x, z = z, x
print(x, y, z)
N=int(input())
ans =1
A =list(map(int,input().split()))
for i in range(N):
      
       ans *=A[i]
if ans <=10**18:
        print(ans)
else:
        print(-1)


### FIXED CODE ###

A,B =map(int,input().split())
print(A*B)
a,b=map(int(),input().split())
print(max(a*b,a-b,a+b))

### FIXED CODE ###

a, b=map(int, input().split())
print(max(a-b, a+b, a*b))
n = int(input())
a = [int(i) for i in input().split()]
import collections
c = collections.Counter(a)
for i in range(10**9):
  if c[i] < i:
    ans += c[i]
  if c[i] > i:
    ans += c[i]-i
print(ans)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
b = [i for i in a if i <= 10**5]
ans = len(a)-len(b)
import collections
c = collections.Counter(b)
for i in range(0,10**5+1):
  if c[i] < i:
    ans += c[i]
  if c[i] > i:
    ans += c[i]-i
print(ans)
n,x,t = map(int,input().split())
if n%x == 0:
  print(n*y/x)
else:
  print(((n//x)+1)*t)

### FIXED CODE ###

n,x,t = map(int,input().split())
import math
if n%x == 0:
  print(math.floor((n/x)*t))
else:
  print(math.floor(((n+x)//x)*t))
import math


def point_stamina(p):
    stamina = 0
    for x in persons_coordinates:
        stamina += (x - p) ** 2
    return stamina


n = int(input())
persons_coordinates = list(map(int, input().split()))
max_coordinate = max(persons_coordinates)
min_coordinate = min(persons_coordinates)
min_stamina = math.inf

for p in range(min_coordinate, max_coordinate + 1):
    stamina = point_stamina(p)
    if min_stamina >= stamina:
        min_stamina = stamina

print(min_stamina)

### FIXED CODE ###

n = map(int,input().split())
a = list(map(int,input().split()))
q = []
mi,ma = min(a),max(a)
for i in range(mi,ma+1):
    x = 0
    for j in a:
        x+=(j-i)**2
    q.append(x)
print(min(q))
N = int(input())
S = input()
li = list(S)
n = int(len(li)/2)
half_li = list()
for i in range(n):
	half_li.append(li[i])
T = ''.join(half_li)
if S == T*2:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

N = int(input())
ans = 'No'
for i in range(1,10):
	for j in range(1,10):
		if i*j == N:
			
			ans = 'Yes'
print(ans)
e = list(map(int,input().split()))
K = e[0]
N = e[1]
a = list(map(int,input().split()))
c = [a[i+1] - a[i] for i in range(N-1)]
f = a[0]+ K - a[N-1]
c.append(f)
d = max(c)
print(K - d)


### FIXED CODE ###

s = input()
if s[2] == s[3]:
    if s[4] == s[5]:
        print('Yes')
    else: print('No')
else: 
    print('No')
def resolve():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip())
    a_list = [int(x) for x in input().rstrip().split(" ")]
    a_list.sort(reverse=True)
        
    from heapq import heappush, heappop

    hq = []
    joined = set()
    joined.add(0)
    heappush(hq, (-a_list[0], 0, 0))
    result = 0
            
    for i in range(1, n):
        next_one = a_list[i]
        comfort, left, right = heappop(hq)
        comfort = -comfort

        result += comfort

        heappush(hq, (-(a_list[left] if a_list[left] < a_list[next_one] else a_list[next_one]),left, next_one))
        heappush(hq, (-(a_list[right] if a_list[right] < a_list[next_one] else a_list[next_one]),next_one,right))
    
    print(result)


if __name__ == "__main__":
    resolve()


# を理解する。そうすると、明らかに制限時間内に実行が終わらないソースコードを出さなくなる。ちなみに、競プロでは 108108 ～ 109109 回程度のループが回せるといわれている。

### FIXED CODE ###



def resolve():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip())
    a_list = [int(x) for x in input().rstrip().split(" ")]
    a_list.sort(reverse=True)
        
    from heapq import heappush, heappop

    hq = []
    joined = set()
    joined.add(0)
    heappush(hq, (-a_list[0], 0, 0))
    result = 0
            
    for i in range(1, n):

        comfort, left, right = heappop(hq)
        comfort = -comfort

        result += comfort

        heappush(hq, (-(a_list[left] if a_list[left] < a_list[i] else a_list[i]),left, i))
        heappush(hq, (-(a_list[right] if a_list[right] < a_list[i] else a_list[i]),i,right))
    
    print(result)


if __name__ == "__main__":
    resolve()


# を理解する。そうすると、明らかに制限時間内に実行が終わらないソースコードを出さなくなる。ちなみに、競プロでは 108108 ～ 109109 回程度のループが回せるといわれている。
S = input()
Fi = S[:N+1/2]
Se = S[N+3/2:]
SS = S[::-1]
FiFi = Fi[::-1]
SeSe = Se[::-1]
print("Yes" if S == SS and Fi == FiFi and Se == SeSe else "No")

### FIXED CODE ###

S = input()
N = len(S)
S1 = S[0:(N-1)//2]
S2 = S[(N+3)//2-1:N+1]
print("Yes" if S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1] else "No")