peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
s = input()
t = input()

ans = n

for i in range(n):
    if s[i:] == t[:-i + n]:
        break
    else:
        ans += 1

print(ans)
# Judge status: Accepted
import sys
from fractions import gcd

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
N = ir()
A = lr()
# lcm
lcm = 1
answer = 0
for a in A:
    coef =  a // gcd(lcm, a)
    answer *= coef
    lcm *= coef
    answer += lcm // a
    answer %= MOD

print(answer%MOD)
# Judge status: Accepted
N=int(input())
T=list(int(input()) for _ in range(N))

def gcd(a, b):
	while b:
		a, b = b, a%b
	return a

ans=T[0]
for i in range(1, N):
	ans=ans*T[i]//gcd(ans, T[i])
print(ans)
# Judge status: Accepted
s = input()
q = int(input())
t = 0
form = ""
late = ""
for i in range(q):
  l = list(input().split())
  if l[0] == "1":
    t += 1
  else:
    if t % 2 == 0:
      if l[1] == "1":
        form = l[2] + form
      else:
        late += l[2]
    else:
      if l[1] == "1":
        late += l[2]
      else:
        form = l[2] + form
if t % 2 == 0:
  ans = form + s + late
else:
  ans = late[::-1] + s[::-1] + form[::-1]
print(ans)
# Judge status: Accepted
X, Y = map(int,input().split())
print(X * Y)
# Judge status: Accepted
N = int(input())

ans = N * (N - 1) // 2
print(ans)
# Judge status: Accepted
from sys import exit
import math
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

a,b,t = mi()
print(((t)//a)*b)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
m = max(a,b,c)
n = 0
flg = False
if a != m:
    n += (m - a) // 2
    if (m - a) % 2 == 1:
        flg = True
if b != m:
    n += (m - b) // 2
    if (m - b) % 2 == 1:
        flg = True
if c != m:
    n += (m - c) // 2
    if (m - c) % 2 == 1:
        flg = True
if flg:
    n += 1
print(n)
# Judge status: Accepted
x,y,a,b,c = map(int,input().split())
p = sorted(list(map(int,input().split())),reverse = True)
q = sorted(list(map(int,input().split())),reverse = True)
r = sorted(list(map(int,input().split())),reverse = True)
pre = sorted(p[:x]+q[:y])
for i in range(min(x+y,c)):
  if pre[i] < r[i]:
    pre[i] = r[i]
  else:
    break
print(sum(pre))
# Judge status: Accepted
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    a,b = map(int, input().split())

    print(math.ceil((a+b)/2))


if __name__ == '__main__':
    main()
# Judge status: Accepted
n, m = map(int, input().split())
PY = [list(map(int, input().split())) + [i] for i in range(m)]

PY.sort(key=lambda x: (x[0], x[1]))

prefec = 0
cnt = 1
for py in PY:
    if py[0] != prefec:
        prefec = py[0]
        cnt = 1
    py.append(cnt)
    cnt += 1

PY.sort(key=lambda x: x[2])

for py in PY:
    print('{0:06d}{1:06d}'.format(py[0], py[3]))
# Judge status: Accepted
s = input()
l = []
cnt = 0
flg = 0
for c in s:
    if (c == '<') ^ flg:
        cnt += 1
    else:
        l.append(cnt)
        flg ^= 1
        cnt = 1
l.append(cnt)
if len(l) % 2:
    l.append(0)
ans = 0
for i in range(len(l) // 2):
    x = l[i * 2]
    y = l[i * 2 + 1]
    ans += x * (x - 1) // 2 + y * (y - 1) // 2 + max(x, y)
print(ans)
# Judge status: Accepted
a,b,c,k = map(int,input().split())

if a >= k:
    print(k)
elif a + b >= k:
    print(a)
else:
    d = k - a - b
    print(a  -d)
# Judge status: Accepted
import itertools
N=int(input())
point=[]
for _ in range(N):
    x,y=map(int,input().split())
    point.append([x,y])
nums=[i for i in range(1,N+1)]
perm=list(itertools.permutations(nums,N))
dist=0

for pattern in perm:
    tmp_dist=0
    for i in range(N-1):
        tmp_dist+=((point[pattern[i]-1][0]-point[pattern[i+1]-1][0])**2+(point[pattern[i]-1][1]-point[pattern[i+1]-1][1])**2)**0.5
    dist+=tmp_dist
print(dist/len(perm))
# Judge status: Wrong Answer
def get_sieve_of_eratosthenes(n):
  prime = [2]
  limit = int(n ** 0.5)
  data = [i + 1 for i in range(2, n, 2)]
  while True:
    p = data[0]
    if limit <= p:
      return prime + data
    prime.append(p)
    data = [e for e in data if e % p != 0]

for i in range(2, 7):
  print(10 ** i, ":", len(get_sieve_of_eratosthenes(10 ** i)))
# Judge status: Accepted
a,b=map(int,input().split())
if a<10 and b<10:
  print(a*b)
else:
  print(-1)
# Judge status: Accepted
N, Y = map(int, input().split())
x, y, z = -1, -1, -1

for i in range(N+1):
    for j in range(N-i+1):
            k = N - i - j
            if 10000*i+5000*j+1000*k == Y:
                x, y, z = i, j, k
                break
print(x, y, z)
# Judge status: Wrong Answer
s = input()
for i in range(97, 123):
    print(i, chr(i))
    if s.find(chr(i)) == -1:
        print(chr(i))
        exit()
    
print('None')
# Judge status: Accepted
a = input()
if int(a[:2]) < 13 and int(a[:2]) > 0:
    if int(a[2:4]) < 13 and int(a[2:4]) > 0: print('AMBIGUOUS')
    else: print('MMYY')
elif int(a[2:]) < 13 and int(a[2:]) > 0: print('YYMM')
else: print('NA')
# Judge status: Accepted
s = input()
t = input()

ans = 0
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
        if s[i+j] == t[j]:
            cnt += 1
    ans = max(ans,cnt)

print(len(t)-ans)
# Judge status: Accepted
import math

S = int(input())

sqrtS = math.ceil(math.sqrt(S))
rest = sqrtS*sqrtS - S

X1,Y1 = 0,0
X2,Y2 = sqrtS, 1
X3,Y3 = rest, sqrtS
print("{} {} {} {} {} {}".format(X1,Y1,X2,Y2,X3,Y3))
# Judge status: Accepted
n,m,x,y=map(int,input().split())
xx=sorted(list(map(int,input().split())))
yy=sorted(list(map(int,input().split())))

ans="War"

if xx[-1]<yy[0] and xx[-1]<y and x<yy[0]:
  ans="No War"

print(ans)
# Judge status: Accepted
#台形
def ABC_45_A():
    a = int(input())
    b = int(input())
    h = int(input())

    print(int((a+b)*h/2))


if __name__ == '__main__':

    ABC_45_A()
# Judge status: Wrong Answer
N = int(input())
h = list(map(int, input().split(" ")))

dp = [1000000 for i in range(N)]
dp[0] = 0
i = 0
for i in range(0, N-1):
    dp[i + 1] = min(dp[i + 1], abs(h[i + 1] - h[i]) + dp[i])
    if i + 2 < len(h) - 1:
        dp[i + 2] = min(dp[i + 2], abs(h[i + 2] - h[i]) + dp[i])

print(dp[-1])
# Judge status: Accepted
N = int(input())
S = str(input())

r = S.count("R")
g = S.count("G")
b = S.count("B")

ct = r*g*b

for i in range(N-2):
    for j in range(i+1,N-1):
        k = 2*j-i
        if k<=N-1:
            if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
                ct-=1
print(ct)
# Judge status: Accepted
import math
X, Y = map(int, input().split())
if X > Y:
  X, Y = Y, X

if ((2*X-Y) % 3 != 0) or (2*X-Y < 0):
  print(0)
  exit()
A = (2*X-Y)//3
B = Y-X+A
N = A+B
nu = 1
de = 1
for i in range(B+1, N+1):
  nu = (nu * i) % (10 ** 9 + 7)
for i in range(1, A+1):
  de = (de * i) % (10 ** 9 + 7)
  
print((nu * pow(de, -1, 10 ** 9 + 7) ) % (10 ** 9 + 7))
# Judge status: Wrong Answer
n=int(input())
a =[]
for _ in range(n):
  
  a.append([int(i) for i in input().split()])
  
a.sort(key = lambda x : x[0])
#a.sort(key = lambda x : x[1])
#print(a)

curi = 0;curj=1
cnt=1
while(curj<n):
  if a[curi][0]+a[curi][1] <= a[curj][0]-a[curj][1]:
    curi=curj
    cnt+=1
  else: curi= min(curi,curj)
  curj+=1
    
print(cnt)
# Judge status: Accepted
#!/usr/bin/env python3

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

num_minus = 0
for i in range(n):
    if a[i] < 0:
        num_minus += 1

a_plus = [abs(i) for i in a]

# print(num_minus)
# print(a_plus)
if num_minus % 2 == 0:
    print(sum(a_plus))
else:
    print(sum(a_plus)-2*min(a_plus))
# Judge status: Accepted
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
A = sorted([X[i][0] for i in range(N)])
B = sorted([X[i][1] for i in range(N)])
if N%2==1:
    a = A[N//2]
    b = B[N//2]
    print(b-a+1)
else:
    a = (A[(N-1)//2]+A[N//2])/2
    b = (B[(N-1)//2]+B[N//2])/2
    print(int((b-a)/0.5)+1)
# Judge status: Wrong Answer
a,b = map(int,input().split())
print((1+(b-a))*(b-a))
# Judge status: Wrong Answer
H1, M1, H2, M2, K = map(int, input().split())
print(H2*60+M2 - H1*60+M1 - K)
# Judge status: Wrong Answer
s=int(input())

kaisu=s//3-1
num=s-6
a=list(range(1,s+1))
total=0
for i in range(kaisu):
    total+=a[num]
    if num-3>0:
        a[i+3]=sum(a[0:i])

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

all_sum = (sum(a) ** 2)
diff = [(a[i] ** 2) for i in range(n)]

ans = (all_sum - sum(diff)) // 2

print(ans % (10 ** 9 + 7))
# Judge status: Accepted
N = int(input())
S = input()
T = input()
kaburi = 0
for i in range(N):
    #sの末尾とtの先頭を比べる
    #print("sの末尾"+str(i+1)+"文字目"+S[-(i+1):])
    #print("Tの先頭"+str(i+1)+"文字目"+T[0:i+1])
    if S[-(i+1):] == T[0:i+1]:
        kaburi = len(S[-(i+1):])
print(2*N-kaburi)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

cnta = 0
cntb = 0
k = sum(b)-sum(a)
for i in range(n):
    d = abs(a[i]-b[i])
    if a[i] > b[i]:
        cntb += d
    else:
        cnta += (d+1)//2
        cntb += d%2

if k < 0 or cntb > cnta or k != 2*cnta - cntb:
    ans = "No"
else:
    ans = "Yes"
    
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
if(n % 2 == 0 and s[n//2:] * 2 == s):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from collections import Counter

n, x, y = list(map(int, input().split()))
counter = Counter()

for i in range(1, n):
    for j in range(i+1, n+1):
        k = min(j - i, abs(i-x) + abs(j-y) + 1)
        counter[k] += 1

for cnt in range(1, n):
    print(counter[cnt])
# Judge status: Accepted
n = int(input())
s = input()
t = input()
ans = len(s) + len(t)
c= 0
for i in range(n):
    j = n-i
    if s[i:] == t[:j]:
        ans = len(s[i:]) + len(t[:i]) + c
        break
    else:
        c+=1
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
cnt = [0 for _ in range(10**5 + 10)]

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

res = 0
for i in range(len(cnt)):
    res += cnt[i]
    if res >= K:
        break
print(i)
# Judge status: Wrong Answer
s = input().split()
if s.count("9") > 0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, m = map(int, input().split())
reachable_islands_from_1 = []    # (using just one boat service)
reachable_islands_from_n = []    # same

for _ in range(m):
  a, b = map(int, input().split())
  if a == 1:
    reachable_islands_from_1.append(b)
  elif b == n:
    reachable_islands_from_n.append(a)

if len(list(set(reachable_islands_from_1) & set(reachable_islands_from_n))) == 0:
  print("IMPOSSIBLE")
else:
  print("POSSIBLE")
# Judge status: Wrong Answer
k, n = map(int, input().split())
a = list(map(int, input().split()))

m = 0
for i in range(n-1):
    d = a[i+1] - a[i]
    m = max(m, d)
d_last = k - a[n-1]
m = max(m, d_last)

res = k - m
print(res)
# Judge status: Wrong Answer
a = int(input())

ans = a+a*2+a*3

print(ans)
# Judge status: Wrong Answer
A,B=map(int, input().split())
if A<5:
    print(0)
elif A<12:
    print(B/2)
else:
    print(B)
# Judge status: Wrong Answer
import collections

N = int(input())
n = list(map(int, input().split()))
c = collections.Counter(n)

cnt = c.most_common()

for c in cnt:
  if (c[1]>1):
  	print('No')
  else:
    print('Yes')
  break
# Judge status: Accepted
N, H = map(int, input().split())
#ab = [list(map(int, input().split())) for i in range(N)]
a = []
b = []
for i in range(N):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)
a.sort()
b.sort()
from bisect import bisect_left
end = bisect_left(b, max(a))
#H = 500
i = N - 1
cnt = 0
while H > 0 and end <= i:
    #print(i)
    H -= b[i]
    cnt += 1
    i -= 1
if H <= 0:
    print(cnt)
    quit()
import math
print(math.ceil(H / max(a)) + cnt)
# Judge status: Accepted
n,m=map(int,input().split())
count=0
s=[0]*(n+1)
L=0
R=10**5
 
for i in range(m):
  l,r=map(int,input().split())
  L=max(l,L)
  R=min(r,R)
  
if (R-L+1)>=0:
  print(R-L+1)
else:
  print(0)
# Judge status: Accepted
c1 = input()
c2 = input()

if (c1[::-1] == c2):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N,M = map(int,input().split())
XY = [list(map(int,input().split())) for i in range(M)]
Q = [1 for i in range(N)]

dp = [0 for i in range(N)] #dp[m][n]
dp[0]=1

for i in range(1,M+1):
  x=XY[i-1][0]
  y=XY[i-1][1]

  if dp[x-1]>=1:
    if Q[x-1]==1:
      dp[x-1]=0
    else:
      dp[x-1]=1
    dp[y-1]+=1
  Q[x-1]-=1
  Q[y-1]+=1
  
ans=0
for i in range(N):
  if dp[i]>=1:
    ans+=1
print(ans)
# Judge status: Wrong Answer
n,d=map(int,input().split())
x=0

while True:
    a=1+d
    x+=1
    if a>=n:
        break
    else:
        while True:
            a=a+d*2+1
            x+=1
            if a>=n-d:
                break                
        break

print(x)
# Judge status: Accepted
import sys
from collections import Counter

input = sys.stdin.readline


def main():
    S = input().rstrip()
    T = input().rstrip()

    c_S = Counter(S)
    c_T = Counter(T)
    count_S = list(c_S.values())
    count_T = list(c_T.values())
    count_S.sort()
    count_T.sort()
    is_same = True
    for s, t in zip(count_S, count_T):
        if s != t:
            is_same = False
            break

    ans = "Yes" if is_same else "No"
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
h = int(input())
w = int(input())
 
k = int(input())
 
a = (k // (max(h, w) - 1))
print(a + 1)
# Judge status: Accepted
c=input()
b_list=["a","i","u","e","o"]

if c in b_list:
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
n,X = map(int,input().split())
Xs = list( map(int,input().split()))
import fractions
gcd = fractions.gcd
ans = abs(Xs[0] -X)
for x in Xs:
    ans = gcd(ans,abs(X-x))
print(ans)
# Judge status: Accepted
import re
S = str(input())
acgt = re.compile(r"[A,C,G,T]*")
s = re.findall(acgt, S)
print(max(map(len,s)))
# Judge status: Accepted
n = int(input())
a = set(map(int, input().split()))
print('YES' if n == len(a) else 'NO')
# Judge status: Wrong Answer
N, A, B = map(int, input().split())

if abs(A-B)%2 == 0:
  print(abs(A-B)//2)
else:
  if A - 1 <= N - B:
    print((A-1) + (B-1)//2)
  else:
    print((N-B) + (N-A-1)//2)
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input().rstrip()
    print("Cloudy" if s == "Sunny" else "Sunny" if s == "Rainy" else "Rainy")


if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
M=0

if a>0:
    if d<0:
        M=a*d
    else:
        M=b*d

if a<=0 and b>0:
    if d<=0:
        M=a*c
    if d>0:
        if c<0:
            M=max(b*d,a*c)
        else:
            M=b*d

else:
    if c>0:
        M=b*c
    else:
        M=a*c
print(M)
# Judge status: Accepted
a, b, c = map(int, input().split())

for i in range(1, b+1):
    if a*i % b == c:
        print('YES')
        exit()

print('NO')
# Judge status: Accepted
x = int(input())

cnt = (x // 11) * 2
if x % 11 == 0:
  print(cnt)
elif x % 11 <= 6:
  print(cnt + 1)
else:
  print(cnt + 2)
# Judge status: Wrong Answer
s=str(input())
print('A'+s[0]+'C')
# Judge status: Accepted
n = int(input())
s = input()
t = input()
c = 0
for i in range(1,n+1):
    f = True
    for j in range(i):
        if s[n-i+j]!=t[j]:
            f = False
    if f:c=i
print(n*2-c)
# Judge status: Accepted
import sys
input = sys.stdin.readline

# C - Peaks
def get_index(s):
	return int(s) - 1
	

n, m = map(int, input().split())
h = list(map(int, input().split()))
rivals = [0] * n

for i in range(m):
	a, b = map(get_index, input().split())
	
	rivals[a] = max(rivals[a], h[b])
	rivals[b] = max(rivals[b], h[a])

ans = 0

for i in range(n):
	if h[i] > rivals[i]:
		ans += 1

print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

D = {}
for a in A:
    if a not in D:
        D[a] = 1
    else:
        D[a] += 1
E = sorted(D.values(), reverse=True)
c = 0
i = 0
l = len(D)
while l > K:
    if (K - l) in D.values():
        c += K - c
        l -= K - c
    else:
        c += E[-1 -i]
        l -= E[-1 -i]
        i += 1
print(c)
# Judge status: Accepted
import itertools

N = int(input())

tbl = [0]*N

for x in range(1,N):
    for y in range(1,N):
        for z in range(1,N):
            p = x*x + y*y + z*z + x*y + y*z + z*x
            if p > N:
                break
            tbl[p-1] += 1

for i in range(N):
    print(tbl[i])
# Judge status: Accepted
n,x = map(int, input().split())
a = list(map(int, input().split()))

ans = 0

for i in range(0, n-1):
    if a[i] + a[i+1] > x:
        ooi = a[i] + a[i+1] - x
        if ooi < a[i+1]:
            a[i+1] -= ooi
        else:
            a[i] -= (ooi-a[i+1])
            a[i+1] = 0
        ans += ooi

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

ope = sum(b) - sum(a)
var = 0

for i in range(n):
    if a[i] >= b[i]:
        var += a[i] - b[i]
    else:
        var += (b[i] - a[i])%2
if (ope-var)%2 == 0 and ope >= var:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x,y,z = map(int,input().split())
long = x-z
f = y+z
ans , b = divmod(long,f)
print(ans)
# Judge status: Accepted
K=int(input())
A,B=map(int, input().split())

ok=0
for i in range(A, B+1):
  if i % K == 0:
    print('OK')
    ok=1
    break

if ok==0:
  print('NG')
# Judge status: Wrong Answer
a, b = list(map(int, input().split()))
print(a * b)
# Judge status: Accepted
A, B, C = [int(_) for _ in input().split()]
if A == B == C:
    ans = 'No'
elif A == B or B == C or C == A:
    ans = 'Yes'
else:
    ans = 'No'
print(ans)
# Judge status: Accepted
import sys
h, n = map(int, input().split())
# A = [0] * n
# B = [0] * n
# for i in range(n):
#     A[i], B[i] = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n)]
min_hp = h
max_hp = h + max(a for a, b in (AB))
 
dp = [sys.maxsize] * (max_hp + 1)
dp[0] = 0
 
for i in range(1, max_hp + 1):
    # dp[i] = min(dp[i - A[j]] + B[j] for j in range(n))
    dp[i] = min(dp[i - a] + b for a, b in AB)
print(min(dp[h:]))
# Judge status: Accepted
a, b = map(int,input().split())
 
ans = a * b
 
if ans % 2 == 1:
  print("Odd")
else:
  print("Even")
# Judge status: Accepted
S = input()

if S[-1] == 's':
  print(S + 'es')
else:
  print(S + 's')
# Judge status: Accepted
import numpy as np
N = int(input())
xy = [list(map(int, input().split(" "))) for i in range(N)]

L = 0
for i in range( N ):
 for j in range( N ):
  a = xy[i][0]-xy[j][0]
  b = xy[i][1]-xy[j][1]
  l = np.sqrt( a**2 +b**2)
  L += l

print(L/N)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))
i = A.index(1)
j = K-1
l = i
r = N - l - 1
ans, e = divmod(l, j)
if e:
    ans += 1
    r -= K - e - 1
ans += (r+j-1)//j
print(ans)
# Judge status: Accepted
n, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
    w, v = list(map(int, input().split()))
    for j in range(W + 1):
        if w > j:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(dp[i - 1][j - w] + v, dp[i - 1][j])
print(dp[n][W])
# Judge status: Accepted
N, W = map(int, input().split())
wv = []
for _ in range(N):
  wv += list(map(int, input().split()))
dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(N):
  for w in range(W+1):  
    if w-wv[2*i] >= 0:
      dp[i+1][w] = max(dp[i+1][w], dp[i][w-wv[2*i]]+wv[2*i+1])
    dp[i+1][w] = max(dp[i+1][w], dp[i][w])
print(dp[N][W])
# Judge status: Accepted
n = int(input())
ans = 0
for x in range(n + 1):
    if x % 3 == 0 or x % 5 == 0:
        pass
    else:
        ans += x
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
a=[1]*(n+1)
b=[0]*(n+1)
b[1]=1
for _ in range(m):
  x,y=map(int,input().split())
  a[x]-=1
  a[y]+=1
  if b[x]:b[y]=1
  if a[x]==0:b[x]=0
print(sum(b))
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
a = [i for i in range(1, n+1)]
cnt = 0
for j in range(n):
    if p[j] != a[j]:
        cnt += 1
if cnt <= 2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from operator import itemgetter

# 区間スケジューリング

N = int(readline())
m = map(int,read().split())
XL = zip(m,m)

LR = [(x-l,x+l) for x,l in XL]
LR.sort(key = itemgetter(1))

INF = 10 ** 18
prev_R = -INF
cnt = 0
for L,R in LR:
    if prev_R > L:
        continue
    cnt += 1
    prev_R = R

print(cnt)
# Judge status: Accepted
N, M = map(int, input().split())

no = [0] * (N + 1)
ok = 0
x = 0
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'AC' and no[p] != -1:
        ok += 1
        x += no[p]
        no[p] = -1
    elif s == 'WA' and no[p] != -1:
        no[p] += 1

print(ok, x)
# Judge status: Wrong Answer
list = []
a_list = []
b_list = []

n,k = map(int,input().split())
for i in range(n):
    a,b = map(int,input().split())
    a_list.append(a)
    b_list.append(b)
for i in range(len(a_list)):
    for j in range(b_list[i]):
        list.append(a_list[i])

print(list[k-1])
# Judge status: Accepted
from collections import *
N = int(input())
C = Counter(list(map(int,input().split())))
ans = 0

for k,v in C.items():
  if k<v:
    ans+=v-k
  elif v<k:
    ans+=v

print(ans)
# Judge status: Wrong Answer
from collections import Counter
n=int(input())
a=Counter(list(map(int,input().split()))).most_common()
x=[0,0]

for i in range(len(a)):
  if (x[1]<=a[i][0] or x[0]<=a[i][0]) and a[i][1]>=2:
    if x[0]<x[1]:
      x[0]=a[i][0]
    else:
      x[1]=a[i][0]
print(x[0]*x[1])
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
p.sort(reverse=True)
count=0
for i in range(len(p)):
    for j in reversed(range(i+1,len(p))):
        if p[i]%p[j] ==0:
            break
        if j == len(p)-1:
            count +=1



if count >=1:
    print(count+1)
else:
    print(count)
# Judge status: Accepted
S = input()
l = []
for i in range(len(S)):
    l.append('x')
print(''.join(l))
# Judge status: Wrong Answer
a = input()

if (str.isupper(a)):
    print("A")
else:
    print(a)
# Judge status: Accepted
from fractions import gcd
a,b,c,d = map(int, input().split())

l = c*d // gcd(c, d)
x = (a-1) - (a-1)// c - (a-1) // d + (a-1) // l
y = b - b // c - b // d + b //l
print(y - x)
# Judge status: Accepted
n,k,s = map(int,input().split())

if s >= 10**9:
    ans = [1]*n
else:
    ans = [10**9] * n

for i in range(k):
    ans[i] = s

print(*ans)
# Judge status: Wrong Answer
from fractions import gcd

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

def solve():
    A,B,C,D = map(int, input().split())
    c = B//C - A//C
    if A % C == 0:
        c += 1
    d = B//D - A//D
    if B % C == 0:
        d += 1
    r = lcm(C,D)
    e = B//r - A//r
    ans = (B-A+1) - (c+d-e)
    if ans < 0:
        return 0
    return ans

print(solve())
# Judge status: Accepted
N, L = map(int, input().split())
diff_min = 100 + 200 - 1
apples = list()
remove_apple = 0

for i in range(N):
    taste = L + i
    apples.append(taste)
    if abs(taste) < diff_min:
        diff_min = abs(taste)
        remove_apple = taste

print(sum(apples) - remove_apple)
# Judge status: Accepted
def main():
    staying_days, first_night, first_cost, latter_cost = [int(input()) for _ in range(4)]
    print(min(staying_days, first_night) * first_cost + max(0, staying_days - first_night) * latter_cost)


if __name__ == '__main__':
    main()
# Judge status: Accepted
def isKaibun(str):
  result = True
  for i in range(len(str)-1//2):
    if str[i] != str[-i-1]:
      result = False
      break
  return result

S = input().strip()
#N, M = list(map(int, input().strip().split()))
result = 'No'
N = len(S)
"""
print(S[0:(N-1)//2])
print(isKaibun(S[0:(N-1)//2]))
print(S[(N+3)//2-1::])
print(isKaibun(S[(N+3)//2-1::]))
"""
if isKaibun(S) and isKaibun(S[0:(N-1)//2]) and isKaibun(S[(N+3)//2-1::]):
  result = 'Yes'
print(result)