Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N = int(input())

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

ans = 1

for i in range(N):
    ans *= A[i]

if ans > 1000000000000000000:
    print(-1)
    exit()

print(ans)

### FIXED CODE ###

N = int(input())

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

ans = 1

for item in A:
    ans *= item

    ans = min(ans, 10**18 + 1)

if ans == 10**18 + 1:
    print(-1)
    exit()

print(ans)
### BUGGY CODE ###

n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(int(p ** (1 / n)) + 1, 0, -1):
        if p % (i ** n) == 0:
            print(i)
            break

### FIXED CODE ###

n,p = map(int,input().split())
dum = round(p**(1/n))
for i in range(dum,-1,-1):
    if p%(i**n) == 0:
        print(i)
        break
### BUGGY CODE ###

s=str(input())
n=len(s)
ans=0
l=[0 for i in range(2019)]
for i in range(n):
  t=int(s[i:])
  l[t%2019]+=1
#print(l[1817])
ans+=l[0]
l[0]=0
for i in l:
  ans+=int(i*(i-1)//2)
print(ans)

### FIXED CODE ###

s=str(input())
n=len(s)
ans=0
l=[0 for i in range(2019)]
now=l[int(s[n-1])]
r=1
for i in range(1,n+1):
  now=(now+int(s[-i])*r)%2019
  l[now]+=1
  r=r*10
  r=r%2019
ans+=l[0]
for i in l:
  ans+=int(i*(i-1)//2)
print(ans)
#print(l)
### BUGGY CODE ###

import numpy as np

N,M,R=map(int,input().split())
r=list(map(int,input().split()))

ROAD=[None]*M

for i in range(M):
    ROAD[i]=list(map(int,input().split()))


Dis=np.full((N+1,N+1),float("inf"))

for i in range(M):
    Dis[ROAD[i][0]][ROAD[i][1]]=ROAD[i][2]
    Dis[ROAD[i][1]][ROAD[i][0]]=ROAD[i][2]




#ワーシャル–フロイド法を使って最短距離Disを求める

for k in range(1,N+1):#k個までの町を使ってのDisが知れているときに
    for i in range(1,N+1):#町iと
        for j in range(1,N+1):#町jとの最短距離は、
            Dis[i][j]=min(Dis[i][j],Dis[i][k]+Dis[j][k])
    
        
import itertools
    
PERM=list(itertools.permutations(r,R))

ANS=float("inf")
for i in range(len(PERM)):
    DIST=0
    for k in range(1,R):
        DIST+=Dis[PERM[i][k]][PERM[i][k-1]]
        if DIST>ANS:
            break
    ANS=min(ANS,DIST)


print(int(ANS))


### FIXED CODE ###

#import numpy as np
import itertools
import time

N,M,R=map(int,input().split())
r=list(map(int,input().split()))

ROAD=[None]*M

for i in range(M):
    ROAD[i]=list(map(int,input().split()))


#Dis=np.full((N+1,N+1),float("inf"))

Dis=[None]*(N+1)
for i in range(1,N+1):
    Dis[i]=[100000000]*(N+1)

for i in range(M):
    Dis[ROAD[i][0]][ROAD[i][1]]=ROAD[i][2]
    Dis[ROAD[i][1]][ROAD[i][0]]=ROAD[i][2]



#ワーシャル–フロイド法を使って最短距離Disを求める

for k in range(1,N+1):#k個までの町を使ってのDisが知れているときに
    for i in range(1,N+1):#町iと
        for j in range(i,N+1):#町jとの最短距離は、
            length=Dis[i][k]+Dis[j][k]
            if Dis[i][j]>length:
                Dis[i][j]=length
                Dis[j][i]=length


  
PERM=list(itertools.permutations(r))



ANS=float("inf")
for i in range(len(PERM)):
    DIST=0
    for k in range(1,R):
        DIST+=Dis[PERM[i][k]][PERM[i][k-1]]
        if DIST>ANS:
            break
    if ANS>DIST:
        ANS=DIST

print(int(ANS))
### BUGGY CODE ###

s = input()
q = int(input())

ctn = 0
query = []
for _ in range(q):
    temp = input().split()
    if len(temp) == 1:
        ctn += 1
    query.append(temp)

flag = 0
for q in query:
    if q[0] == "1":
        if flag == 1:
            flag = 0
        else:
            flag = 1
    else:
        if flag == 0:
            if q[1] == "1":
                s = q[2] + s
            else:
                s = s + q[2]
        else:
            if q[1] == "1":
                s = s + q[2]
            else:
                s = q[2] + s

if ctn % 2 == 1:
    print(s[::-1])
else:
    print(s)

### FIXED CODE ###

from collections import deque

def main():

    s = deque(input())
    q = int(input())

    flag = 0
    query = []

    for _ in range(q):
        temp = input().split()
        if len(temp) == 1:
            flag += 1
        else:
            query.append(temp + [flag%2])

    for q in query:
        if q[-1] == 0:
            if q[1] == "1":
                s.appendleft(q[2])
            else:
                s.append(q[2])
        else:
            if q[1] == "1":
                s.append(q[2])
            else:
                s.appendleft(q[2])

    if flag % 2 == 1:
        print("".join(list(s)[::-1]))
    else:
        print("".join(s))

main()
### BUGGY CODE ###

n, k = map(int, input().split())
li = list(map(int, input().split()))
if k >= 1 and k < n:
  for i in range(k):
    li.remove(max(li))
  print(sum(li))
elif k == 0:
  print(sum(li))
elif k >= n:
  print(0)

### FIXED CODE ###

n, k = map(int, input().split())
li = list(map(int, input().split()))
li_a = sorted(li)
if k == 0:
  print(sum(li_a))
elif k >= n:
  print(0)
else:
  for i in range(k):
    li_a.pop()
  print(sum(li_a))
### BUGGY CODE ###

n= int(input())
nn = n
sum = 0
while nn > 0:
    sum += nn % 10
    nn = nn // 10
if sum % 9 == 0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n = input()
sum = 0
for i in range(len(n)):
    num = int(n[i])
    sum += num
if sum % 9 == 0:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

from collections import defaultdict

n, l = map(int, input().split())
nums = defaultdict(set)
for s in (input() for _ in range(n)):
    nums[l - len(s) + 1].add(int(s, 2) + (1 << len(s)))

xor = 0
for i in range(min(nums), l + 1):
    ni = nums[i]
    for k in ni:
        if k ^ 1 not in ni:
            xor ^= i & -i
        nums[i + 1].add(k // 2)

print('Alice' if xor else 'Bob')


### FIXED CODE ###

import sys

sys.setrecursionlimit(100000)


def dfs(cur, dep=0):
    if cur == -1:
        x = l - dep
        return x & -x
    return dfs(trie[cur][0], dep + 1) ^ dfs(trie[cur][1], dep + 1)


n, l = map(int, input().split())
trie = [[-1, -1] for _ in range(100001)]
idx = 1
for s in (input() for _ in range(n)):
    cur = 0
    for c in map(int, s):
        if trie[cur][c] == -1:
            trie[cur][c] = idx
            idx += 1
        cur = trie[cur][c]

xor = dfs(trie[0][0]) ^ dfs(trie[0][1])
print('Alice' if xor else 'Bob')
### BUGGY CODE ###

MOD = 10 ** 9 + 7
S = input()

dp = [0] * 13
dp[0] = 1

for s in S:
  prev = [x % MOD for x in dp]
  dp = [0] * 13
  if s == '?':
    add = range(10)
  else:
    add = [int(s)]
  for i in range(13):
    for x in add:
      dp[(10*i+x)%13] += prev[i]
  
print(dp[5] % MOD)


### FIXED CODE ###

MOD = 10 ** 9 + 7
S = input()

dp = [0] * 13
dp[0] = 1

for s in S:
  prev = [x for x in dp]
  dp = [0] * 13
  if s == '?':
    add = range(10)
  else:
    add = [int(s)]
  for i in range(13):
    for x in add:
      dp[(10*i+x)%13] += prev[i]
  dp = [x % MOD for x in dp]
  
print(dp[5])
### BUGGY CODE ###

def lcs(X, Y):
    m = len(X) + 1
    n = len(Y) + 1
    c = [[0] * n for _ in xrange(m)]
    X = ' ' + X
    Y = ' ' + Y
    for i in xrange(1,m):
        for j in xrange(1,n):
            if X[i] == Y[j]:
                c[i][j] = c[i-1][j-1] + 1
            elif c[i-1][j] >= c[i][j-1]:
                c[i][j] = c[i-1][j]
            else:
                c[i][j] = c[i][j-1]
    print c[m-1][n-1]
    return 0

def main():
    q = int(raw_input())
    for i in xrange(q):
        X = raw_input()
        Y = raw_input()
        lcs(X,Y)
    return 0

main()

### FIXED CODE ###

def lcs(x,y):
    a, b = len(x), len(y)
    x1 = [0 for k in range(b+1)]
    for i in xrange(a):
        e = x[i]
        x2 = x1+[]
        for j in xrange(b):
            if e == y[j]:
                x1[j+1] = x2[j] + 1
            elif x1[j+1] < x1[j]:
                x1[j+1] = x1[j]
    print max(x1)
    return 0

def main():
    q = int(raw_input())
    for i in xrange(q):
        X = raw_input()
        Y = raw_input()
        lcs(X,Y)
    return 0

main()
### BUGGY CODE ###

inp1 = input()
n = int(inp1.split(" ")[0])
k = int(inp1.split(" ")[1])
q = int(inp1.split(" ")[2])
 
each_point = []
for i in range(n):
  each_point.append(k)
 
for j in range(q):
  ans = int(input())
  for m in range(n):
    each_point[m] -= 1
  each_point[ans-1] += 1
 
for x in range(n):
  if (each_point[x] < 1):
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

import sys

def happyo(n,each_point):
  for x in range(n):
    if (each_point[x] < 1):
      print("No")
    else:
      print("Yes")

inp1 = input()
n = int(inp1.split(" ")[0])
k = int(inp1.split(" ")[1])
q = int(inp1.split(" ")[2])

if(k>100000):
  for x in range(n):
    print("Yes")
  sys.exit()

each_point = []
for i in range(n):
  each_point.append(k-q)
 

for j in range(q):
  ans = int(input())
  each_point[ans-1] += 1
 
happyo(n,each_point)
### BUGGY CODE ###

h,w = map(int, input().split())
maze = [input() for i in range(h)]
route = [[0] * w for i in range(h)]
 
class MyStack:
    def __init__(self):
        self.stack = []
    def push(self, item_1, item_2):
        self.stack.append([item_1,item_2])
    def pop(self):
        result = self.stack.pop(0)
        return result[0],result[1]

 
ans = 0
stack = MyStack()
black_list = []
for i in range(h):
    for j in range(w):
        if maze[i][j] == '#':
            stack.push(i+1,j+1)
while stack.stack:
    y,x = stack.pop()
    route_num = route[y-1][x-1] + 1
    if y != h:
        if maze[y][x-1] == '.' and route[y][x-1] == 0:
            stack.push(y+1,x)
            route[y][x-1] = route_num
            ans = max(ans,route[y][x-1])
            
    if y != 1:
        if maze[y-2][x-1] == '.' and route[y-2][x-1] == 0:
            stack.push(y-1,x)
            route[y-2][x-1] = route_num
            ans = max(ans,route[y-2][x-1])
            
    if x != w:
        if maze[y-1][x] == '.' and route[y-1][x] == 0:
            stack.push(y,x+1)
            route[y-1][x] = route_num
            ans = max(ans,route[y-1][x])

    if x != 1:
        if maze[y-1][x-2] == '.' and route[y-1][x-2] == 0:
            stack.push(y,x-1)
            route[y-1][x-2] = route_num
            ans = max(ans,route[y-1][x-2])
            
print(ans)

### FIXED CODE ###

from subprocess import call
call (('pypy3', '-c', """
from collections import deque
 
def main():
    h, w = map(int, input().split())
    A = [list(input()) for _ in range(h)]
    d = [[10**9] * w for _ in range(h)]
    que = deque([])
    
    for i in range(h):
        for j in range(w):
           if A[i][j] == "#":
               que.append([i, j])
               d[i][j] = 0
           else:
               d[i][j] = 10 ** 9
            
    while que:
        x, y = que.popleft()
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4): 
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < h and 0 <= ny < w and d[nx][ny] == 10**9:
                d[nx][ny] = d[x][y] + 1
                que.append([nx, ny])
    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, d[i][j])
    print(ans)
    
    return
    
main()
 
"""))
### BUGGY CODE ###

import numpy as np
dummyn = int(input())
a = list(map(int, input().split()))
b_np = np.array([sum(a[:i+1]) for i in range(len(a))])

ans = 0
for i in range(len(b_np)-1):
    if b_np[i] * b_np[i+1] >= 0 and b_np[i] <= 0 and b_np[i] <= b_np[i+1]:
        ans += (1 - b_np[i+1])
        b_np[i+1:] += (1 - b_np[i+1])
    elif b_np[i] * b_np[i+1] >= 0 and b_np[i] < 0 and b_np[i] > b_np[i+1]:
        ans +=  (1 - b_np[i])
        b_np[i:] += (1 - b_np[i])
    elif b_np[i] * b_np[i+1] >= 0 and b_np[i] >= 0 and b_np[i] >= b_np[i+1]:
        ans += (b_np[i+1] + 1)
        b_np[i+1:] -= (b_np[i+1] + 1)
    elif b_np[i] * b_np[i+1] >= 0 and b_np[i] > 0 and b_np[i] < b_np[i+1]:
        ans += (b_np[i] + 1)
        b_np[i:] -= (b_np[i] + 1)

print(ans)

### FIXED CODE ###

n=input()
a=[int(i) for i in input().split()]
def chk(a,t):
    ans=0
    x=0
    for i in a:
        x+=i
        if t==True and x<1:
            ans+=1-x
            x=1
        elif t==False and x>-1:
            ans+=x+1
            x=-1
        t=not t
    return ans
print(min(chk(a,True),chk(a,False)))
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def main():
    s = "".join(input().split())
    q = int(input())
    queries = [list(input().split()) for _ in range(q)]
    for query in queries:
        if query[0] == "1":
            s = s[::-1]
            continue
        if query[1] == "1":
            s = "".join(query[2] + s)
        else:
            s = "".join(s + query[2])
    print(s)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline


def main():
    s = input().strip()
    q = int(input())
    queries = [input().split() for _ in range(q)]
    pre = []
    post = []
    flg = True
    for query in queries:
        if query[0] == "1":
            flg = not flg
            continue
        if query[1] == "1":
            if flg:
                pre.append(query[2])
            else:
                post.append(query[2])
        else:
            if flg:
                post.append(query[2])
            else:
                pre.append(query[2])
    pre.reverse()
    pre.append(s)
    pre.extend(post)
    s = "".join(pre)
    if not flg:
        s = s[::-1]
    print(s)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

#D in [S_i-X_i,T_i-X_i) → Xiで止まる
import sys
input = sys.stdin.readline
from heapq import heappush,heappop

N,Q = map(int,input().split())
q = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  heappush(q,(s-x,1,x)) # xで死ぬ
  heappush(q,(t-x,0,x)) # xで死ななくなる

for i in range(Q):
  d = int(input())
  heappush(q,(d,2,i))
answer = [-1]*Q

se = []
remove_task = []

while q:
  a,c,b = heappop(q)
  if not c:
    heappush(remove_task,b)
  elif c&1:
    heappush(se,b)
  else:
    while remove_task:
      x = se[0]
      y = remove_task[0]
      if x == y:
        heappop(se)
        heappop(remove_task)
        continue
      break
    if se:
      answer[b] = se[0]
  #print(a,c,b,se,remove_task)
print('\n'.join(map(str,answer)))


### FIXED CODE ###

#D in [S_i-X_i,T_i-X_i) → Xiで止まる
import sys
input = sys.stdin.readline

N,Q = map(int,input().split())
q = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  q.append((s-x,1,x)) # xで死ぬ
  q.append((t-x,0,x)) # xで死ななくなる

for i in range(Q):
  d = int(input())
  q.append((d,2,i))
answer = [-1]*Q

se = set() # 引っかかってる場所

q.sort()

min_se = 10**18
flag = False # min_seが正しい

for a,c,b in q:
  if not c:
    se.remove(b)
    if min_se == b:
      flag = False
  elif c&1:
    se.add(b)
    if b < min_se:
      min_se = b
      flag = True
  else:
    if se:
      if not flag:
        min_se = min(se)
        flag = True
      answer[b] = min_se

print('\n'.join(map(str,answer)))
### BUGGY CODE ###

def left(arr, idx):
    count = 0
    while idx >= 0 and arr[idx] == '<':
        count += 1
        idx -= 1
    return count

def right(arr, idx):
    count = 0
    while idx < len(arr) and arr[idx] == '>':
        count += 1
        idx += 1
    return count

def main():
    S = list(input())
    N = len(S)
    A = [0 for _ in range(N+1)]
    
    for i in range(len(A)):
        A[i] = max(left(S, i-1), right(S, i))
            
    print(sum(A))

if __name__ == "__main__":
    main()


### FIXED CODE ###

def left(arr, idx):
    if L[idx] != None:
        return L[idx]

    if arr[idx] == '<':
        if idx == 0:
            ret = 1
        else:
            ret = left(arr, idx-1) + 1
    else:
        ret = 0

    L[idx] = ret
    return ret
        
def right(arr, idx):
    if R[idx] != None:
        return R[idx]

    if arr[idx] == '>':    
        if idx == len(arr)-1:
            ret =  1
        else:
            ret = right(arr, idx+1) + 1
    else:
        ret = 0
    R[idx] = ret
    return ret

def main():
    S = list(input())
    N = len(S)
    A = [0 for _ in range(N+1)]
    
    global L; L = [None for _ in range(N)]
    global R; R = [None for _ in range(N)]

    for i in range(N):
        j = N - i - 1
        L[i] = left(S, i)
        R[j] = right(S, j)
    
    L = [0] + L
    R = R + [0]

    for i in range(len(A)):
        A[i] = max(L[i], R[i])
            
    print(sum(A))

if __name__ == "__main__":
    main()
### BUGGY CODE ###

import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c_=c*A_//fractions.gcd(c,A_)
    a=(a*c_//c+c_//A_)%w
    c=c_
print(int(a))

### FIXED CODE ###

import fractions
N=int(input())
A=list(map(int,input().split()))
c=1
a=0
w=10**9+7
for A_ in A:
    c=c*A_//fractions.gcd(c,A_)
for A_ in A:
    a+=c//A_
print(int(a%w))
### BUGGY CODE ###

def main():
  import sys
  b=sys.stdin.buffer
  input=b.readline
  n,q=map(int,input().split())
  d=[0]*n+[1<<int(i)for i in input().split()]
  for i in range(n-1,0,-1):d[i]=d[i+i]|d[i-~i]
  r=[]
  add=r.append
  for a,b in zip(*[iter(b.read().split())]*2):
    i,s=int(a)+n-1,0
    j=int(b)+n
    while i<j:
      if i&1:
        s|=d[i]
        i+=1
      if j&1:
        j-=1
        s|=d[j]
      i>>=1
      j>>=1
    add(bin(s).count('1'))
  print(' '.join(map(str,r)))
main()

### FIXED CODE ###

import sys
from operator import itemgetter
buf = sys.stdin.buffer
input = buf.readline
class BIT:
    def __init__(self, n):
        self.n = n
        self.tree = [0] * (n + 1)
    def add(self, i, x):
        n, tree = self.n, self.tree
        while i <= n:
            tree[i] += x
            i += i & -i
    def sum(self, i):
        tree = self.tree
        s = 0
        while i:
            s += tree[i]
            i -= i & -i
        return s
def main():
    n, q = map(int, input().split())
    res = [0] * q
    *c, = map(int, input().split())
    q = [(i, l, r) for i, (l, r) in enumerate(zip(*[map(int, buf.read().split())] * 2))]
    q.sort(key=itemgetter(2))
    bit = BIT(n + 2)
    add, sum = bit.add, bit.sum
    b = [1] * (n + 1)
    j = 1
    for i, l, r in q:
        while j <= r:
            d = c[j - 1]
            j += 1
            k = b[d]
            b[d] = j
            add(k + 1, 1)
            add(j + 1, -1)
        res[i] = sum(l + 1)
    print(' '.join(map(str, res)))
main()
### BUGGY CODE ###

## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math


#計算量を無視して愚直に実装してみる
S = input() #文字列型で受け取る
#print(len(S))

index = [i for i in range(len(S))]
combi = list(combinations(index, 2))
#print(combi)

counter = 0
for i in range(len(combi)):
    #print()
    #print('start:{},goal:{}'.format(combi[i][0], combi[i][1]+1))
    s = S[combi[i][0]:combi[i][1]+1]
    #print('s:{},s%2019:{}'.format(s, int(s)%2019))
    #print()
    if(int(s) % 2019 == 0):
        #print('hit')
        counter += 1
print(counter)



'''
#実験1
def is_there_0(K):
    #文字列入力
    ret = 'No'
    for i in range(len(K)):
        if(K[i] == '0'):
            ret = 'Yes'
    return ret

for i in range(1000):
    if(is_there_0(str(2019*i)) == 'No'):
        print('i:{}, 2019*i:{}'.format(i, 2019*i))
'''




















'''
#実験2
l = []
for i in range(10000):
    l.append( (2019*i)%10000 )

l = sorted(l)
#print(l)
print(len(l))
'''


### FIXED CODE ###

## coding: UTF-8

S = input()[::-1] #文字列型で受け取る
N = len(S)
#print(S)

remainder = [0] * 2019
tmp = 0
rad = 1 # *10**(i) % 2019
for i in range(N):
    r = int(S[i])
    tmp += r*rad
    tmp %= 2019
    #print(tmp)
    remainder[tmp] += 1
    rad *= 10
    rad %= 2019

    #print(S[i:], int(S[i:])%2019)
    #remainder[int(S[i:])%2019]+= 1
remainder[0] += 1
#print(-1)



answer = 0
for i in range(2019):
    p = remainder[i]
    answer += p*(p-1)/2
print(int(answer))
### BUGGY CODE ###

n=int(input())
x=list(map(int,input().split()))
for i in range(n):
    k=x.pop(0)
    y=x[:] #deepcopyと同じ.
    print(sorted(y)[(n-1)//2])
    x.append(k)

### FIXED CODE ###

# ABC094C - Many Medians (ARC095C)
def main():
    n = int(input())
    x = list(map(int, input().split()))
    # 偶数個の数から一つ数を取り除いたものの中央値はl,hのいずれか.
    l, h = sorted(x)[n // 2 - 1 : n // 2 + 1]
    ans = [h if e <= l else l for e in x] # l以下の値を取り除いたならば中央値はh
    print("\n".join(map(str, ans)))
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys

N, M = map(int, sys.stdin.readline().split())
P = [None]*M
S = [None]*M
for i in range(M):
    P[i], S[i] = sys.stdin.readline().split()

AC = [0]*N
WA = 0
for i in range(M):
    if S[i] == "AC":
        if AC[int(P[i])-1] == 0:
            AC[int(P[i])-1] += 1
            for j in range(i):
                if P[j] == P[i] and S[j] == "WA":
                    WA += 1

print(sum(AC), WA)

### FIXED CODE ###

N, M = map(int, input().split())
P = [None]*M
S = [None]*M
for i in range(M):
    P[i], S[i] = input().split()
    P[i] = int(P[i])

AC = [0]*(N+1)
wa = [0]*(N+1)
WA = 0

for i in range(M):
    if S[i] == "WA":
        if AC[P[i]] == 0:
            wa[P[i]] += 1
    else:
        AC[P[i]] = 1

for i in range(N+1):
    WA += wa[i]*AC[i] 

print(sum(AC[1:]), WA)
### BUGGY CODE ###

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

for i in range(1,n+1):
    print(a.count(i))
    

### FIXED CODE ###

n = int(input())
a =list(map(int, input().split()))
l =[0] * (n+1)

for i in range(0,n-1):
    l[a[i]] +=1
    
for i in range(1,n+1):
    print(l[i])
### BUGGY CODE ###

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

for k in range(K):
  light = [0] * N
  for i in range(N):
    start = max(0,i-A[i])
    end = min(N-1, i+A[i])
    for j in range(start, end+1):
      light[j] += 1
  A = light

print(" ".join(map(str,light)))

### FIXED CODE ###

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

import math
K = min(K, 43)
for k in range(K):
  light = [0] * (N+1)
  for i in range(N):
    start = max(0,i-A[i])
    end = min(N-1, i+A[i])
    light[start] += 1
    light[end+1] -= 1
  for i in range(1,N):
    light[i] += light[i-1]
    
  A = light

light.pop()
print(" ".join(map(str,light)))
### BUGGY CODE ###

def f(k, a_s):
    md = 10 ** 9 + 7
    dp = [[0] * (k + 1) for _ in range(n)]
    dp[0][0] = 1
    for i, a in enumerate(a_s[:-1]):
        dp[i + 1][0] = s = dp[i][0]% md
        for j in range(1, a + 1):
            dp[i + 1][j] = s = (s + dp[i][j])% md
        for j in range(a + 1, k + 1):
            dp[i + 1][j] = s = (s + dp[i][j] - dp[i][j - a - 1])% md
    return sum(dp[-1][k - a_s[-1]:]) % md


n, k = map(int, input().split())
a_s = list(map(int, input().split()))
print(f(k, a_s))


### FIXED CODE ###

def f(n, k, a_s):
    md = 10 ** 9 + 7
    dp = [0] * (k + 1)
    dp[0] = 1
    for a in a_s[:-1]:
        ndp = [0] * (k + 1)
        ndp[0] = s = dp[0] % md
        for j in range(1, a + 1):
            ndp[j] = s = (s + dp[j]) % md
        for j in range(a + 1, k + 1):
            ndp[j] = s = (s + dp[j] - dp[j - a - 1]) % md
        dp = ndp
    return sum(dp[k - a_s[-1]:]) % md


n, k = map(int, input().split())
a_s = list(map(int, input().split()))
print(f(n, k, a_s))
### BUGGY CODE ###

S = input()

count = 0

while len(S) >= 2 and S != '1' * len(S) and S != '0' * len(S):
    #前から２つ組にして抜いて判定する
    new_S = ''
    for i in range(len(S)//2):
        if S[2*i:(2*i)+2] == '10' or S[2*i:(2*i)+2] == '01':
            count += 1
        else:
            new_S += S[2*i:(2*i)+2]
    #len(S)が奇数の時は最後が抜ける
    if len(S) % 2 == 1:
        new_S += S[-1]
    else:
        pass
    S = new_S

    if len(S) < 2 or S == '1' * len(S) or S == '0' * len(S):
        print(count * 2)
        break
    else:
        #頭一つずらして２つ組にして判定する
        new_S = S[0]
        for i in range((len(S)-1)//2):
            if S[2*i+1:(2*i)+3] == '10' or S[2*i+1:(2*i)+3] == '01':
                count += 1
            else:
                new_S += S[2*i+1:(2*i)+3]
        #len(S)が偶数の時は最後が抜けるから足してやる
        if len(S) % 2 == 0:
            new_S += S[-1]
        else:
            pass
        S = new_S
else:
    print(count * 2)



### FIXED CODE ###

S = input()

zero_count = S.count('0')
one_count =S.count('1')

count = min(zero_count, one_count)

print(count * 2)