peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
a=list(input())
b=list(input())
c=list(input())
turn="a"
while 1:
  if turn=="a":
    turn=a.pop()
    if len(a)==0:print("A");exit()
  elif turn=="b":
    turn=b.pop()
    if len(b)==0:print("B");exit()
  else:
    turn=c.pop()
    if len(c)==0:print("C");exit()
# Judge status: Wrong Answer
N = input()
Sev = '7'
if N.find(Sev):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, m, x = map(int, input().split())
b = 10**18
tm = []
for i in range(n):
    tm.append(list(map(int, input().split())))
for i in range(2**n):
    c = [0 for i in range(m)]
    sum = 0
    for j in range(n):
        if (i >> j) & 1:
            sum += tm[j][0]
            for k in range(m):
                c[k] += tm[j][k+1]
    if min(c) >= x:
        b = min(b, sum)
if b == 10**18:
    print('-1')
else:
    print(b)
# Judge status: Accepted
n,k=map(int,input().split())
a=0
for i in range(n):
  t,c=i+1,0
  while t<k: t*=2; c+=1
  a+=0.5**c/n
print(a)
# Judge status: Wrong Answer
import numpy as np
n, d = map(int, input().split())
x, y = list(map(int, input().split()))

for i in range (n):
	np.sqrt(x ** 2 + y ** 2) <= d
        
print(i)
# Judge status: Accepted
n=int(input())
if n%2==0:
  print(n**2//4)
else:
  print((n**2-1)//4)
# Judge status: Accepted
k, s = map(int, input().split())
n = range(k+1)
count = 0
for x in n:
    for y in n:
        if 0 <= s-x-y <= k:
            count += 1

print(count)
# Judge status: Accepted
n=int(input())

l=[]
for i in range(n):
  s,p=input().split()
  p=-int(p)
  l.append([s,p,i+1])

l.sort()
for i in l:
  print(i[-1])
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())

Trapezoid = (a + b) * h // 2
print(Trapezoid)
# Judge status: Accepted

def solve(x):
    x = str(x)
    if len(x) != N:
        return False
    for s, c in P:
        if x[s - 1] != str(c):
            return False
    return True

if __name__ == "__main__":
    N, M = map(int, input().split())
    P = [list(map(int, input().split())) for i in range(M)]
    ans = 10**N
    for i in range(10 ** N - 1, -1, -1):
        if solve(i):
            ans = min(ans, i)
            
    print(ans if ans != 10**N else -1)
# Judge status: Accepted
X,A,B = map(int,input().split())
d = B-A
if d <= 0:
    print("delicious")
elif d <= X:
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
n,x,t = map(int,input().split())
for i in range(1,10**9):
    if n <= x*i:
        print(i*t)
        quit()
# Judge status: Accepted
k,a,b = map(int,input().split())

if a > b:
    print(1+k)
    exit()
kk = k
kk -= a - 1
ans = a + (kk // 2) * (b - a) + (kk % 2)

print(max(ans, 1+k))
# Judge status: Accepted
N = int(input())
MOD = 10 ** 9 + 7

power = 1
for i in range(1, N + 1):
  power *= i
  power %= MOD
print(power)
# Judge status: Accepted
sx,sy,tx,ty = map(int,input().split())
x=tx-sx
y=ty-sy

ans="R"*x+"U"*y + "L"*x+"D"*y + "D"+"R"*(x+1)+"U"*(y+1)+"L" + "U"+"L"*(x+1)+"D"*(y+1)+"R"
print(ans)
# Judge status: Wrong Answer
w = input()
cdict = {}
for c in w:
  if c in cdict:
    cdict[c] += 1
  else:
    cdict[c] = 0
    
if all(cdict[c]%2==0 for c in cdict):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N,M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
Y = []
if N>=M:
    print(0)
else:
    for i in range(M-1):
        Y.append(X[i+1]-X[i])
    Y=sorted(Y)[::-1]
    print(sum(Y[N-1:]))
# Judge status: Accepted
a,b,c=map(int,input().split())
d=0
f=0
e=1

while 1:
  
  f=a*e
  if c+0.5>=f:
    e+=1
    
    d+=b
  else:
    break
print(d)
# Judge status: Accepted
S = str(input())
T = str(input())
S=sorted(S)
T=sorted(T, reverse=True)
if S < T:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math
N = int(input())
N_square_root = math.floor(math.sqrt(N))
print(N_square_root**2)
# Judge status: Accepted
import bisect
n = int(input())
l = list(map(int, input().split()))
l.sort()
count = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        a = l[i]+l[j]
        index = bisect.bisect_left(l, a)
        count += index - j -1
print(count)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    s = input()
    WORD = 'keyence'

    l = len(s)
    for i in range(l):
        for j in range(i, l):
            if s[:i] + s[j:] == WORD:
                print('YES')
                exit()
    print('NO')
    
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a.sort()
e=[]
b=[]
turn=1
for i in range(n):
    if turn==1:
        e.append(a.pop(-1))
        turn-=1
    else:
        b.append(a.pop(-1))
        turn+=1
print(sum(e)-sum(b))
# Judge status: Accepted
n, m = map(int, input().split())
alst = [input() for _ in range(n)]
blst = [input() for _ in range(m)]

for i in range(n - m + 1):
    for j in range(n - m + 1):
        for k, row in enumerate(blst):
            if alst[i + k][j:j + m] == blst[k]:
                continue
            break
        else:
            print("Yes")
            exit()
print("No")
# 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,k=map(int,input().split())
A=list(map(int,input().split()))
print((n-2)//(k-1)+1)
# Judge status: Wrong Answer
def solution():
    l = int(input())
    
    maximum = 0
    for i in range(1, l*100):
        yoko = 0.01 * i
        for j in range(l*100-i):
            tate = 0.01 * j
            calc = tate * yoko * (l - tate - yoko)
            maximum = max(maximum, calc)
    print(maximum)

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

A_i = [0 for a in range(len(A))]
for i in range(K):
  for j in range(N):
    for k in range(A[j]):
      if j-A[j]+k >= 0:
        A_i[j-A[j]+k] = A_i[j-A[j]+k] + 1
      if j+k+1 < len(A):
        A_i[j+k+1] = A_i[j+k+1] + 1
    A_i[j] = A_i[j] + 1
  A = A_i
  A_i = [0 for a in range(len(A))]

print(A)
# Judge status: Wrong Answer
import sys
#from collections import deque
input = sys.stdin.buffer.readline

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)
ans = p[:x]
ans[x:x] = q[:y]
ans=sorted(ans)
i = 0
result = 0
for A in ans:
    if A < r[i]:
        result += r[i]
        if i < len(r) - 1:
            i += 1
        continue
    result += A
print(result)
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
for i in range(n-1):
    if A[i]+1==A[i+1]:
        ans+=C[A[i]-1]
print(ans+sum(B))
# Judge status: Accepted
h, a = map(int,input().split())
ans = h // a
if (h % a != 0):
    ans += 1
print(ans)
# Judge status: Accepted
lst = input().split()

X = int(lst[0])
A = int(lst[1])
B = int(lst[2])

d = B - A

if d <= 0:
   print('delicious')
elif d <= X:
   print('safe')
else:
   print('dangerous')
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())

dp=[0]*n
a = {"r":p, "s":r, "p":s}

for i in range(n):
    if i>=k and t[i]==t[i-k]: # どうせ得点できないので、次に影響しないように'x'
        dp[i]=0
        t[i]='x'
    else:
        dp[i]=a[t[i]]   
print(sum(dp))
# Judge status: Wrong Answer
from collections import defaultdict

N = int(input())
S = [input() for _ in range(N)]

d = defaultdict(lambda: N)

for i in range(N):
    for c in range(ord("a"), ord("z")+1):
        d[chr(c)] = min(d[chr(c)], S[i].count(chr(c)))

ans = ""
for key, value in d.items():
    ans += key * value

print(ans)
# Judge status: Accepted
import sys
N = int(input())
A = list(map(int, input().split()))
c = 0
a = 1
while 2 ** a <= 1e9:
    for i in range(N):
        if A[i] % (2 ** a) != 0:
            print(c)
            sys.exit()
    c += 1
    a += 1
print(c)
# Judge status: Wrong Answer
N = int(input())
s = [int(input()) for i in range(N)]

s.sort()

ans = sum(s)
for i in range(N):
    if ans%10 != 0:
        break
    elif s[i]%10 != 0:
        ans -= s[i]

print(ans)
# Judge status: Accepted
N = input()
a, b = 0, 1
for i in N:
    x = int(i)
    a, b = min(a+x, b+10-x), min(a+x+1, b+9-x)
print (a)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
d = Counter(s)
a = 0
for v in d.values():
  if v>a:
    a = v
for k in d.keys():
  if d[k]==a:
    print(k)
# Judge status: Accepted
N = int(input())
p = input().split()
p = [int(x) for x in p]

q = sorted(p)
c = 0
for i in range(N):
  if p[i] != q[i]:
    c +=1
if c == 0 or c == 2:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
a,b,c,k = map(int,input().split())

lim = 10**18
_a = b+c
_b = a+c
if lim < _a-_b:
    print('Unfair')
elif k%2==0:
    print((_a-_b)*-1)
else:
    print(_a-_b)
# Judge status: Accepted
def check(n, list1): 
    new = [] 
    for i in range(n): 
        new.append(list1[i]) 
          
    new.sort()
    swaps = 0
    for i in range(n): 
        if list1[i] != new[i]: 
            swaps += 1
              
    if swaps == 0 or swaps == 2: 
        return True
    else: 
        return False
  
n = int(input())

numbers =list(map(int, input().split()[:n]))



if check(n, numbers): 
    print("YES")
else:
    print("NO")
# Judge status: Accepted
K,X=map(int,input().split())
strs=[str(i) for i in range(X-K+1,X+K)]
print(" ".join(strs))
# Judge status: Accepted
S = input()
ans = []

for s in S:
    if s == '0':
        ans += '0'
    elif s == '1':
        ans += '1'
    else:
        if len(ans) != 0:
            ans = ans[:-1]

print(''.join(ans))
# Judge status: Accepted
k=int(input())
cnt=0
for i in range(10**6+1):
    cnt+=7*pow(10,i,k)
    cnt%=k
    if cnt==0:
        print(i+1)
        exit()
print(-1)
# Judge status: Accepted
S, W = map(int, input().split())

if S > W:
  print('safe')
else:
  print('unsafe')
# Judge status: Accepted
n = int(input())

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

ans = 0
for i in range(n-1,-1,-1):
    if (a[i]+ans)%b[i] == 0:
        pass
    elif a[i] + ans > b[i]:
        ans += b[i]-((a[i]+ans)%b[i])
    else:
        ans += b[i]-(a[i]+ans)  
print(ans)
# Judge status: Wrong Answer
s=input()
counter=0
if s[0]==1:
    counter+=1
if s[1]==1:
    counter+=1
if s[2]==1:
    counter+=1
print(counter)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

x = A[0]
y = sum(A[1:])
ans = abs(x - y)

for i in range(1, N - 1):
    x += A[i]
    y -= A[i]
    ans = min(ans, abs(x - y))

print(ans)
# Judge status: Accepted
mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True

ctypedef long long LL
cdef LL MOD = 10**9 + 7
cdef LL N = int(input())
cdef LL ans = 1

cdef i
for i in range(2, N + 1):
    ans *= i
    ans %= MOD
print(ans)
'''
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    import os
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode
# Judge status: Wrong Answer
N,R = map(int, input().split())

if N < 10:
  R = R - (100 * (10 - N))
  if R < 0:
    R = 0
print(R)
# Judge status: Accepted
N = list(input())
s = 0
for i in range(len(N)):
  s += int(N[i])
if s % 9 == 0:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a = input()
a.replace('2017','2018')
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import defaultdict 
def main():
    s = input() 
    n = len(s)
    T = [0]
    P = 2019
    dd = defaultdict(int) 
    dd[0] += 1
    for i in range(1, n+1):
        x = (int(s[-i])*pow(10, i-1, P) + T[i-1])%P
        T.append(x)
        dd[x] += 1
    ans = 0
    for i in dd.values():
        ans += i*(i-1)//2
    print(ans)
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
s=0
a.reverse()
s=sum(a[::2])-sum(a[1::2])
print(s)
# Judge status: Accepted
n,k,x,y=[int(input())for i in range(4)]
a=b=0
a=k*x if n>k else n*x;b=(n-k)*y if n>k else 0
print(a+b)
# Judge status: Accepted
a, b = input().split()
print(int(a)-(a>b))
# Judge status: Accepted
def resolve():
    import sys
    from operator import itemgetter
    readline = sys.stdin.readline
    N = int(readline())
    LR = [None] * N
    for i in range(N):
        p, l = map(int, input().split())
        LR[i] = [p-l, p+l]
    LR.sort(key=itemgetter(1))

    pre_r = -(10**18)
    count = 0
    for l, r in LR:
        if pre_r <= l:
            count += 1
            pre_r = r
    print(count)

resolve()
# Judge status: Wrong Answer
# your code goes here
x = int(input())
i = 1
n= 0
if x % 2 == 0 or x % 5 == 0:
    print(-1)
else:
    for i in range(1, 1000000):

        l =( 7 *pow(9,-1)* (pow(10,i,x) - 1%x) )
        n+=1
        
        if l % x == 0:
            break
    print(n)
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()
answer = n
for i in range (n) :
  newstring = s[0:i] + t[:n]
  if newstring[0:n] == s :
    answer += i
    break
print (answer)
# Judge status: Accepted
from decimal import Decimal, getcontext
a, b = map(int, input().split())
getcontext().prec = 50
c = Decimal(a) * Decimal(b)
if a == 1 or b == 1:
    print(1)
else:  
    if c % 2 == 1:
        print(int(c/2)+1)
    else:
        print(int(c/2))
# Judge status: Accepted
def main():
    n, l = map(int, input().split())
    print((n-1)//(2*l+1)+1)


main()
# Judge status: Accepted
a, b = map(str, input().split())
na, nb = map(int, input().split())
c = input()

dict = {a:na, b:nb}
dict[c] -=1

print('{0} {1}'.format(dict[a], dict[b]))
# Judge status: Wrong Answer
T=list(input())
l=len(T)
S=[]
for i in range(l-1):
  if T[i]=="P" or T[i]=="D":
    S.append(T[i])
  if T[i]=="?":
    if T[i+1]=="?" or T[i+1]=="D":
      S.append("P")
    if T[i+1]=="P":
      S.append("D")
      
if T[l-1]=="P" or T[l-1]=="D":
  S.append(T[l-1])
if T[l-1]=="?":
  S.append("D")

P=''.join(S)
print(P)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
a_sort = sorted(a)
right = a_sort[N // 2]
left = a_sort[N // 2 - 1]
for i in range(N):
    if a[i] <= left:
        print(right)
    elif a[i] >= right:
        print(left)
# Judge status: Wrong Answer
import sys
n = int(input())
if n % 2 == 1:
  print("0")
  sys.exit()
m = n/2
count = 0
i = 1
while m >= 5 ** i:
  count += (m // (5 ** i))
  i += 1
print(int(count))
# Judge status: Wrong Answer
h1,m1,h2,m2,k=map(int,input().split())

ans=(h2-h1-1)*60+(60-m1)-(m2-0)-k
print(ans)
# Judge status: Wrong Answer
N = int(input())

MIN = 100000000000000
for i in range(N+1):
  A = sum(map(int,list(str(i))))
  B = sum(map(int,list(str(N-i))))
  MIN = min(A+B,MIN)
  
print(MIN)
# Judge status: Accepted
H, N = map(int, input().split())
A = []
B = []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

INF = float('inf')

dp = [[INF] * (H+1) for _ in range(N+1)]

dp[0][0] = 0

for i in range(N):
    for j in range(H+1):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        dp[i+1][min(H, j+A[i])] = min(dp[i+1][min(H, j+A[i])], dp[i+1][j] + B[i])

print(dp[N][H])
# Judge status: Wrong Answer
x = list(map(int,input().split()))

n = x[0]
a = x[1]
b = x[2]

s = input()
c = 0
k = 0

for i in range(0,n):
  if(s[i] == "a"):
    if(c < a + b):
      print("yes")
      c = c + 1
    else:
      print("No")
  elif(s[i] == "b"):
    if(c < a + b and k < b):
      print("Yes")
      c = c + 1
      k = k + 1
    else:
      print("No")
      k = k + 1
  elif(s[i] == "c"):
    print("No")
    continue
# Judge status: Accepted
s = input()

if 'L' in s[::2] or 'R' in s[1::2]:
    ans = 'No'
else:
    ans = 'Yes'
print(ans)
# Judge status: Wrong Answer
# import fractions
# import sys
from sys import stdin

n, m = map(int, stdin.readline().rstrip().split())

m = m // 2
print((n + m) // 2)
# Judge status: Wrong Answer
def culc_expected_value(num):
  output = 0
  if num != 1:
    for i in range(1, num+1):
      output += i/num
  else:
    output = 1
  return output

n, k = map(int, input().split())
desc_p_list = sorted(map(int, input().split()), reverse=True)
targets = desc_p_list[:k]
# print(targets)

ans = 0
for t in targets:
  ans += culc_expected_value(t)
  # print(ans)

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

for i in range(n+1):
    for j in range(m+1):
        if i*m+j*n-2*(i*j) == k:
            print('Yes')
            exit()
else:
    print('No')
# Judge status: Accepted
n=int(input())
a=[int(x) for x in input().rstrip().split()]
full=sum(a)
now=0
ans=float('inf')
for i in a:
  now+=i
  ans=min(abs(full-2*now),ans)
print(ans)
# Judge status: Accepted
s = input()
if 'RRR' in s:
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
# -*- coding : utf-8 -*-

n = int(input())
k = int(input())
x = int(input())
y = int(input())

if n <= k :
  print(x * n)
else:
  print(x*k + y * (x-k))
# Judge status: Wrong Answer
N = int(input())

loc = [0,0]
time = 0
for i in range(N):
  t,x,y = map(int,input().split())
  time = t-time
  dis = abs(loc[0]-x)+abs(loc[1]-y)
  if (time-dis)<0 :
    print("No")
    exit()
  if (time-dis)%2 == 1:
    print("No")
    exit()
    
  
  
  loc = [x,y]
    
  
else :
  print("Yes")
# Judge status: Wrong Answer
X=int(input())

while True:
    if (17**X -17 )%X==0:
        print(X)
        exit(0)

    X+=1
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
print(a, b, c, d)

distance_ab = abs(a - b)
distance_bc = abs(b - c)
distance_ac = abs(a - c)


if distance_ab <= d and distance_bc <= d: # aとcが間接的に話せる。
    print('Yes')
elif distance_ac <= d: # aとcが直接話せる。
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if (b - a) == (c - b):
    print('YES')
else:
    print('No')
# Judge status: Accepted
s = input()
if s[0] == "A" and s[2:-1].count("C")==1:
    c = s[2:-1].index('C')
    if (s[1]+s[2:c+2]+s[c+3:]).islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')
# Judge status: Wrong Answer
l=['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI','SAT']
day=input()

diff=7-day.index(day)
print(diff)
# Judge status: Accepted
n,m=map(int,input().split())
l=list(map(int,input().split()))

if n>=m:
  print(0)
else:
  num=n-1
  sl=sorted(l)

  dsl=[abs(sl[i+1]-sl[i]) for i in range(m-1)]

  dsl=sorted(dsl)
  print(sum(dsl[0:len(dsl)-num]))
# Judge status: Accepted
C = [list(map(int, input().split())) for _ in range(3)]

flg = True
a1 = 0
b1 = C[0][0]
b2 = C[0][1]
b3 = C[0][2]

if not (C[1][0]-b1==C[1][1]-b2 and C[1][1]-b2==C[1][2]-b3):
    flg = False
if not (C[2][0]-b1==C[2][1]-b2 and C[2][1]-b2==C[2][2]-b3):
    flg = False

if flg:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
#145 b
n=int(input())
s=input()
ans="No"
if n%2==1:
    print(ans)
else:
    x=int(n/2)
    if s[0:x]==s[x:]:
        ans="Yes"
        print(ans)
# Judge status: Wrong Answer
n,m,q = map(int ,input().split())
lst = [list(map(int, input().split())) for _ in range(q)]
import itertools
l = [i+1 for i in range(m)]
lst2 = [com for com in itertools.combinations(l, n)]
res = 0
for com in lst2:
    score = 0
    for l in lst:
        if com[l[1]-1] - com[l[0]-1] == l[2]:
            score += l[3]
    if res < score:
        res = score 
    print(score)
print(res)
# Judge status: Accepted
n=int(input())
a=[list(map(int,input().split())) for i in range(2)]
ans=0
for i in range(n):
  cnt=0
  for j in range(i+1):
    cnt+=a[0][j]
  for j in range(i,n):
    cnt+=a[1][j]
  ans=max(ans,cnt)
print(ans)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
print('Yes' if A-C>0 or C-B>0 and A-C<0 or C-B<0 else 'No')
# Judge status: Accepted
X = int(input())

if 400 <= X <= 599:
    print('8')
elif 600 <= X <= 799:
    print('7')
elif 800 <= X <= 999:
    print('6')
elif 1000 <= X <= 1199:
    print('5')
elif 1200 <= X <= 1399:
    print('4')
elif 1400 <= X <= 1599:
    print('3')
elif 1600 <= X <= 1799:
    print('2')
elif 1800 <= X <= 1999:
    print('1')
# Judge status: Wrong Answer
S = input()

count_0 = 0
count_1 = 1
for s in S:
    if s == "0":
        count_0 += 1
    else:
        count_1 += 1
        
print(2 * min(count_0, count_1))
# Judge status: Accepted
import sys

A, B, C = map(int, input().split())
i = 1
while (A*i)%B != C:
    i += 1
    if i > 100:
        print('NO')
        sys.exit()
print('YES')
# Judge status: Wrong Answer
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if __name__ == '__main__':  
    N, P = map(int, input().split())
    A = list(map(int, input().split()))

    ans = 0
    if P == 0:
        for i in range(0, N+1, 2):
            ans += comb(N, i)
    else:
        for i in range(1, N+1, 2):
            print(i)
            ans += comb(N, i)
    print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
x = [a, min(a+1, b), max(a, b-1), b]
y = [c, min(c+1, d), max(c, d-1), d]

ans = -int(1e19)
for i in x:
  for j in y:
    ans = max(ans, i*j)
print(ans)
# Judge status: Accepted
n = int(input())
for i in range(26):
    for j in range(16):
        if 4*i + 7*j == n:
            print("Yes")
            exit()
print("No")
# Judge status: Wrong Answer
n, x = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
ans = 0
for a in A:
    if x - a >= 0:
        x -= a
        ans += 1
if 0 < x:
    for a in A:
        x -= a
        ans -= 1
        if x <= 0:
            break

print(max(ans, 0))
# Judge status: Accepted
#-*-coding:utf-8-*-

import math

def main():
    h = int(input())
    w = int(input())
    n = int(input())
    if w >= h:
        ans = math.ceil(n/w)
    else:
        ans = math.ceil(n/h)
    print(ans)

if __name__=="__main__":
    main()
# Judge status: Wrong Answer
N = list(range(1, int(input())+1))

cnt = 0
for n in N:
    cnt += n%2==0
    
print(cnt/len(N))
# Judge status: Wrong Answer
S = input()

if S.count('N') > 0 or S.count('S') > 0:
  if S.count('N') > 0 and S.count('S') > 0:
    ans = 'Yes'
  else:
    ans = 'No'
if S.count('W') > 0 or S.count('E') > 0:
  if S.count('W') > 0 and S.count('E') > 0:
    ans = 'Yes'
  else:
    ans = 'No'

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

def S(): return sys.stdin.readline().rstrip()

A,B,K = map(int,S().split())

if K <= A:
    print(K-A,B)
elif K >= A+B:
    print(0,0)
else:
    print(0,B-K+A)
# Judge status: Accepted
s=input()

print(chr(1+ord(s)))
# Judge status: Wrong Answer
array = input().split()
n = int(array[0])
a = int(array[1])
b = int(array[2])

print(n//(a+b)*a + n%(a+b))
# Judge status: Accepted
x, y, a, b, c = map(int, input().split())
print(sum(sorted(
    sorted(int(x) for x in input().split())[-x:] +
    sorted(int(x) for x in input().split())[-y:] +
    [int(x) for x in input().split()])[-(x+y):]))
# Judge status: Accepted
N = int(input())

s = 0
for i in range(1, N+1):
    if i % 3 != 0 and i % 5 != 0:
        s += i
print(s)
# Judge status: Accepted
N = int(input())
out = ["AC","WA","TLE","RE"]
output = [0]*4

for _ in range(N):
    S = input()
    if S == out[0]:
        output[0] += 1
    elif S == out[1]:
        output[1] += 1
    elif S == out[2]:
        output[2] += 1
    else:
        output[3] += 1

print(out[0],"x",output[0])
print(out[1],"x",output[1])
print(out[2],"x",output[2])
print(out[3],"x",output[3],end="")
# Judge status: Accepted
n = int(input())
a = []
b = []

for i in range(n):
    x , y = map(int,input().split());
    a.append(x + y)
    b.append(x - y)

aa = max(a)-min(a)
bb = max(b)-min(b)

if aa >= bb:
    print(aa)
else:
    print(bb)
# Judge status: Accepted
S = input()[::-1]
W = ['dream','dreamer','erase','eraser']
i = 0
while i < len(S):
    for w in W:
        if S[i:i+len(w)] == w[::-1]:
            i += len(w)
            break
    else:
        print('NO')
        exit()
print('YES')