peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
def resolve():
    s = input()
    for i in range(2, len(s), 2):
        test = s[:len(s)-i]
        if test[:len(test)//2] == test[len(test)//2:]:
            print(len(test))
            exit()

resolve()
# Judge status: Accepted
N = int(input())
v = list(map(int,input().split()))
v = sorted(v)
while len(v) != 1:
    v[1] = (v[0]+v[1])/2
    v = sorted(v[1:])
print(*v)
# Judge status: Wrong Answer
N,M,X = map(int,input().split())
C=[0 for i in range(N)]
A=[[] for i in range(N)]
min_cost=10000000000
for i in range(N):
    C[i],*A[i]=map(int,input().split())
for i in range(1<<N):
    L=[0 for i in range(M)]
    cost=0
    for j in range(N):
        if 1&(i>>j):
            for k in range(M):
                L[k]+=A[j][k]
            cost+=C[j]
    if min(L)>=X:
      min_cost=min(min_cost,cost)
print(min_cost)
# Judge status: Wrong Answer
s=input()
print(len(s)-s[::-1].find('Z')-s.find('A')+1)
# Judge status: Wrong Answer
A, B = map(int, input().split())

if A==B:
    print("Draw")
elif A>B or A==1:
    print("Alice")
else:
    print("Bob")
# Judge status: Accepted
s=list(input())
import copy
d=copy.copy(s)
x=0
y=1
for i in range(len(s)-1):
  if s[i]==s[i+1]:
    if s[i+1]=='1':
       s[i+1]='0'
    else:s[i+1]='1'
    x+=1
if d[0]=='1':
  d[0]='0'
else:d[0]='1'
for i in range(len(d)-1):
  if int(d[i])==int(d[i+1]):
    if d[i+1]=='1':
      d[i+1]='0'
    else:d[i+1]='1'
    y+=1
print(min(x,y))
# Judge status: Accepted
a, b, m = map(int, input().split())

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

min_sum = min(A) + min(B)

M = []
for i in range(m):
      an, bn, diff = list(map(int, input().split()))
      M.append(A[an - 1] + B[bn - 1] - diff)

diff_min = min(M)
print(min_sum if min_sum < diff_min else diff_min)
# Judge status: Wrong Answer
a1,a2,a3 = map(int,input().split())
b1,b2,b3 = map(int,input().split())
c1,c2,c3 = map(int,input().split())
N = int(input())
b =  [int(input()) for _ in range(N)]

if  a1 and a2 and a3 in b or b1 and b2 and b3 in b or c1 and c2 and c3 in b or a1 and b1 and c1 in b or a2 and b2 and c2 in b or a3 and b3 and c3 in b or a1 and b2 and c3 in b or a3 and b2 and c1 in b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
L = list(map(int, input().split()))
L.sort()
d1 = L[-1] - L[-2]
d2 = L[-1] - d1 - L[0]
if d2 % 2 == 0:
    print(d1 + d2 // 2)
else:
    print(d1 + d2 // 2 + 2)
# Judge status: Accepted
a, b, k = map(int, input().split())

if a - k < 0:
    print(0, max(0, b - abs(a - k)))
else:
    print(a - k, b)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
l = [0]*N
for i in A:
  l[i-1] += 1
print(*l)
# Judge status: Accepted
n,m=map(int,input().split())
deg=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    deg[a]+=1
    deg[b]+=1
print(*deg,sep="\n")
# Judge status: Accepted
import math
a, b = map(int, input().split())

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


print(lcm(a, b))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
ls = [[] for i in range(N)]
A.sort()
for i in range(3*N):
    ls[i%N].append(A[i])
ans = 0
for i in range(len(ls)):
    k = ls[i]
    k.sort()
    ans += k[1]
print(ans)
# Judge status: Accepted
import sys
N=int(sys.stdin.readline().strip())
mod=10**9+7
print (pow(10,N,mod)-(pow(9,N,mod)*2-pow(8,N,mod)))%mod
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

mod = 10**9 + 7

ans = 0
for i in range(60):
    X = sum([1 for x in A if (x >> i) & 1])
    ans += (1 << i) * X * (N - X)
    ans %= mod

print(ans)
# Judge status: Wrong Answer
x=int(input())
t=1
#a=[11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79]
for i in range(1,10):
  if t==0:break
  for k in range(1,i+1):
    if k*i==x:
      print('Yes')
      t=0
      break
else:print('No')
# Judge status: Accepted
N,M = map(int, input().split())

B = [0]*30

for i in range(N):
	K, *A = map(int, input().split())
	for a in A:
		B[a-1] += 1

print(sum(c == N for c in B))
# Judge status: Accepted
n,m = map(int, input().split())
students = [list(map(int, input().split())) for _ in range(n)]
chkpoints = [list(map(int, input().split())) for _ in range(m)]
dist = 0
ans = 0
for student in students:
  min_dist = 1000000000
  for i in range(m):
    dist = abs(student[0]-chkpoints[i][0])+abs(student[1]-chkpoints[i][1])
    if dist < min_dist:
      min_dist = dist
      ans = i+1
  print(ans)
# Judge status: Wrong Answer
s=sorted(input())
for i in range(len(s)):
    s[i]=ord(s[i])
s.append("*")
x=0
a=97
while s[x]==a:
    x+=1
    a+=1
print(chr(a) if a<122 else None)
# Judge status: Accepted
n=int(input())
if n%2==0:
  print(int(n/2))
elif n%2==1:
  print(int((n+1)/2))
# Judge status: Accepted
n,k,q=map(int,input().split())
a=list((k-q) for i in range(n))
for i in range(q):
    s=int(input())
    a[s-1]+=1
for i in range(n):
    if(a[i]>0):
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
from sys import exit
def log2(x):
    ans = 0
    while(x):
        x //= 2
        ans += 1
    return ans

n = int(input())
n += 1
a = list(map(int, input().split()))
cnt = 1
ans = 0
s = [0 for i in range(n)]
s[-1] = a[-1]
for i in range(n - 2, -1, -1):
    s[i] = s[i + 1] + a[i]
for i in range(n):
    cnt = cnt * 2 - a[i] * 2
    if (i + 1 < n):
        ans += min(cnt, s[i + 1])
if (cnt < 0):
    print(-1)
    exit(0)
print(ans + 1)
# Judge status: Accepted
a,b,c = map(int, input().split())
if a==b==c:
  print('No')
elif a==b or b==c or a==c:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N, M = [int(i) for i in input().split()]
S = [list(map(int,input().split())) for _ in range(M)]

bag =[]
for i in range(1000):
    ans = str(i)    
    if len(ans) == N:
        for j in range(M):
            if ans[S[j][0]-1] != str(S[j][1]):
                break
        else:# インナーループがbreakで終了しなかった
            bag.append(i)
            
if len(bag) != 0:
    print(min(bag))
else:
    print(-1)
# Judge status: Accepted
N = int(input())
S = input()
A = [0]

for s in S:
    if s == '.':
        A.append(A[-1] + 1)
    else:
        A.append(A[-1])
ans = float('inf')
for i in range(N + 1):
    ansi = (i - A[i]) + (A[-1] - A[i])
    ans = min(ans, ansi)
print(ans)
# Judge status: Wrong Answer
s=input()

l=list(set(s))
if len(s)==len(l):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
alp = 'abcdefghijklmnopqrstuvwxyz'

d = {c:False for c in alp}

s = open(0).read().rstrip()

for c in list(s):
    d[c] = True

for c,b in d.items():
    if not b:
        print(c)
        break
# Judge status: Wrong Answer
import sys
S = sys.stdin.readline()

N = len(S)

count = 0

for i in range(N - 3):
    for j in range(i + 4, N + 1):
        num = int(S[i:j])
        if num % 2019 == 0:
            count += 1

print(count)
# Judge status: Accepted
lisa=[1,3,5,7,8,10,12]
lisb=[4,6,9,11]
lisc=[2]
x,y=map(int,input().split())
if (x in lisa)and(y in lisa):
    print("Yes")
elif (x in lisb)and(y in lisb):
    print("Yes")
elif (x in lisc)and(y in lisc):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
ans=1
for i in range(1,n):
       ans*=i
ans=ans%(1000000007)
# Judge status: Accepted
N, M = map(int, input().split())

import math

divisor=[]
for i in range(1, math.ceil(math.sqrt(M))+1):
    if M%i==0:
        divisor.append(i)
#print(divisor)

divisor+=[M//val for val in reversed(divisor)]
#print(divisor)
for val in divisor:
    if val>=N:
        print(M//val)
        break
# Judge status: Accepted
import itertools
import math
def dist(i, j):
    return math.sqrt((coords[i][0] - coords[j][0]) ** 2 + (coords[i][1] - coords[j][1]) ** 2)

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

ans = []
for item in itertools.permutations(range(n)):
    length = 0
    for i in range(n-1):
        length += dist(item[i], item[i+1])
    ans.append(length)
print(sum(ans) / len(ans))
# Judge status: Wrong Answer
n = int(input())
AB = [list(map(int, input().split())) for _ in range(n)]
print(AB)
AB.sort(key=lambda x: (x[1], -x[0]))
print(AB)
time = 0
for a, b in AB:
    time += a
    if time > b:
        print('No')
        break
else:
    print('Yes')
# Judge status: Wrong Answer
import sys
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n = I()
    p = list(IL())
    flag = 2
    for i in range(1,len(p)):
        if p[i-1]!=p[i]-1:
            flag -= 1
    if flag>=0:
        print('YES')
    else:
        print('NO')
    return

if __name__=='__main__':
    Main()
# Judge status: Accepted
n, k = map(int, input().split())
m = n % k
print(min(m, abs(m-k)))
# Judge status: Accepted
S=int(input())
a = [0]*(2000+1)
a[3]=1
for i in range(4, S+1):
  a[i] = a[i-3] + a[i-1]
mod=10**9+7
print(a[S]%mod)
# Judge status: Accepted
a = int(input())
b = input()
if a >= 3200:
  print(b)
else:
  print('red')
# Judge status: Wrong Answer

N = int(input())
M = [list(map(int, input().split())) for _ in range(N-1)]

def dfs(i):
  DP = [99999999999999] * N
  DP[i] = M[i][1]
  for j in range(i+1, N):
    prev = DP[j-1] + M[j-1][0]
    start = M[j-1][1] + M[j-1][0]
    if start >= prev:
      DP[j] = start
    else:
      DP[j] = prev + ( prev - M[j-1][1] ) % M[j-1][2]
  print(DP[N-1])

for i in range(N-1):
  dfs(i)

print(0)
# Judge status: Accepted
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
ans, cur = 0, 0
for i in range(N):
    ans = max(ans, s.count(s[i]) - t.count(s[i]))
print(ans)
# Judge status: Accepted
n = int(input())
print((1+n)*n//2)
# Judge status: Accepted
from decimal import Decimal
Q,H,S,D = [int(i) for i in input().split()]
costs = [[Q,Decimal("0.25")], [H,Decimal("0.5")], [S,Decimal("1")], [D,Decimal("2")]]
costs.sort(key=lambda x: Decimal(x[0]) / x[1])
N = int(input())
tc = 0
for c, a in costs:
    tc += c * (N // a)
    N %= a
print(int(tc))
# Judge status: Wrong Answer
s=input()
flag=True
n=len(s)
if s!=reversed(s):
    flag=False
if s[:(n-1)//2]!=reversed(s[:(n-1)//2]):
    flag=False
if s[(n+3)//2-1:]!=reversed(s[(n+3)//2-1::-1]):
    flag=False
print("Yes" if flag else "No")
# Judge status: Accepted
import sys
from bisect import bisect_right

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    N, *A = map(int, read().split())

    vec = [INF] * N
    for a in reversed(A):
        vec[bisect_right(vec, a)] = a

    print(N - vec.count(INF))
    return


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
A, B, C =map(int, input().split())
if A + B > C:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
A = [0] * n

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            if x**2 + y**2 + z**2 + x*y + y*z + z*x <= n:
                A[x**2 + y**2 + z**2 + x*y + y*z + z*x - 1] += 1
            else:
                break

for ans in A:
    print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
if any([a%2==1,b%2==1,c%2==1])==True:
    print(0)
else:
    if len(set({a,b,c}))==1:
        print(-1)
    else:
        res=0
        while all([a%2==0,b%2==0,c%2==0]):
            a,b,c=(b+c)//2,(a+c)//2,(a+b)//2
            res+=1
        print(res)
# Judge status: Wrong Answer
x,y=map(int,input().split())
print(x if y%x!=0 else -1)
# Judge status: Wrong Answer
num = int(input())

node = input()
table = list(node)


for i in table:
    aaa = ((ord(i)) + num) % 26
    print(chr(aaa))
# Judge status: Wrong Answer
word=list(input())
word_number=len(word)

if word_number>=7:
    for i in range(int(word_number/2)):
        if word[i]==word[-i-1]:
            result='Yes'
            continue
        else:
            result='No'
            break

        result='Yes'
else:
    result='No'

print(result)
# Judge status: Wrong Answer
fluit_num,fluit_buy=input().split()
print(fluit_num,fluit_buy)
p = input().split()
print(p[:4])
# Judge status: Accepted
N=int(input())
s=[int(input()) for _ in range(N)]
ss = [s[i] for i in range(N) if s[i]%10!=0]
if sum(s)%10 != 0:
    print(sum(s))
else:
    if not ss:
        print(0)
    else:
        print(sum(s) - min(ss))
# Judge status: Wrong Answer
N = int(input())
l = [int(x) for x in input().split()] + [100001]
l.sort()
ans = 0
t = 0
M = [False] * 10 ** 6
for i in range(N):
    if not M[l[i]-1]:
        if l[i] != l[i+1]:
            ans += 1
        t = l[i]
        while t <= 10 ** 6:
            M[t-1] = True
            t += l[i]
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
n, k = map(int, input().split())
print(min(n, n-n//k*k, (n+k-1)//k*k-n))
# Judge status: Wrong Answer
N, M = (int(x) for x in input().split())
A = list(map(int, input().strip().split()))
A.sort(reverse=True)

for m in range(M):
    s = sum(A)
    if A[m] > s / (4 * M):
        a = True
    else:
        a = False

if a == True:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A, B, C = map(int, input().split())
count = 0

while A%2 == 0 and B%2 == 0 and C%2 == 0:
  if A == B and B == C:
    print(-1)
    exit()
  A, B, C = B//2+C//2, A//2+C//2, A//2+B//2
  count += 1
print(count)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
ax=[i for i in range(a,b)]
cx=[i for i in range(c,d)]
AX=set(ax)
CX=set(cx)
print(len(AX&CX))
# Judge status: Accepted
a, b, c, d = map(int, input(). split())
print(max(a * c, a * d, b * c, b * d))
# Judge status: Wrong Answer
N,R = list(map(int, input().split()))
S= 10-N
if N >= 10:
    print(R)
else:
    print(R-(100*S))
# Judge status: Accepted
S = input()
T = input()
n = len(S)
s = []
t = []
for i in S:
  s.append(i)
for i in T:
  t.append(i)
  
for i in range(n):
  res = s[0] 
  for j in range(1, n):
    s[j-1] = s[j]
  s[n-1] = res
  if s == t:
    print('Yes')
    exit()
    
print('No')
# Judge status: Accepted
import sys
input = sys.stdin.readline

import numpy as np

def main():
  n, W = map(int, input().split())
  dp = np.zeros(W+1, dtype=np.int64)
  for _ in range(n):
    w, v = map(int, input().split())
    np.maximum(dp[:W-w+1]+v, dp[w:W+1], out=dp[w:W+1])
  print(dp[W])
  
if __name__ == "__main__":
  main()
# Judge status: Accepted
s=input().split()
s=int(''.join(s))
if s%4==0:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
a = [0]* 1000001
m = 0
input()
for x in map(int, input().split()):
  m = max(m, x)
  a[x] += 1
m += 1
for i in range(1, m):
  if a[i]:
    for j in range(i + i, m, i):
      a[j] = 0
print(a[:m].count(1))
# Judge status: Accepted
def solve():
    N = int(input())
    score = 0
    for i in range(1, N+1):
        score += i
        if score >= N:
            break
    x = score - N
    res = list(range(1, x)) + list(range(x+1, i+1))
    return '\n'.join(map(str, res))
    
print(solve())
# Judge status: Accepted
n = int(input())
al = []
for i in range(n):
    a = int(input())
    al.append(a)
 
al.insert(0, 0)
ans = -1
push = 1
for i in range(1, n+2):
    light = al[push]
    push = light
    if light == 2:
        ans = i
        break
print(ans)
# Judge status: Wrong Answer
X = int(input().strip())

y = 1
if X <= 599:
    y = 8
elif X <= 799:
    y = 7
elif X < 999:
    y = 6
elif X <= 1199:
    y = 5
elif X <= 1399:
    y = 4
elif X <= 1599:
    y = 3
elif X <= 1799:
    y = 2
print(y)
# Judge status: Accepted
D = int(input())
if D == 25:
    print("Christmas")
elif D == 24:
    print("Christmas Eve")
elif D == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

B = [abs(i) for i in A]
if N%2 == 0:
    print(sum(B))
else:
    print(sum(B)-min(B))
# Judge status: Accepted
import sys
import math
import functools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd (a, b)
def lcm_n(nums):
    return functools.reduce(lcm, nums)

n = ni()
a = na()
a_lcm = lcm_n(a)
ans = 0
for ai in a:
    ans += a_lcm // ai
ans %= mod
print(ans)
# Judge status: Accepted
n , k  = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**9 
for i in range(n-k+1):
    l = x[i]
    r = x[i+k-1]
    if l*r >= 0:
        ans = min(ans,max(abs(r),abs(l)))
    elif l*r < 0:
        ans = min(ans,r-l + min(abs(r),abs(l)))
print(ans)
# Judge status: Accepted
n=int(input())
a=[list(input().split())+[i] for i in range(n)]
for i in range(n):
  a[i][1]=-int(a[i][1])
a.sort()
for _,_,i in a:
  print(i+1)
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(N):
    if i != N-1:
        if p[i] == i+1:
            p[i], p[i+1] = p[i+1], p[i]
            ans += 1
    else:
        if p[i] == i+1:
            p[i], p[i-1] = p[i-1], p[i]
            ans += 1

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

print(int(l[0]*l[1]/2))
# Judge status: Accepted
# https://atcoder.jp/contests/abc149/submissions/9213312

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

win_pt = {"r": P, "s": R, "p": S}
pt = [0] * N

for i, t in enumerate(T):
    if i < K:
        pt[i] = win_pt[t]
    elif i >= K and (T[i - K] != T[i] or pt[i - K] == 0):
        pt[i] = win_pt[t]
print(sum(pt))
# Judge status: Accepted
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

x = int(input())

ans = 1

for i in range(2,x+1):
    for j in range(2,11):
        if (ans < i ** j):
            if (i**j <= x):
                ans = i ** j
print(ans)
# Judge status: Accepted
import copy

s=list(input())

s2 = copy.copy(s)

s2.reverse()

ans = 0

for i in range(len(s)//2):
    if s[i] != s2[i]:
        ans += 1
print(ans)
# Judge status: Accepted
H,W=map(int,input().split())
if H==1 or W==1:
  print(1)
  exit(0)
if W%2==0:
  w=W//2
  ans=w*H
else:
  w=W//2 + 1
  ans=w*H
  ans-=H//2
print(ans)
# Judge status: Accepted
A,B=map(int,input().split())

c=0
for i in range(A,B+1):
  s=str(i)
  if s[0]==s[4] and s[1]==s[3]:
    c+=1

print(c)
# Judge status: Accepted
import sys

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

c = 0
p = x

for i in range(n-1):
    if a[i] > p:
        print(c)
        sys.exit()
    else:
        c += 1
        p -= a[i]

if a[-1] == p:
    print(n)
else:
    print(n-1)
# Judge status: Accepted
x = int(input())
for a in range(-10000, 10001):
    p = a ** 5
    l, r = -10000, 10001
    while r - l > 1:
        m = (l + r) // 2
        if m ** 5 <= p - x:
            l = m
        else:
            r = m
    if l ** 5 == p - x:
        print(a, l)
        exit(0)
# Judge status: Accepted
S=input()
A=S.count('a')
B=S.count('b')
C=S.count('c')
if A==B and B==C:
    print('YES')
elif A==B:
    if C==A-1 or C==A+1:
        print ('YES')
    else:
        print('NO')
elif B==C:
    if A==B-1 or A==B+1:
        print('YES')
    else:
        print('NO')
elif C==A:
    if B==A-1 or B==A+1:
        print('YES')
    else:
        print('NO')
else:
     print('NO')
# Judge status: Wrong Answer
n,d = map(int,input().split())
print((n+d)//(d+1))
# Judge status: Wrong Answer
a, b = map(int, input().split())

if a <= 10 and b <= 10:
    print('-1')
else:
    answer = a * b
    print(answer)
# Judge status: Wrong Answer
import itertools
import bisect

n, x = map(int, input().split())
ll = list(map(int, input().split()))

dl = [0] + list(itertools.accumulate(ll))

print(bisect.bisect_right(ll, x))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

total = 0
for i in range(len(B)):
    num_of_defeated = min(A[i], B[i])
    A[i] -= num_of_defeated
    total += num_of_defeated

    remainder = B[i] - num_of_defeated
    num_of_defeated = min(A[i + 1], remainder)
    A[i + 1] -= num_of_defeated
    total += num_of_defeated

print(total)
# Judge status: Accepted
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
ans += (d > 1)
print(ans)
# Judge status: Accepted
k = int(input())
s = input()

if len(s) > k:
  print(s[0:k] + '...')
else:
  print(s)
# Judge status: Wrong Answer
A,B,C=list(map(int,input().split()))
A,B,C=B,C,A
print(A,B,C)
# Judge status: Accepted
n = int(input())

dp=[0]
#dp[n]を求める

for i in range(1,n+1):
    c = []
    c.append(dp[i-1]+1)
    p6=1
    while i >=6**p6:
        c.append(dp[i-6**p6]+1)
        p6 +=1

    p9=1
    while i >=9**p9:
        c.append(dp[i-9**p9]+1)
        p9 +=1

    dp.append(min(c))

print(dp[n])
# Judge status: Accepted
n, k = map(int, input().split())
s = input()
s = "_" + s + "_"

count = 0
for i in range(1, n+1):
  if s[i] == s[i-1] == "R" or s[i] == s[i+1] == "L":
    count += 1

print(min(n-1, count + k*2))
# Judge status: Accepted
n=int(input())
X=list(map(int,input().split()))
X_sort=sorted(X)
for i in range(n):
    a=X_sort[n//2-1]
    b=X_sort[n//2]
    if X[i]<=a:
        print(b)
    else:
        print(a)
# Judge status: Accepted
N, K = map(int, input().split())

count = 0
for p in range(K, N+2):
    count += p * (N - p + 1) + 1
    
print(count % (10**9 + 7))
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))
b = N
num = 1
for i in range(N):
    if a[i] == num:
        num += 1
        b -= 1
if b == N:
    print(-1)
else:
    print(b)
# Judge status: Wrong Answer
s = input()

dp = [0 for _ in range(len(s))]
dp[0] = 1
for i in range(1,len(s)):
    if(s[i] != s[i-1]):dp[i] = dp[i-1] + 1
    else:
        if(i >= 3):dp[i] = dp[i-3] + 2
        else:dp[i] = dp[i-1]
print(dp[-1])
# Judge status: Accepted
S = input()
m = float("inf")
for i in range(len(S)-2):
    m = min(m, abs(753 - int(S[i:i+3])))
print(m)
# Judge status: Wrong Answer
ans = "123"
print(ans.replace(input(),"").replace(input(),""))
# Judge status: Accepted
N=int(input())
d=dict()
for tt in range(N):
    s=input()
    if s not in d:
        d[s]=1
    else:
        d[s]+=1
for st in ["AC","WA","TLE","RE"]:
    if st not in d:
        print(st," x ",0)
    else:
        print(st," x ",d[st])
# Judge status: Wrong Answer
# A - A+...+B Problem

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

if A>B or (N==1 and A!=B):
    print(0)
else:
    print((N-1)*B+A - (N-1)*A+B + 1)
# Judge status: Wrong Answer
def main():
    N, M = map(int, input().split())
    X = [int(a) for a in input().split()]
    X.sort()
    dlist = list()
    for i in range(M-1):
        d = abs(X[i] - X[i+1])
        dlist.append(d)
    dlist.sort()
    print(sum(dlist[:len(dlist) - (N-1)]))
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
X = int(input())
for i in range(X+1, 999999999):
    flag = 1
    for j in range(2, X):
        if i % j == 0:
            flag = -12
            break
    if X == 2:
        print(2)
        break
    elif X == 3:
        print(3)
        break
    elif flag == 1:
        print(i)
        break
# Judge status: Accepted
import sys
s = input()
n = int(input())
cnt = 0
if n == 1:
	print(s[0])
	sys.exit()
for i in s:
	if i == '1':
		cnt += 1
	else:
		break
if n <= cnt:
	print(1)
	sys.exit()
	
for i in s:
	if i != '1':
		print(i)
		sys.exit()
print(1)
# Judge status: Accepted
import sys

a, b, c, x, y = map(int, sys.stdin.readline().split())
if x > y:
    a, b = b, a
    x, y = y, x

def main():
    res = min(c * 2, a + b) * x + min(c * 2, b) * (y - x)
    print(res)

if __name__ ==  '__main__':
    main()
# Judge status: Accepted
#a,b = map(int,input().split())
s = str(input())
S = ['SUN','MON','TUE','WED','THU','FRI','SAT']
print(7-S.index(s))
# Judge status: Accepted
A, B, N = map(int, input().split())
def f(x):
  return (A*x)//B - A*(x//B) 

if B-1 < N:
  print(f(B-1))
else:
  print(f(N))
# Judge status: Wrong Answer
# A - Biscuits

N, P = map(int, input().split())
print(2**N)