Harryxun/stf_run huggingface dataset:
# ABC 169
import math

a, b = map(np.float64, input().split())
c = math.floor(a*b)
print(c)

### FIXED CODE ###

# ABC 169
import math

a, b = input().split()
a = int(a)
b = int(round(float(b)*100))
print(a*b//100)
nk=list(map(int,input().split()))
s=input()
L=[]
R=[]
lr="a"
for i in range(nk[0]):
    if lr=="L":
        if s[i]=="R":
            lr="R"
            R.append(1)
        else:
            L[-1]+=1
    elif lr=="R":
        if s[i]=="L":
            lr="L"
            L.append(1)
        else:
            R[-1]+=1
    else:
        lr=s[0]
        if lr=="L":
            L.append(1)
        else:
            R.append(1)
L.sort(reverse=True)
R.sort(reverse=True)
lsum=sum(L[:nk[1]])
rsum=sum(R[:nk[1]])
if len(L)<nk[1] or len(R)<nk[1]:
    print(n)
else:
    if lsum+sum(R)>rsum+sum(L):
        rmerge=sum(R[:nk[1]+1])+lsum
        R=R[nk[1]:]
        if R!=[]:
            R[0]=rmerge
        else:
            R=[rmerge]
        ans=sum(R)-len(R)
    else:
        lmerge=sum(L[:nk[1]+1])+rsum
        L=L[nk[1]:]
        if L!=[]:
            L[0]=lmerge
        else:
            L=[lmerge]
        ans=sum(L)-len(L)
    print(ans)


### FIXED CODE ###

nk=list(map(int,input().split()))
s=input()
L=[]
R=[]
lr="a"
for i in range(nk[0]):
    if lr=="L":
        if s[i]=="R":
            lr="R"
            R.append(1)
        else:
            L[-1]+=1
    elif lr=="R":
        if s[i]=="L":
            lr="L"
            L.append(1)
        else:
            R[-1]+=1
    else:
        lr=s[0]
        if lr=="L":
            L.append(1)
        else:
            R.append(1)
L.sort(reverse=True)
R.sort(reverse=True)
lsum=sum(L[:nk[1]])
rsum=sum(R[:nk[1]])
if len(L)<=nk[1] or len(R)<=nk[1]:
    print(nk[0]-1)
else:
    if lsum+sum(R)>rsum+sum(L):
        rmerge=sum(R[:nk[1]+1])+lsum
        R=R[nk[1]:]
        if R!=[]:
            R[0]=rmerge
        else:
            R=[rmerge]
        L=L[nk[1]:]
        ans=sum(R)-len(R)+sum(L)-len(L)
    else:
        lmerge=sum(L[:nk[1]+1])+rsum
        L=L[nk[1]:]
        if L!=[]:
            L[0]=lmerge
        else:
            L=[lmerge]
        R=R[nk[1]:]
        ans=sum(L)-len(L)+sum(R)-len(R)
    print(ans)
n = input()
sum = sum(list(map(int, n)))
if n % sum == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
t = n
sum = 0
while t // 10 != 0:
  sum += t%10
  t //= 10
sum += t%10
if n % sum == 0:
  print("Yes")
else:
  print("No")
a, b, c = map(int, input().split())
count = 0
if a == 1:
  count += 1
if b == 1:
  count += 1
if c == 1:
  count += 1
print(count)

### FIXED CODE ###

a = input()
a = list(str(a))
count = 0
if a[0] == "1":
  count += 1
if a[1] == "1":
  count += 1
if a[2] == "1":
  count += 1
print(count)
N,A = map(int,input().split())
x = list(map(int,input().split()))
X = sum(x)

dp = [[[0 for k in range(X+1)] for j in range(N+1)] for i in range(N)]

for i in range(N):
    for j in range(i+1):
        dp[i][1][x[j]] += 1

for i in range(N-1):
    for j in range(1,i+2):
        for k in range(X+1):
            if 1 <= k-x[i+1] <= X:
                dp[i+1][j+1][k] = dp[i][j+1][k] + dp[i][j][k-x[i+1]]
            else:
                dp[i+1][j+1][k] = dp[i][j+1][k]

ans = 0
for j in range(1,N+1):
    ans += dp[N-1][j][A*j]

print(ans)

### FIXED CODE ###

N,A = map(int,input().split())
x = list(map(int,input().split()))
X = sum(x)

dp = [[[0 for k in range(X+1)] for j in range(N+1)] for i in range(N)]

for i in range(N):
    for j in range(i+1):
        dp[i][1][x[j]] += 1

for i in range(N-1):
    for j in range(1,i+2):
        for k in range(X+1):
            if 1 <= k-x[i+1] <= X:
                dp[i+1][j+1][k] = dp[i][j+1][k] + dp[i][j][k-x[i+1]]
            else:
                dp[i+1][j+1][k] = dp[i][j+1][k]

ans = 0
for j in range(1,N+1):
    if 1 <= A*j <= X:
        ans += dp[N-1][j][A*j]

print(ans)
n,k=map(int,input().split(" "))
l=list(map(int,input().split(" "))
l.sort()
s=0
for i in range(k):
    s+=l[i]
print(s)

### FIXED CODE ###



# ---------------------------------------MAIN()-----------------------------------------------!
n, k = map(int, input().split(" "))
l = list(map(int, input().split(" ")))
l.sort()
s=0
for i in range(k):
  s+=l[i]
print(s)


# -----------------------------------------------------------------------------------------!
n = input()
if n % 2:
  print(0.500000)
else:
  print((n//2+1) / n)

### FIXED CODE ###

n = int(input())
if n % 2 == 0:
  print(0.500000)
else:
  print((n//2+1) / n)
number = int(input())
lower = list(map(int, input().split()))

time = 0
max = 0

def down(i):
    global max
    global time

    if max > range(i, number):
        return

    for j in range(i, number-1):
        if lower[j] >= lower[j+1]:
            time += 1
        else:
            return


for i in range(len(lower)):
    down(i)
    if max < time:
        max = time
    time = 0

print(max)


### FIXED CODE ###

number = int(input())
lower = list(map(int, input().split()))

time = 0
max = 0

def down(i):
    global time
    for j in range(i, number-1):
        if lower[j] >= lower[j+1]:
            time += 1
        else:
            return j+1

    return 0

now = 0
for i in range(len(lower)):

    if now > i:
        continue

    if max > (number-i+1):
        break

    now = down(i)

    if max < time:
        max = time
    time = 0



print(max)
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
n = len(s)
m = len(t)

i = 0
while i < n-m+1:
    if (s[i] == t[0]) or (s[i] == '?'):
        j = i
        flg = True
        while j-i < m:
            if (s[j] == t[j-i]) or (s[j] == '?'):
                j += 1
            else:
                flg = False
                break
        if flg:
            j -= 1
            break
    i += 1
if not flg:
    print('UNRESTORABLE')
    quit()
ans = ''
cnt = 0
for k in range(n):
    if k < i:
        if s[k] == '?':
            ans += 'a'
        else:
            ans += s[k]
    elif i <= k <= j:
        ans += t[cnt]
        cnt += 1
    else:
        if s[k] == '?':
            ans += 'a'
        else:
            ans += s[k]
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
#ABC76 C

from copy import deepcopy
s = list(input())
t = list(input())

ns = len(s)
nt = len(t)
f1 = 0
for i in range(ns):
    if s[i] in t:
        ind = t.index(s[i])
        for j in range(i-ind,i-ind+nt):
            if j < ns:
                if s[j] == t[j-i+ind] or s[j] == '?':
                    continue
                else:
                    break
            else:
                break
        else:
            f1 = 1
            x = deepcopy(s)
            x[i-ind:i-ind+nt] = t
            break
f2 = 0
for i in range(ns)[::-1]:
    if s[i] == '?':
        for j in range(i,i+nt):
            if j < ns:
                if s[j] == t[j-i] or s[j] == '?':
                    continue
                else:
                    break
            else:
                break
        else:
            f2 = 1
            y = deepcopy(s)
            y[i:i+nt] = t
            break
if f1 & f2:
    for i in range(ns):
        if x[i] == '?':
            x[i] = 'a'
        if y[i] == '?':
            y[i] = 'a'
    x = ''.join(x)
    y = ''.join(y)
    ans = [x,y]
    ans.sort()
    print(ans[0])

elif f1 and not f2:
    for i in range(ns):
        if x[i] == '?':
            x[i] = 'a'
    x = ''.join(x)
    print(x)
elif not f1 and f2:
    for i in range(ns):
        if y[i] == '?':
            y[i] = 'a'
    y = ''.join(y)
    print(y)
else:
    print('UNRESTORABLE')
# -*- coding: utf-8 -*-
# D_ans.pyからコメントなど不要部分削除したもの

class UnionFindbySize:
    def __init__(self, n):
        self.parent = [-1 for i in range(n)]

    def root(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]

    def issame(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        else:
            self.parent[y] += self.parent[x]    # yの要素数を増やす
            self.parent[x] = y
            return True

    def size(self, x):
        return -self.parent[self.root(x)]

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

uf = UnionFindbySize(N)
res = [0] * (M)
res[-1] = N*(N-1)//2

i = 1
for a, b in zip(A[::-1], B[::-1]):
    id = M - 1 - i
    if id < 0:
        break
    if uf.issame(a, b):
        res[id] = res[id+1]
    else:
        sa = uf.size(a)
        sb = uf.size(b)
        res[id] = res[id+1] - sa*sb
        uf.unite(a, b)
    i+=1

for r in res:
    print(r)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# D_ans.pyからコメントなど不要部分削除したもの
import sys
sys.setrecursionlimit(10**6) 

class UnionFindbySize:
    def __init__(self, n):
        self.parent = [-1 for i in range(n)]

    def root(self, x):
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]

    def issame(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        else:
            self.parent[y] += self.parent[x]    # yの要素数を増やす
            self.parent[x] = y
            return True

    def size(self, x):
        return -self.parent[self.root(x)]

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

uf = UnionFindbySize(N)
res = [0] * (M)
res[-1] = N*(N-1)//2

i = 1
for a, b in zip(A[::-1], B[::-1]):
    id = M - 1 - i
    if id < 0:
        break
    if uf.issame(a, b):
        res[id] = res[id+1]
    else:
        sa = uf.size(a)
        sb = uf.size(b)
        res[id] = res[id+1] - sa*sb
        uf.unite(a, b)
    i+=1

for r in res:
    print(r)
N = int(input()) 
hotel = list(map(int, input().split())) #入力してint型リストに格納
view = 1

for i in range (1, N-1, 1):
    judge = 1
    for j in range (0, i, 1):
        if hotel[i] >= hotel[j]:
            pass　#何もしない
        else:
            judge = 0
    if judge == 1:
        view += 1

print (view)

### FIXED CODE ###

N = int(input()) 
hotel = list(map(int, input().split())) #入力してint型リストに格納
view = 1

for i in range (1, N, 1):
    judge = 1
    for j in range (0, i, 1):
        if hotel[i] >= hotel[j]:
            pass#何もしない
        else:
            judge = 0
            break
    if judge == 1:
        view += 1

print (view)
n,*a = map(int,open(0).read().split())
a = [a[i] -i -1 for i in range(n)]
a.sort()
b = a[n//2]
if n % 2 == 0:
  c = b + 1
else:
  c = a[n//2+1]+1
ans = min([sum([abs(i - j) for i in a]) for j in range(b,c)])
print(ans)

### FIXED CODE ###

n,*a = map(int,open(0).read().split())
a = sorted([a[i] -i for i in range(n)])
print(sum([abs(i - a[n//2]) for i in a]))
s = input()

if input[0]=="9" or  input[1]=="9":
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input()

if s[0]=="9" or  s[1]=="9":
  print("Yes")
else:
  print("No")
N,Q=map(int,input().split())
S=input()
l,r=list(map(int,input().split())) for i in range(Q)
def main():
  for i in range(Q):
    T=S[l[i]:r[i]+1]
    c=T.count('AC')
    print(c)
main()


### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
  l,r=map(int,input().split())
  print(t[r-1]-t[l-1])
nk = list(map(int,input().split()))
n,k= nk[0],nk[1]
h = list(map(int,input().split()))
dp = [0] * (n)
for i in range(k):#初期条件の定義
    dp[i] = abs(h[i] - h[0])
for l in range(n-k):#漸化式の定義
    lis = []
    for m in range(k):
        lis.append(dp[l+m] + abs(h[l+k]-h[l+m]))
    dp[l+k] = min(lis)
print(dp[n-1])


### FIXED CODE ###

nk = list(map(int,input().split()))
n,k= nk[0],nk[1]
h = list(map(int,input().split()))
dp = [0] * (n)
if n >= k:
    for i in range(k):#初期条件の定義
        dp[i] = abs(h[i] - h[0])
    for l in range(n-k):#漸化式の定義
        lis = []
        for m in range(k):
            lis.append(dp[l+m] + abs(h[l+k]-h[l+m]))
        dp[l+k] = min(lis)
    print(dp[n-1])
else:#n < k
    print(abs(h[n-1]-h[0]))
import heapq

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.append([100000,0])
ab = sorted(ab, key=lambda x:x[0])



max_values = [0 for _ in range(m)]
hq = []

possible_days = 0

for now in range(n+1):
    # if necessary day exceed the (now_day), extract the most valuable work
    if possible_days-2 >= len(max_values):
        break
    while possible_days <= ab[now][0]:
        if len(hq) < 1:
            pass
        else:
            max_values[possible_days-2] = -heapq.heappop(hq)
        possible_days += 1
    heapq.heappush(hq, -ab[now][1])
print(sum(max_values))

### FIXED CODE ###

import heapq

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.append([m+1,0])
ab = sorted(ab, key=lambda x:x[0])



max_values = [0 for _ in range(m)]
hq = []

possible_days = 0

for now in range(n+1):
    # if necessary day exceed the (now_day), extract the most valuable work
    while possible_days <= ab[now][0]:
        if len(hq) < 1:
            pass
        else:
            max_values[possible_days-2] = -heapq.heappop(hq)
        possible_days += 1
    if possible_days-2 > m-1:
        break
    heapq.heappush(hq, -ab[now][1])
print(sum(max_values))
t=float(input())
x=float(input())
print(t/x)


### FIXED CODE ###

a,b=map(int,input().split())
print(a/b)
a.b=map(int,input().split())
if a==1:
    if b==1:
        print('Draw')
    else:
        print('Alice')
else:
    if b==1:
        print('Bob')
    else:
        if a>b:
            print('Alice')
        elif a==b:
            print('Draw')
        else:
            print('Bob')

### FIXED CODE ###

a,b=map(int,input().split())
if a==1:
    if b==1:
        print('Draw')
    else:
        print('Alice')
else:
    if b==1:
        print('Bob')
    else:
        if a>b:
            print('Alice')
        elif a==b:
            print('Draw')
        else:
            print('Bob')
input()
nums = list(map(int, input().split()))
lis = [num - (i + 1) for i, num in enumerate(nums)]
cnt = 0
i = 0
while i < len(lis):
    if lis[i] == 0:
        cnt += 1
        if lis[i + 1] == 0:
            i += 1
    i += 1
print(cnt)

### FIXED CODE ###

input()
nums = list(map(int, input().split()))
lis = [num - (i + 1) for i, num in enumerate(nums)]
cnt = 0
i = 0
while i < len(lis):
    if lis[i] == 0:
        cnt += 1
        if i == (len(lis) - 1):
            break
        if lis[i + 1] == 0:
            i += 1
    i += 1
print(cnt)
n=int(input())
p=list( map(int, input().split()))
ans=0
for i in range(0,n):
    if (p[i-1]<p[i]<p[i+1]) or (p[i-1]>p[i]>p[i+1]):
        ans=ans+1
print(ans)

### FIXED CODE ###

n=int(input())
p=list( map(int, input().split()))
ans=0
for i in range(1,n-1):
    if (p[i-1]<p[i]<p[i+1]) or (p[i-1]>p[i]>p[i+1]):
        ans=ans+1
print(ans)
import numpy as np

mod=998244353


n,m=map(int,input().split())
A=[list(map(float,input().split())) for i in range(n)]

A.sort(reverse=1)
A=np.array(A)

# if A[0][0]!=0

#print(A)
for i in range(min(n,m)):
    #print(A)
    A=list(A)
    A[i:].sort(reverse=1,key=lambda x:x[i])
    A=np.array(A)
    if A[i][i]!=0 :
        w=A[i][i]
        for k in range(m):
            
            A[i][k]/=w
        for j in range(i+1,n):
            A[j]-=A[i]*A[j][i]

#print(A)

r=0
j=0
for i in range(m):
    if A[j][i]!=0 :
        r+=1
        j+=1

#print(r) #rank

a=1
b=1

for i in range(n+m-1):
    a=(a*2)%mod
for i in range(n+m-1-r):
    b=(b*2)%mod
print((a-b)%mod)


### FIXED CODE ###

import numpy as np
import random

mod=998244353


n,m=map(int,input().split())
A=[list(map(int,input().split())) for i in range(n)]

#n,m=300,300
#A=[[int(random.randint(0,1)) for j in range(m)] for i in range(n)]


#A=np.array(A)

#print("A")
i=0
j=0
r=0 #rank
while i<n and j<m :
    #print(i)
    t=0
    if A[i][j]==0 :
        k=i
        while k<n and A[k][j]==0 :
            k+=1
        if k<n :
            A[i],A[k]=A[k],A[i]

            #print(A)
        else :
            t=1
            j+=1
    if t==0 :
        r+=1
        for p in range(i+1,n):
            if A[p][j]>0 :
                for kk in range(j,m):
                    A[p][kk]=(A[p][kk]-A[i][kk])%2
        i+=1
        j+=1



#r=0
#j=0
#for i in range(m):
#    if j<n :
#        if A[j][i]!=0 :
#            r+=1
#            j+=1

for i in range(n):
    for j in range(m):
        A[i][j]=int(A[i][j])
#print(A)
#print(r) #rank

a=1
b=1

for i in range(n+m-1):
    a=(a*2)%mod
for i in range(n+m-1-r):
    b=(b*2)%mod

print((a-b)%mod)
N,M=map(int,input().split())
ac=[0]*N
wa=[0]*N

for i in range(M):
  p,s=input().split()
  if s=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[w[k] for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" % (sum(ac),sum(penalty)))


### FIXED CODE ###

N,M=map(int,input().split())
ac=[0]*N
wa=[0]*N

for i in range(M):
  p,s=input().split()
  if s=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[wa[k] for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" % (sum(ac),sum(penalty)))
def better(l, i, ready, ans):
    #print(l, i, ready, ans)
    if i==0:
        ready[0]=True
        ans[0]=0
        return l[0], 0
    if i==1:
        ready[1]=True
        ans[1]=abs(l[0]-l[1])
        return l[1], abs(l[0]-l[1])
    else:
        if ready[i]:
            return l[i], ans[i]
        else:
            last, val = better(l, i-1, ready, ans)
            last1, val1 = better(l, i-2, ready, ans)
            #print(last, val, last1, val1)
            xx = min([(abs(last-l[i])+val), (abs(last1-l[i])+val1)])
            ready[i]=True
            ans[i]=xx
            return l[i], xx
n = int(input())
l = list(map(int, input().split()))
print(better(l, n-1, [False]*n, [0]*n)[1])

### FIXED CODE ###

import math
def better(l, ans):
    for i in range(2, n):
        ans[i] = min(ans[i - 1] + abs(l[i]-l[i - 1]), ans[i - 2] + abs(l[i]-l[i - 2]))
    return ans
n = int(input())
l = list(map(int, input().split()))
ans = [0] * n
ans[1] = abs(l[1]-l[0])
print(better(l, ans)[len(ans)-1])
n=int(input())
d=[int,input().split()]
d.sort()
print(d[n//2]-d[n//2+1])

### FIXED CODE ###

n=int(input())
d=[int(i) for i in input().split()]
d.sort()
print(d[n//2]-d[n//2-1])
def function(p, i):
  a = p[i]
  amin = min(p[:i+1])
  if amin == a:
    return 1
  else:
    return 0
 
n = int(input())
p = list(map(lambda x: int(x), input().split()))
sums = sum([function(p,i) for i in range(n)])
print(sums)

### FIXED CODE ###

n, m = map(lambda x: int(x), input().split())

if n == m:
  print('Yes')
else:
  print('No')
N,K = map(int, input().split())
res = 0
if K==0:
    print(N*N)
    return
for i in range(N):
    i += 1
    if i-K<=0:
        continue
    amari = N % i
    amari = amari - K + 1
    re = N//i
    if amari<=0:
        amari = 0
    res += re*(i-K) + amari
 print(res)

### FIXED CODE ###

import sys

N,K = map(int, input().split())
res = 0
if K==0:
    print(N*N)
    sys.exit(0)
for i in range(N):
    i += 1
    if i-K<=0:
        continue
    amari = N % i
    amari = amari - K + 1
    re = N // i
    if amari <= 0:
        amari = 0
    res += re*(i-K) + amari
print(res)
s = input()
n = int(input())

for i in range(n):
    command = input().split()
    if command == 'replace':
        a,b = map(int(),command[1:3])
        s = s[:a]+ command[3] + s[b+1:]
    elif command == 'reverse':
        a,b = map(int(),command[1:3])
        s[a:b] = s[b:a]
    else:  
        a,b = map(int(),command[1:3])
        print(s[a:b])


### FIXED CODE ###

s = input()
n = int(input())

for i in range(n):
    command = input().split()
    if command[0] == 'replace':
        a,b = map(int,command[1:3])
        s = s[:a]+ command[3] + s[b+1:]
    elif command[0] == 'reverse':
        a,b = map(int,command[1:3])
        s = s[0:a] + s[a:b+1][::-1] + s[b+1:]
    elif command[0] == 'print':  
        a,b = map(int,command[1:3])
        print(s[a:b+1])
#!/usr/bin/env python3

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

print((N//(A+B))*A + min(A, (N%(A+B))))

### FIXED CODE ###

#!/usr/bin/env python3

S = input()
print("Yes" if "A" in S and "B" in S else "No")
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

if N == 0:
	print(0)
	exit()

lim = 30
top = [0]*(lim+1)
bottom = [0]*(lim+1)

for i in range(1, lim+1):
	if i%2:
		t = (i+1)//2
		top[i] = (4**t-1)//3
		bottom[i] = bottom[i-1]
	else:
		b = i//2
		bottom[i] = (4**b-1)*2//3
		top[i] = top[i-1]

digit = [0]*(lim+1)
for i in range(1, lim+1):
	digit[i] = (-2)**(i-1)

if 0 <= N:
	idx = bisect_left(top, N)
else:
	idx = bisect_left(bottom, -N)

ans = ""
for i in range(idx, 0, -1):
	if -bottom[i-1] <= N <= top[i-1]:
		ans += "0"
	else:
		ans += "1"
		N -= digit[i]

print(ans)

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

if N == 0:
	print(0)
	exit()

lim = 32
top = [0]*(lim+1)
bottom = [0]*(lim+1)

for i in range(1, lim+1):
	if i%2:
		t = (i+1)//2
		top[i] = (4**t-1)//3
		bottom[i] = bottom[i-1]
	else:
		b = i//2
		bottom[i] = (4**b-1)*2//3
		top[i] = top[i-1]

digit = [0]*(lim+1)
for i in range(1, lim+1):
	digit[i] = (-2)**(i-1)

if 0 <= N:
	idx = bisect_left(top, N)
else:
	idx = bisect_left(bottom, -N)

ans = ""
for i in range(idx, 0, -1):
	if -bottom[i-1] <= N <= top[i-1]:
		ans += "0"
	else:
		ans += "1"
		N -= digit[i]

print(ans)
import sys

def parse(inp):
    S=list(map(int,list(next(inp))))
    return S

def main(inp):
    S = inp
    ones = sum(S)
    zeros = len(S) - ones
    return 2*min(ones,zeros)
  
print(main(parse(sys.stdin)))

### FIXED CODE ###

import sys

def parse(inp):
    S=list(next(inp))
    return S
  
def main(inp):
    S = inp
    zeros=0
    ones=0
    for i in range(len(S)):
        if(S[i]=='0'): zeros+=1
        elif(S[i]=='1'): ones+=1
            
    return 2*min(ones,zeros)
  
print(main(parse(sys.stdin)))