Harryxun/stf_run huggingface dataset:
h,w=map(int,input().split())
s=[list(input()) for i in range(w)]
inf = h*w
d=[[inf]*h for i in range(w)]
if s[0][0]=="#":
    d[0][0]=1
else:
    d[0][0]=0
if w>1:
    for j in range(1,w):
        if s[0][j]=="#" and s[0][j-1]==".":
            d[0][j]=d[0][j-1]+1
        else:
            d[0][j]=d[0][j-1]
if h>1:
    for i in range(1,h):
        if s[i][0]=="#" and s[i-1][0]==".":
            d[i][0]=d[i-1][j]+1
        else:
            d[i][0]=d[i-1][0]
if h>1 and w>1:
    for i in range(1,h):
        for j in range(1,w):
            if s[i][j]=="#" and s[i][j-1]==".":
                p=d[i][j-1]+1
            else:
                p=d[i][j-1]
            if s[i][j]=="#" and s[i-1][j]==".":
                q=d[i-1][j]+1
            else:
                q=d[i-1][j]
            d[i][j]=min(p,q)
# for i in d:
#     print(i)
print(d[-1][-1])

### FIXED CODE ###

h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
inf = h*w
d=[[inf]*w for i in range(h)]
if s[0][0]=="#":
    d[0][0]=1
else:
    d[0][0]=0
for j in range(1,w):
    if s[0][j]=="#" and s[0][j-1]==".":
        d[0][j]=d[0][j-1]+1
    else:
        d[0][j]=d[0][j-1]

for i in range(1,h):
    if s[i][0]=="#" and s[i-1][0]==".":
        d[i][0]=d[i-1][0]+1
    else:
        d[i][0]=d[i-1][0]

for i in range(1,h):
    for j in range(1,w):
        if s[i][j]=="#" and s[i][j-1]==".":
            p=d[i][j-1]+1
        else:
            p=d[i][j-1]
        if s[i][j]=="#" and s[i-1][j]==".":
            q=d[i-1][j]+1
        else:
            q=d[i-1][j]
        d[i][j]=min(p,q)
# for i in d:
#     print(i)
print(d[-1][-1])
from collections import Counter
N = int(input())
L = sorted([list(map(int,input().split())) for k in range(N)])
D = []

for k in range(N-1):
    for l in range(k+1,N):
        D.append((L[k][0]-L[l][0],L[k][1]-L[l][1]))

E = Counter(D).most_common()[0]
x, y = E[0][0], E[0][1]
used = []
ans = N
for k in range(N-1):
    for l in range(k+1,N):
        if L[k][0]-L[l][0] == x and L[k][1]-L[l][1] == y:
            if L[k] not in used and L[l] not in used:
                used.append(L[k])
                used.append(L[l])
                ans -= 1
            elif L[k] in used and L[l] not in used:
                used.append(L[l])
                ans -= 1
            elif L[k] not in used and L[l] in used:
                used.append(L[k])
                ans -= 1
            else:
                pass
print(ans)


### FIXED CODE ###

from collections import Counter
N = int(input())
L = sorted([list(map(int,input().split())) for k in range(N)])
D = []
if N == 1:
    print(1)
    exit(0)
for k in range(N-1):
    for l in range(k+1,N):
        D.append((L[k][0]-L[l][0],L[k][1]-L[l][1]))

E = Counter(D).most_common()[0]
x, y = E[0][0], E[0][1]
used = []
ans = N
for k in range(N-1):
    for l in range(k+1,N):
        if L[k][0]-L[l][0] == x and L[k][1]-L[l][1] == y:
            if L[k] not in used and L[l] not in used:
                used.append(L[k])
                used.append(L[l])
                ans -= 1
            elif L[k] in used and L[l] not in used:
                used.append(L[l])
                ans -= 1
            elif L[k] not in used and L[l] in used:
                used.append(L[k])
                ans -= 1
            else:
                pass
print(ans)
import sys
sys.setrecursionlimit(999999999999)
input = sys.stdin.readlines()
n,q = map(int,input().split())
s = input()
l = []
r = []
cnt = []
for i in range(q):
    _l,_r = [int(i) for i in input().split()]
    l.append(_l)
    r.append(_r)
for i in range(q):
    cnt.append(s[l[i]-1:r[i]].count('AC'))
for i in range(len(cnt)):
    print(cnt[i])


### FIXED CODE ###

import sys
input = sys.stdin.readline
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])
N = int(input())
l = list(map(int, input().split(' ')))

counter = {}

for i in l:
    if i in counter:
        counter[i] = counter[i] + 1
    else:
        counter[i] = 1

a = None
b = None
for k in sorted(counter.keys(), reverse=True):
    if counter[k] >= 4 and a == None and b == None:
        a , b = k
    elif counter[k] >= 2 and a == None:
        a = k
    elif counter[k] >= 2 and a != None:
        b = k
    if (a != None and b != None):
        break

if (a != None and b!= None):
    print(a * b)
else:
    print('0')



### FIXED CODE ###

N = int(input())
l = list(map(int, input().split(' ')))

counter = {}

for i in l:
    if i in counter:
        counter[i] = counter[i] + 1
    else:
        counter[i] = 1

a = None
b = None
for k in sorted(counter.keys(), reverse=True):
    if counter[k] >= 4 and a == None and b == None:
        a = k
        b = k
    elif counter[k] >= 2 and a == None:
        a = k
    elif counter[k] >= 2 and a != None:
        b = k
    if (a != None and b != None):
        break

if (a != None and b!= None):
    print(a * b)
else:
    print('0')
n = int(input())
x = input()
memo = {0:0}
for i in range(1, n+1):
    j = i
    a = 0
    while True:
        if j in memo:
            memo[i] = memo[j]+a
            break;
        else:
            b = 0
            k = j
            while k > 0:
                if k%2 == 1:
                    b += 1
                k //= 2
            j %= b
            a += 1
n1 = 0
for i in range(n):
    if x[i] == "1":
        n1 += 1
mup = [1]
mdown = [1]
for i in range(1, n):
    mup.append(mup[-1]*2%(n1+1))
    mdown.append(mdown[-1]*2%(n1-1))
mup.reverse()
mdown.reverse()
mmup = 0
mmdown = 0
for i in range(n):
    mmup = (mmup+mup[i]*int(x[i]))%(n1+1)
    mmdown = (mmdown+mdown[i]*int(x[i]))%(n1-1)
for i in range(n):
    if x[i] == "0":
        state = "up"
        n1i = n1+1
    else:
        state = "down"
        n1i = n1-1
    if state == "up":
        mm = (mmup+mup[i])%n1i
    else:
        mm = (mmdown-mdown[i])%n1i
    print(memo[mm]+1)

### FIXED CODE ###

n = int(input())
x = input()
memo = {0:0}
for i in range(1, n+1):
    j = i
    a = 0
    while True:
        if j in memo:
            memo[i] = memo[j]+a
            break;
        else:
            b = 0
            k = j
            while k > 0:
                if k%2 == 1:
                    b += 1
                k //= 2
            j %= b
            a += 1
n1 = 0
for i in range(n):
    if x[i] == "1":
        n1 += 1
if n1 > 1:
    mup = [1]
    mdown = [1]
    for i in range(1, n):
        mup.append(mup[-1]*2%(n1+1))
        mdown.append(mdown[-1]*2%(n1-1))
    mup.reverse()
    mdown.reverse()
    mmup = 0
    mmdown = 0
    for i in range(n):
        mmup = (mmup+mup[i]*int(x[i]))%(n1+1)
        mmdown = (mmdown+mdown[i]*int(x[i]))%(n1-1)
    for i in range(n):
        if x[i] == "0":
            state = "up"
            n1i = n1+1
        else:
            state = "down"
            n1i = n1-1
        if state == "up":
            mm = (mmup+mup[i])%n1i
        else:
            mm = (mmdown-mdown[i])%n1i
        print(memo[mm]+1)
elif n1 == 1:
    for i in range(n):
        if x[i] == "1":
            print(0)
        else:
            if x[-1] == "0" and i != n-1:
                print(1)
            else:
                print(2)
else:
    for i in range(n):
        print(1)
a=int(input())
b=int(input())
c=int(input())
if a==1:
	print("Hello World")	
else:
    print(b+c)	


### FIXED CODE ###

"""
a=[]
for i in range():
	a.append(int(input()))

if a[0]!=1:
	print(a[1]+a[2])
else:
	print("Hello World")
"""
a=int(input())
if a==1:
	print("Hello World")
else:
	b=int(input())
	c=int(input())
	print(b+c)
a,b =input().split()
if a.isalpha() > b.isalpha():
  print(">")
elif a.isalpha() < b.isalpha():
  print("<")
  else:
  print("=")

### FIXED CODE ###

a,b =input().split()
if a>b:
  print(">")
elif b>a:
  print("<")
else:
  print("=")
h,w,k=list(map(int,input().split()))

s=[list(map(int,[x for x in input()])) for _ in range(h)]

cnt=10001

for i in range(2**(h-1)):
    split=[(i>>j)&1 for j in range(h)]

    curcnt=sum(split)
    nsplit=curcnt+1
    
    
    cw=0
    while cw<w:
        l=0
        for ch in range(h):
            sumlst[l]+=s[ch][cw]

            if sumlst[l]>k:
                sumlst=[0]*(nsplit)
                curcnt+=1
                break

            if split[ch]:
                l+=1
        else:
            cw+=1
    
    cnt=min(cnt,curcnt)

print(cnt)

### FIXED CODE ###

h,w,k=list(map(int,input().split()))
s=[list(map(int,[x for x in input()])) for _ in range(h)]

cnt=10001

for i in range(2**(h-1)):
    split=[0]*h
    curcnt=0
    for j in range(h):
        if (i>>j)&1:
            split[j]=1
            curcnt+=1
        
    nsplit=curcnt+1
    sumlst=[[0]*(nsplit) for _ in range(w)]

    cw=0
    memo=0
    chk=0
    flag=False
    while cw<w:
        l=0
        for ch in range(h):
            sumlst[memo][l]+=s[ch][cw]

            if sumlst[memo][l]>k:
                memo+=1
                chk+=1
                break

            if split[ch]:
                l+=1
        else:
            chk=0
            cw+=1
            continue

        if chk>1:
            break
    else:
        cnt=min(cnt,curcnt+memo)

print(cnt)
s=input()
t=input()
if s==t-s[len(s)]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s=input()
t=input()
if s==t[:len(t)-1]:
  print('Yes')
else:
  print('No')
a, b, k = map(int, input().split())

if a != 0 and a >= k:
    a -= k
elif a != 0 and a < k:
    k -= a
    a = 0
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0
elif a=0:
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0

print(a, b)


### FIXED CODE ###

a, b, k = map(int, input().split())

if a != 0 and a >= k:
    a -= k
elif a != 0 and a < k:
    k -= a
    a = 0
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0
elif a == 0:
    if b != 0 and b >= k:
        b -= k
    elif b != 0 and b < k:
        b = 0

print(a, b)
n = int(input())
seq = list(map(int, input().split()))
q = int(input())
mlist = list(map(int, input().split()))
mins = min(seq)
sums = 0
for a in seq:
    sums += a

def check(i, m):
    global mins
    if m == 0:
        return True
    elif i >= n or mins > m:
        return False
    res = check(i+1, m) + check(i+1, m - seq[i])
    return res

for m in mlist:
    if (mins > m or sums < m):
        print('no')
    elif(check(0,m)):
        print('yes')
    else:
        print('no')


### FIXED CODE ###

n = int(input())
seq = list(map(int, input().split()))
q = int(input())
mlist = list(map(int, input().split()))
mins = min(seq)
sums = 0
for a in seq:
    sums += a

def check(i, m):
    global mins
    if m == 0:
        return True
    elif i >= n or mins > m:
        return False
    res = check(i+1, m) or check(i+1, m - seq[i])
    return res

for m in mlist:
    if (mins > m or sums < m):
        print('no')
    elif(check(0,m)):
        print('yes')
    else:
        print('no')
A, B = map(int, input().split())

if A + B < 10: print(C)
else: print('error')

### FIXED CODE ###

A, B = map(int, input().split())
 
if A + B < 10: print(A+B)
else: print('error')
s = input()
l = len(s)
dif = 0
val=0
for i in range (l):
	if s[i] == 'A' and val==0:
			a = i	
			val=1
	if s[i] == 'Z':
		z = i
		dif = z-a
print(dif+1)

### FIXED CODE ###

s = input()
le = len(s)
list_a = []
list_z = []
dif = 0
for i in range(le):
	if s[i] == 'A':
		list_a.append(i)
	elif s[i] == 'Z':
		list_z.append(i)
print(int(list_z[-1])-int(list_a[0])+1)
S = input()
Q = int(input())

f, l = S[0],S[-1]

mod = 0
for _ in range(Q):
    Query = input()
    if Query[0] == "1":
        f, l = l, f #swap
        mod = (1 + mod) % 2
    else:
        if Query[2] == "1":
            f = Query[4]
            if mod == 0:
                S = f + S
            else:
                s = s + f
        else:
            l = Query[4]
            if mod == 0:
                S = S + l
            else:
                S = l + S
    #print("Qans",S)

print(S)

### FIXED CODE ###

from collections import deque

S = input()
Q = int(input())
d = deque(S)
#print(d)

mod = 0 #反転が何回目か（先頭がどっちか）,偶数回の時0，奇数回の時1

for _ in range(Q):
    Query = input()
    if Query[0] == "1":
        mod = (1 + mod) % 2
    else:
        if Query[2] == "1":
            if mod == 0:
                d.appendleft(Query[4])
            else:
                d.append(Query[4])
        else:
            if mod == 0:
                d.append(Query[4])
            else:
                d.appendleft(Query[4])

S = ""
if mod==0:
    for _ in range(len(d)):
        S += d.popleft()
else:
    for _ in range(len(d)):
        S += d.pop()
print(S)
a  = input()
x = int(a[0])
y = int(a[1])
z = int(a[2])
w = int(a[3])
o = ["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            if i == 0 and j == 0 and k == 0:
                if x + y + z + w == 7: p = [i,j,k]
            elif i == 0 and j == 0 and k == 1:
                if x + y + z - w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 0:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 0:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 0:
                if x - y - z + w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 1:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 1:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 1:
                if x - y - z - w == 7: p = [i,j,k]
print(str(x)+o[p[0]]+str(y)+o[p[1]]+str(z)+str(o[p[2]])+str(w)+"=7")

### FIXED CODE ###

a  = input()
x = int(a[0])
y = int(a[1])
z = int(a[2])
w = int(a[3])
o = ["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            if i == 0 and j == 0 and k == 0:
                if x + y + z + w == 7: p = [i,j,k]
            elif i == 0 and j == 0 and k == 1:
                if x + y + z - w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 0:
                if x + y - z + w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 0:
                if x - y + z + w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 0:
                if x - y - z + w == 7: p = [i,j,k]
            elif i == 0 and j == 1 and k == 1:
                if x + y - z - w == 7: p = [i,j,k]
            elif i == 1 and j == 0 and k == 1:
                if x - y + z - w == 7: p = [i,j,k]
            elif i == 1 and j == 1 and k == 1:
                if x - y - z - w == 7: p = [i,j,k]
print(str(x)+o[p[0]]+str(y)+o[p[1]]+str(z)+str(o[p[2]])+str(w)+"=7")
h,w = map(int,input().split())
HW = [list(map(int,input().split())) for _ in range(h)]
min_root = h + w - 1
if sharp == min_root:
  print('Possible')
else:
  print('Impossible')


### FIXED CODE ###

def main():
  H, W = list(map(int, input().split()))

  count = 0

  for i in range(H):
    row = input()
    for j in range(W):
      if(row[j] == '#'):
        count += 1

  print("Possible" if W + H - 1 == count else "Impossible")

if __name__ == "__main__":
  main()
a,b=map(int,input().split())
n=list([str(input()) for i in range(b)])
for i in n:
    p=sorted(n)
    q=''.join(p)
print(q)

### FIXED CODE ###

a,b=map(int,input().split())
n=sorted([input() for i in range(a)])
print(*n,sep='')
A,B = map(float,input().split())
ans = str(A*B)
if ans[-3] == '.':
    a = ans[0:len(ans) - 3]
    print(int(a))
else:
    a = ans[0:len(ans) - 2]
    print(int(a))

### FIXED CODE ###

A,B = map(str,input().split())
a = int(A)
b = int(B[0])*100 + int(B[2])*10 + int(B[3])
print((a*b)//100)
N,M = map(int, input().split())

parent_dict = dict() #key:子 value:親

#接続追加
def add_connect(A,B):
    A_parent = get_parent(A)
    B_parent = get_parent(B)
    
    if A_parent != B_parent:
        parent_dict[B_parent] = A_parent

#接続有無判断
def judge_connection(A,B):
    A_parent = get_parent(A) #未更新状態でも、ここで更新される
    B_parent = get_parent(B)
    
    if A_parent != B_parent:
        return False
    else:
        return True

#親の取得
def get_parent(child):
    if child not in parent_dict: #初出なら自分自身を親として追加
        parent_dict[child] = child
    
    parent = parent_dict[child]
    
    if parent == child: 
        return parent
    else: #最上位の親なら上の等式が成り立つ。不成立ならさらに上位の親を辿る。
        parent_dict[child] = get_parent(parent) 
        return parent_dict[child]

##注意!!　全入力完了後にget_parentをしないと、正しい親が得られない
#ex 12 23 13 56 61 43→{1: 5, 2: 1, 3: 5, 5: 4, 6: 5, 4: 4}になる
for i in range(M):
    A,B = map(int, input().split())
    add_connect(A,B)

for i in range(1,N+1):
    get_parent(i)
  
#最も子が多い親を求めるために、親:子の辞書を作る
child_dict = dict() #key:親 value:子

for i in range(1,N+1):
    if parent_dict[i] not in child_dict:
        child_dict[parent_dict[i]] = set()
    child_dict[parent_dict[i]].add(i)


ans = 1
for parent in child_dict:
    if len(child_dict[parent]) > ans:
        ans = len(child_dict[parent])

print(ans)

### FIXED CODE ###

#再帰の限度を拡張
import sys
sys.setrecursionlimit(1000000)
N,M = map(int, input().split())

parent_dict = dict() #key:子 value:親

#接続追加
def add_connect(A,B):
    A_parent = get_parent(A)
    B_parent = get_parent(B)
    
    if A_parent != B_parent:
        parent_dict[B_parent] = A_parent

#接続有無判断
def judge_connection(A,B):
    A_parent = get_parent(A) #未更新状態でも、ここで更新される
    B_parent = get_parent(B)
    
    if A_parent != B_parent:
        return False
    else:
        return True

#親の取得
def get_parent(child):
    if child not in parent_dict: #初出なら自分自身を親として追加
        parent_dict[child] = child
    
    parent = parent_dict[child]
    
    if parent == child: 
        return parent
    else: #最上位の親なら上の等式が成り立つ。不成立ならさらに上位の親を辿る。
        parent_dict[child] = get_parent(parent) 
        return parent_dict[child]


##注意!!　全入力完了後にget_parentをしないと、正しい親が得られない
#ex 12 23 13 56 61 43→{1: 5, 2: 1, 3: 5, 5: 4, 6: 5, 4: 4}になる
for i in range(M):
    A,B = map(int, input().split())
    add_connect(A,B)

for i in range(1,N+1):
    get_parent(i)

#print(parent_dict)

#最も子が多い親を求めるために、親:子の辞書を作る
child_dict = dict() #key:親 value:子

for i in range(1,N+1):
    if parent_dict[i] not in child_dict:
        child_dict[parent_dict[i]] = set()
    child_dict[parent_dict[i]].add(i)


ans = 1
for parent in child_dict:
    if len(child_dict[parent]) > ans:
        ans = len(child_dict[parent])

print(ans)
def resolve():
  N = int(input())
  X = input()
  base_1_count = X.count("1")
  X_int = int(X, 2)
  X_int_p = X_int%(base_1_count + 1)
  X_int_m = X_int%(base_1_count - 1)

# 高速化バージョン
  for i in range(N):
    if base_1_count == 1 and X[i] == "1":
      print(0)
      continue

    if X[i] == "1":
      Xi = X_int_m - 2**(N-i-1)%(base_1_count-1)
    else:
      Xi = X_int_p + 2**(N-i-1)%(base_1_count+1)
    count = 1
    while Xi != 0:
      # print(Xi)
      num_of_1 = bin(Xi).count("1")
      if num_of_1 != 0:
        Xi %= num_of_1
        count += 1
      else:
        break
    # print("~~~~~~~~~~~~~~~")
    print(count)

# 低速バージョン
  # for i in range(N):
  #   if X[i] == "1":
  #     Xi = X_int - 2**(N-i-1)
  #   else:
  #     Xi = X_int + 2**(N-i-1)
  #   count = 0
  #   while Xi != 0:
  #     # print(Xi)
  #     num_of_1 = bin(Xi).count("1")
  #     Xi %= num_of_1
  #     count += 1
  #   # print("~~~~~~~~~~~~~~~")
  #   print(count)

if __name__ == "__main__":
    resolve()

### FIXED CODE ###

def resolve():
  N = int(input())
  X = input()

  if N == 1:
    if X.count("1"):
      print(0)
    else:
      print(1)
    return True

  base_1_count = X.count("1")
  if base_1_count == 0:
    for _ in range(N):
      print(1)
    return True

  X_int = int(X, 2)
  X_int_p = X_int%(base_1_count + 1)

  # RE 対策
  if base_1_count == 1:
    for i in range(N):
      if X[i] == "1":
        print(0)
      else:
        if i == N - 1:
          Xi = X_int_p + 1
        else:
          Xi = X_int_p
        count = 1
        while Xi != 0:
          Xi %= bin(Xi).count("1")
          count += 1
        print(count)
    return True

  X_int_m = X_int%(base_1_count - 1)
  for i in range(N):
    # 初期値計算を高速にやる
    if X[i] == "1":
      temp_1_count = base_1_count-1
      pow_2 = pow(2, N-i-1, base_1_count-1)
      if X_int_m <= pow_2:
        Xi = X_int_m - pow_2 + base_1_count-1
      else:
        Xi = X_int_m - pow_2
    else:
      temp_1_count = base_1_count+1
      Xi = X_int_p + pow(2, N-i-1, base_1_count+1)
      while Xi >= base_1_count+1:
        Xi %= base_1_count+1

    # print("1_c={0}".format(temp_1_count))
    if temp_1_count == Xi:
      print(1)
      continue

    count = 1
    while Xi != 0:
      num_of_1 = bin(Xi).count("1")
      Xi %= num_of_1
      count += 1
    print(count)

if __name__ == "__main__":
    resolve()
S = input()
S_len = len(S) - 1
p = []
for i in range(2 ** S_len):
    tmp = bin(i)[2::]
    while len(tmp) < S_len:
        tmp = "0" + tmp
    p.append(str(tmp))

sum = 0
for i in p:
    P = list(i)
    tmp = int(S[0])
    cnt = 1
    for j in P:
        if j == "0":
            tmp *= 10
            tmp += int(S[cnt])
        else:
            sum += tmp
            tmp = int(S[cnt])
        cnt += 1
    sum += tmp
print(sum)

### FIXED CODE ###

S = input()
S_len = len(S) - 1
p = []
for i in range(2 ** S_len):
    tmp = bin(i)[2::]
    while len(tmp) < S_len:
        tmp = "0" + tmp
    p.append(str(tmp))

sum = 0
for i in p:
    if len(p) == 1:
        sum = S
        break
    P = list(i)
    tmp = int(S[0])
    cnt = 1
    for j in P:
        if j == "0":
            tmp *= 10
            tmp += int(S[cnt])
        else:
            sum += tmp
            tmp = int(S[cnt])
        cnt += 1
    sum += tmp
print(sum)
N=input()
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /(N-1)/2
print(answer) 
 

### FIXED CODE ###

N=int(input())
if N%2==0:
  answer = 1.0/2
else:
  answer = ((N-1)/2 + 1) /N
print(answer)
A, B = map(int, input().split())

plus = A + B
minus = A - B
cross = A * B

if plus >= minus:
	if plus >= cross:
      print(plus)
    else:
      print(cross)
else:
	print(minus)

### FIXED CODE ###

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

plus = A + B
minus = A - B
cross = A * B
test = [plus, minus, cross]
print(max(test))
a,b,c,d = map(int,input().split())
if c%b =< a%d:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c,d = map(int,input().split())

takahashi = c//b
if c%b!=0:
    takahashi += 1
    
aoki = a//d
if a%d!=0:
    aoki += 1

if takahashi <= aoki:
    print("Yes")
else:
    print("No")
s = input()
x,y = map(int,input().split())
k = 0
data = [[],[]]
f = 0
p = 1
for s_ in s:
    if p==1 and s_=='F':
        x -= 1
        continue
    p = 0
    if s_ == 'T':
        if f:
            data[k].append(f)
        k = (k+1)%2
        f = 0
    else:
        f += 1
if f:
    data[k].append(f)

nx = sum(data[0])
ny = sum(data[1])

if nx<x or ny<y:
    print('No')
    exit()

dpx = [[0]*8001 for _ in range(len(data[0])+1)]
dpy = [[0]*8001 for _ in range(len(data[1])+1)]
x_zero = 0
y_zero = 0
dpx[0][x_zero] = 1
dpy[0][y_zero] = 1

for i in range(len(data[0])):
    for j in range(len(dpx[i])):
        if dpx[i][j]==1:
            dpx[i+1][j+data[0][i]] += 1
            dpx[i+1][j-data[0][i]] += 1

for i in range(len(data[1])):
    for j in range(len(dpy[i])):
        if dpy[i][j]==1:
            dpy[i+1][j+data[1][i]] += 1
            dpy[i+1][j-data[1][i]] += 1
if dpx[-1][x_zero+x]>=1 and dpy[-1][y_zero+y]>=1:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

now=0
idx=-1
data=[[],[]]
cnt=0
for s in input():
    if s=='F':
        cnt+=1
    elif s=='T':
        if idx==-1:
            now+=cnt
            cnt=0
            idx=1
        elif idx==0:
            data[0].append(cnt)
            cnt=0
            idx=1
        elif idx==1:
            data[1].append(cnt)
            cnt=0
            idx=0
if idx==-1:
    now+=cnt
else:
    data[idx].append(cnt)
def solve(target,move):
    dp={0,}
    for m in move:
        dpc=dp.copy()
        dp=set()
        for k in dpc:
            dp|={k-m,k+m}
    if target in dp:
        return True
    return False
x,y=map(int,input().split())
x-=now
if solve(x,data[0]) and solve(y,data[1]):
    print('Yes')
else:
    print('No')