Harryxun/stf_run huggingface dataset:
s=input()
k=int(input())

if k==1:
    print(s[0])
    
else:
    for i in range(len(s)):
        if s[i]!="1":
            break
    if i!=1 and k<=i:
        print(1)
    elif i!=1 and k>i:    
        print(s[i+1])
        
    elif s[0]=="1" and s[1]!="1":
        if k <= (10**18):
            print(s[1])
        else :
            print(s[2])
    else:
        if k <= (10**18):
            print(s[0])
        else:
            print(s[1])
            

### FIXED CODE ###

s=input()
k=int(input())
for i in range(len(s)):
    if s[i]=="1":
        k-=1
    else:
        k=0
    if k<=0:
        print(s[i])
        break
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]
MOD = 10 ** 9 + 7
count = [0]
dp = [[-1] * W for _ in range(H)]

def dfs(x, y):
  ret = 0
  for nx, ny in ((1,0), (0,1)):
    nx += x
    ny += y
    if nx == W-1 and ny == H-1:
      ret += 1
    elif dp[ny][nx] > -1:
      ret += dp[ny][nx]
    elif nx < W and ny < H and field[ny][nx] == "#":
      ret += dfs(nx, ny)
  dp[y][x] = ret % MOD
  return ret

dfs(0,0)
print(dp[0][0])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())
field = [list(input()) for _ in range(H)]
MOD = 10 ** 9 + 7
count = [0]
dp = [[-1] * W for _ in range(H)]

def dfs(x, y):
  ret = 0
  for nx, ny in ((1,0), (0,1)):
    nx += x
    ny += y
    if nx == W-1 and ny == H-1:
      ret += 1
      continue
    elif nx >= W or ny >= H:
      continue
    elif dp[ny][nx] > -1:
      ret += dp[ny][nx]
      continue
    elif field[ny][nx] == "#":
      continue
    else:
      ret += dfs(nx, ny)
  dp[y][x] = ret % MOD
  return ret

dfs(0,0)
print(dp[0][0])
e=input
 a=''
 for _ in[0]*int(e()):
  X,z=e(),[]
  for y in e():
   s=i=0
   for k in z:
    t=X.find(y,s)+1
    if t<1:break
    if t<k:z[i]=t
    s=k;i+=1
   else:
    t=X.find(y,s)+1
    if t:z+=[t]
  a+=f'\n{len(z)}'
 print(a[1:]


### FIXED CODE ###

 
def lcs(X, Y):
    dp = [0]*(len(Y)+1)
     
    for x in X:
        tmp = dp[:]
        for j, y in enumerate(Y):
            if x == y:
                dp[j+1] = tmp[j] + 1
            elif dp[j+1] < dp[j]:
                dp[j+1] = dp[j]
                                
    return dp[-1]
 
n = int(input()) 

for i in range(n):
    X = input()
    Y = input()
    print(lcs(X, Y))
n=int(input())
a=0
b=0
c=0
d=0
for i in range(n):
  s=input()
  if s=="AC":
    a=a+1
  if s=="WA":
    b=b+1
  if s=="TLE":
    c=c+1
  if s=="RE":
    d=d+1
print("AC*a""WA*b""TLE*c""RE*d)


### FIXED CODE ###

n=int(input())
if n%1000==0:
  print(0)
else:
  print((n//1000+1)*1000-n)
import numpy as np

def count(s):
    prev = ""
    cnt = 0
    dp = np.zeros(len(s)+1, dtype=int)
    for i, c in enumerate(s):
        if (prev == "A") and (c == "C"):
            cnt += 1
        prev = c
        dp[i+1] = cnt
    return dp

def solve(n, q, s, l, r):
    dp = count(s)
    for i in range(q):
        print(dp[r[i]] - dp[l[i]])

n, q = map(int, input().split())
s = input()
l = np.zeros(n, dtype=int)
r = np.zeros(n, dtype=int)
for i in range(q):
    l[i], r[i] = map(int, input().split())
solve(n, q, s, l, r)

### FIXED CODE ###

import numpy as np

def count(s):
    prev = ""
    cnt = 0
    dp = np.zeros(len(s)+1, dtype=int)
    for i, c in enumerate(s):
        if (prev == "A") and (c == "C"):
            cnt += 1
        prev = c
        dp[i+1] = cnt
    return dp

def solve(n, q, s, l, r):
    dp = count(s)
    for i in range(q):
        print(dp[r[i]] - dp[l[i]])

n, q = map(int, input().split())
s = input()
l = np.zeros(q, dtype=int)
r = np.zeros(q, dtype=int)
for i in range(q):
    l[i], r[i] = map(int, input().split())
solve(n, q, s, l, r)
n=int(input())
d=map(int,input().split())
kotae=0
for i in range(n):
  for j in range(n-i-1):
    kotae=kotae+d[i]*d[j]
print(kotae)

### FIXED CODE ###

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

kotae=0
for i in range(n):
  for j in range(i+1,n):
    kotae=kotae+d[i]*d[j]
print(kotae)
N = int(input())

num = (N*(N-1)*10**(N-2)) / (10**9 +7)
print(num)

### FIXED CODE ###

N = int(input())

num = 10**N - 2*(9**N) + 8**N
print(num % (10**9 + 7))
x = input()
 
happyPoints = 0
 
y = x - (x % 500)
 
if x % 500 !== x:
  happyPoints += (x/500)*1000
  	if y % 5 !== y:
      z = y - (y % 5)
      happyPoints += y
elif x % 5 !== x:
  w = x - (x % 5)
  happyPoints += w
 
  print(happyPoints)


### FIXED CODE ###

s = input()
 
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No')
n, m = map(int, input().split())
p = list(map(lambda x: int(x) - 1, input().split()))
xy = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]

par = [i for i in range(n)]
rank = [0 for _ in range(n)]


def root(x):
    if par[x] == x:
        return x
    par[x] = root(x)
    return par[x]


def is_same(x, y):
    return par[x] == par[y]


def union(x, y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[y] == rank[x]:
            rank[x] += 1


for x, y in xy:
    union(x, y)

count = 0
for i, p_i in enumerate(p):
    count += 1 if is_same(i, p_i) else 0
print(count)


### FIXED CODE ###

n, m = map(int, input().split())
p = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]

par = [i for i in range(n)]
rank = [1 for _ in range(n)]


def root(x):
    if x == par[x]:
        return x
    par[x] = root(par[x])
    return par[x]


def is_same(x, y):
    return root(x) == root(y)


def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    par[x] = y


for x, y in xy:
    unite(x - 1, y - 1)


count = 0
for i, p_i in enumerate(p):
    count += 1 if is_same(i, p_i - 1) else 0
print(count)
def qsort(a: int, left: int, right: int) -> None:
  pl=left
  pr=right
  x=a[(left+right)//2]

  while pl<=pr:
    while a[pl]>x: pl+=1    # 降順
    while a[pr]<x: pr-=1
    if pl <= pr:
      a[pl],a[pr] = a[pr],a[pl]
      pl+=1
      pr-=1
  
  if left  <pr: qsort(a,left,pr)
  if right >pl: qsort(a,pl,right)
    
def quick_sort(a: int) -> None:
  qsort(a,0,len(a)-1)
  
if __name__ == '__main__':
  X,Y,A,B,C = map(int, input().split())
  p=list(map(int,input().split()))
  q=list(map(int,input().split()))
  r=list(map(int,input().split()))

  quick_sort(p)
  quick_sort(q)
  
  for i in range(C):
    if p[X-i-1] < r[i]:
      if q[Y-i-1] < p[X-i-1]:q[Y-i-1] = r[i]
      else:p[X-i-1] = r[i]
    else:  
      if q[Y-i-1] < r[i]:q[Y-i-1] = r[i]
  
  x=0
  for i in range(X):
    x+=p[i]
  for i in range(Y):
    x+=q[i]
  print(x)

### FIXED CODE ###

X,Y,A,B,C=map(int, input().split())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))

x=X-1
y=Y-1

p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r,reverse=True)

#print(p[:X],q[:Y])

if p[x]>=q[y]:
  a=q[y]
  f=1
else:
  a=p[x]
  f=2
while len(r)>=1 and a<r[0]:
#  print(a,r[0])
  if f==1 :
#    print('f=1')
    q[y]=r[0]
    y-=1
    r.pop(0)
  elif f==2 :
#    print('f=2')
    p[x]=r[0]
    x-=1
    r.pop(0)
  else:
#    print('break1')
    break
    
#  print(x,y,p[x],q[y])
    
  if (y==-1 and x>=0) or (x>=0 and p[x]<q[y]):
#    print('a=p[x]')
    a=p[x]
    f=2
  elif (x==-1 and y>=0) or (y>=0 and p[x]>=q[y]):
#    print('a=q[y]')
    a=q[y]
    f=1
  else:
#    print('break2')
    break

ans=0
#print(p[:X],q[:Y])
for i in p[:X]:
  ans+=i
for i in q[:Y]:
  ans+=i

print(ans)
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ab = list()
for a in A:
    for b in B:
        ab.append(a+b)
ab.sort(reverse=True)
C.sort(reverse=True)
i = 0
cnt = 0
abc = []
for a in ab[:k]:
    for b in C:
        abc.append(a+b)
abc.sort(reverse=True)
print(*abc[:k], sep="\n")

### FIXED CODE ###

import heapq as hq
x,y,z,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ab = []
for a in A:
    for b in B:
        hq.heappush(ab, -a-b)
abc = []
cnt = 0
while cnt < k and ab:
    cnt += 1
    a = hq.heappop(ab)
    for b in C:
        hq.heappush(abc, a-b)
cnt = 0
while cnt < k:
    print(-hq.heappop(abc))
    cnt += 1
n=int(input())
a=[]
hd=[0]*n
for i in range(n):
    a.append(tuple(map(int,input().split())))
loop=0
flag=0
while(flag<n):
    stk=[]
    for i in range(n):
        idx=a[i][hd[i]]-1
        if a[idx][hd[idx]]==i+1:
            stk.append(i)
    if not stk:
        loop=-2
        break
    for j in stk:
        hd[j]+=1
        if hd[j]==n-2:
            flag+=1
    loop+=1
print(loop+1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
n=int(input())
a=[]
for i in range(n):
    a.append(tuple(map(int,input().split())))
#print(a)

root=[[] for i in range(n*(n-1)//2)]
buf=0
for i in range(n):
    buf=0
    for j in range(n-1):
        if j==0:
            x=min(i,a[i][j]-1)
            y=max(i,a[i][j]-1)
            buf=x*(2*n-2-x+1)//2+(y-x)-1
            #print(x,y,buf)
            continue
        x=min(i,a[i][j]-1)
        y=max(i,a[i][j]-1)
        node=x*(2*n-2-x+1)//2+(y-x)-1
        #print(x,y,node)
        root[buf].append(node)
        buf=node
flag=[True]

#閉路☑
def dfs(node,par): 
    dp[node]=0
    for item in root[node]:
        if item==par:
            continue
        if dp[item]==0:
            flag[0]=False
            return
        if dp[item]==-1: 
            dfs(item,node)
    dp[node]=1#finish
dp=[-1]*(n*(n-1)//2)
for i in range(n*(n-1)//2):
    if dp[i]==-1:
        dfs(i,i)
        if flag[0]==False:
            break
if flag[0]==False:
    print(-1)
    sys.exit()
dp=[-1]*(n*(n-1)//2)
def dfs1(node,par): 
    buf=0
    for item in root[node]:
        if item==par:
            continue
        if dp[item]!=-1:
            buf=max(buf,dp[item])
            continue
        if dp[item]==-1: 
            buf=max([buf,dfs1(item,node)])
    dp[node]=buf+1#finish
    return buf+1

for i in range(n*(n-1)//2):
    if dp[i]==-1:
        dp[i]=dfs1(i,i)
print(max(dp))
a,b,k = map(int,input().split())

if (b - a + 1) > 2 * k:
    for i in range(a,a + k):
        print(i)
    for i in range(b - k + 1,b + 1):
        print(i)
else:
    for i in range(a,b + 1):
        print(i)

### FIXED CODE ###

# coding: utf-8
import re
S = input()
find_a = re.findall("a",S)
find_b = re.findall("b",S)
find_c = re.findall("c",S)
if find_a and find_b and find_c:
    print("Yes")
else:
    print("No")
N, T = input().split()
N, T = int(N), int(T)
R = [input().split() for i in range(N)]

for i, r in enumerate(R):
  R[i] = [int(r[0]), int(r[1])]

R_sorted = sorted(R, key = lambda x: x[0])

List = []
answer = 'TLE'

for r in R_sorted:
  if r[1] <= T:
    List.append(r[0])

print(min(List))

### FIXED CODE ###

N, T = input().split()
N, T = int(N), int(T)
R = [input().split() for i in range(N)]
 
for i, r in enumerate(R):
  R[i] = [int(r[0]), int(r[1])]
 
R_sorted = sorted(R, key = lambda x: x[0])
 
List = []
answer = 'TLE'
 
for r in R_sorted:
  if r[1] <= T:
    List.append(r[0])

if List:
  answer = min(List)

print(answer)
A = []
for i in range(3):
    A.append(list(input().split()))
N = int(input())
B = []
for i in range(N):
    B.append(input())
B=set(B)
if {A[0]} <= B or {A[1]} <= B or {A[2]} <= B or {A[0][0], A[1][0], A[2][0]} <= B or\
 {A[0][1], A[1][1], A[2][1]} <= B or {A[0][2], A[1][2], A[2][2]} <= B or {A[0][0], A[1][1], A[2][2]} <= B or {A[2][2], A[1][1], A[2][0]} <= B:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A = []
for i in range(3):
    A.append(list(input().split()))
N = int(input())
B = []
for i in range(N):
    B.append(input())
B=set(B)
if set(A[0]) <= B or set(A[1]) <= B or set(A[2]) <= B or {A[0][0], A[1][0], A[2][0]} <= B or\
{A[0][1], A[1][1], A[2][1]} <= B or {A[0][2], A[1][2], A[2][2]} <= B \
or {A[0][0], A[1][1], A[2][2]} <= B or {A[0][2], A[1][1], A[2][0]} <= B:
    print("Yes")
else:
    print("No")
108proA
k = int(input())
ans = (k//2) * ((k+1)//2)
print(ans)

### FIXED CODE ###

k = int(input())
ans = (k//2) * ((k+1)//2)
print(ans)
n=int(input())
i=0
JPY=0
while n > i:
  i=i+1
  a,b=map(str,input().split())
  a = float(a)
  if b == "JPY":
    JPY=JPY+a
  else:
    JPY=JPY+a*380000
print(JPY)

### FIXED CODE ###

input=input()
if input < "2019/04/31":
  print("Heisei")
else:
  print("TBD")
a,b=[int(x) for x in input().split()]
if a > b:
 print("a > b")
else if a = b:
 print("a == b")
else:
 print("a < b")


### FIXED CODE ###

a,b=[int(x) for x in input().split()]
if a > b:
 print('a > b')
elif a == b:
 print('a == b')
else:
 print('a < b')
n,m = map(int,input().split())
arr = list(map(int,input().split('')))
res = 0
for i in arr:
  if i >= m:
    res += 1
return res

### FIXED CODE ###

n=int(input())
cnt=0
for i in range(1,n+1):
    if i%2==1:
        cnt += 1
print(cnt/n)
A, B = map(int,input().split())

if (a * b) % 2 == 0:
  print("Odd")
else:
  print("Even")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b)%2 != 0:
  print("Odd")
else:
  print("Even")
from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

m = []
p = []
z = 0

for i in range(n):
  if(an[i]<0):
    m.append(an[i])
  if(an[i]>0):
    p.append(an[i])
  if(an[i]==0):
    z=1

if ( z==1 ):
  ans = sum(p) - sum(m)
else:
  if ( len(m) == 0):
    ans = sum(p)
  else:
    if ( len(m)%2 == 0):
      ans = sum(p) - sum(m)
    else:
      minm = 0
      if ( min(p) < (-max(m)) ):
        minm = min(p)
      else:
        minm = -max(m)
      ans  = sum(p) - sum(m) - (minm*2)

print(ans)

### FIXED CODE ###

from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))

m = []
p = []
z = 0

for i in range(n):
  if(an[i]<0):
    m.append(an[i])
  if(an[i]>0):
    p.append(an[i])
  if(an[i]==0):
    z=1

if ( z==1 ):
  ans = sum(p) - sum(m)
elif ( len(m) == 0):
    ans = sum(p)
else:
  if ( len(p) == 0):
    if ( len(m)%2 == 0):
      ans = - sum(m)
    else:
        minm = -max(m)
        ans = -sum(m) - (minm*2)
  else:
    if ( len(m)%2 == 0):
      ans = sum(p) - sum(m)
    else:
      minm = 0
      if ( min(p) < (-max(m)) ):
        minm = min(p)
      else:
        minm = -max(m)
      ans  = sum(p) - sum(m) - (minm*2)

print(ans)
A,P=[int(i) for input().split()]
print((A//3+P)//2)

### FIXED CODE ###

A,P=[int(i) for i in input().split()]
print((A*3+P)//2)
import math
import copy
 
 
 
 
def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:
 
            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l
 

n=input()
s=input()

mod=1000000007
def help1(a):
    all=0
    a1=1
    a2=1
    
    b1=1
    while a!=0:
        a1=a1*a
        a2=a2*b1
        b1+=1
        tmp=(int)(a1/a2)
        a=a-1
        all=(all+tmp)%mod
    return all

def func():
    count=help1(len(s))
    dic={}

    for c in s:
        if c in dic:
            dic[c]=dic[c]+1
        else:
            dic[c]=1
    res=len(s)
    l=[]
    for k in dic:
        if dic[k]==1:
            l.append(k)
    for obj in l:
        del dic[obj]
        
    count2=1
    sum1=0
    for k in dic:
        sum1+=dic[k]
        count2=count2*(1+dic[k])



    number3=help1(sum1)-count2+1

    number4=help1(len(s)-sum1)+1

    number3=number3*number4
    return count-number3
  

print(func())


### FIXED CODE ###

import math
import copy
from collections import Counter
 
 
 
def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:
 
            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l
 

n=input()
s=input()

mod=7+10**9


def func():

    dic = Counter(s)
    ans = 1
    for x in dic:
        ans = ans*(dic[x]+1)%mod
    return ans-1
    
print(func())
import sys

k, tmp = [line.rstrip() for line in sys.stdin]
k, a, b = int(k), [int(x) for x in tmp.split()]
print(a//k < b//k)

### FIXED CODE ###

k = int(input())
a, b = [int(x) for x in input().split()]
res = (a//k < b//k) or (not a%k) or (not b%k)
print('OK' if res else 'NG')
n = int(input())
A = list(map(int, input().split()))
num = [0] * (10 ** 5)

for a in A:
    num[a] += 1
_sum = sum(A)

result = []
q = int(input())
for i in range(q):
    b, c = list(map(int, input().split()))
    _sum += (c - b) * num[b]
    num[c] += num[b]
    num[b] = 0
    result.append(str(_sum))
print('\n'.join(result))

### FIXED CODE ###

if input().isupper():
  print('A')
else:
  print('a')
import math


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


def resolve():
    N, K = map(int, input().split())
    const = 1e9 + 7
    n_iter = int(min(K, N - K + 2))
    for i in range(1, n_iter + 1):
        ans = combinations_count(N - K + 1, i) * combinations_count(
            K - 1, i - 1)
        print(int(ans % const))
resolve()

### FIXED CODE ###

import math


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


def resolve():
    N, K = map(int, input().split())
    const = 1e9 + 7
    for i in range(1, K + 1):
        if (N - K + 1 >= i):
            print(
                combinations_count(N - K + 1, i) *
                combinations_count(K - 1, i - 1) % 1000000007)
        else:
            print(0)
            
resolve()
a = int(input())
A=[]
for i in range(a):
  array = input().split(' ')
  A.append(array)

sum=0
for j in A:
  if j[1]=='JPY':
    sum += int(j[0])
  else:
    sum += int(j[0])*380000
print(sum)

### FIXED CODE ###

a = int(input())
A=[]
for i in range(a):
  array = input().split(' ')
  A.append(array)

sum=0
for j in A:
  if j[1]=='JPY':
    sum += int(j[0])
  else:
    sum += float(j[0])*380000
print(sum)
a, b, c, d = map(int, input().split())

"""
両方に関して割り切れるものの個数から公倍数で割り切れるものを除けばいい
"""
import math

C = b//c - (a-1)//c
D = b//d - (a-1)//d

# 最小公倍数を求める
CD = math.gcd(c, d)
lcm = (c * d) // CD

G = b//lcm - (a-1)//lcm


count = C + D - G
print(b - a + 1 - count)

### FIXED CODE ###

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

"""
両方に関して割り切れるものの個数から公倍数で割り切れるものを除けばいい
"""
import fractions

C = b//c - (a-1)//c
D = b//d - (a-1)//d

# 最小公倍数を求める
CD = fractions.gcd(c, d)
lcm = (c * d) // CD

G = b//lcm - (a-1)//lcm


count = C + D - G
print(b - a + 1 - count)
import sys
sys.setrecursionlimit(100000)

N,Q=map(int,input().split())

dic_score={}
tree_list=[]
for i in range(N+1):
  tree_list.append([])
ans_list=[0]*(N+1)

def dfs(v,s):
  global dic_score
  global tree_list
  global ans_list
  
  score=s
  if v in dic_score:
    score+=dic_score[v]
    
  ans_list[v]+=score
  for vv in tree_list[v]:
    dfs(vv,score)

for i in range(N-1):
  a,b=map(int,input().split())
  tree_list[a].append(b)
  
for i in range(Q):
  p,x=map(int,input().split())
  if p in dic_score:
    dic_score[p]+=x
  else:
    dic_score[p]=x

dfs(1,0)

#print(tree_list)
#print(ans_list)
ans_list_str=[]
for i in range(1,N+1):
  ans_list_str.append(str(ans_list[i]))

print(" ".join(ans_list_str))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input=sys.stdin.readline

def dfs(u,par):
  ans_list[u]+=ans_list[par]  
  for v in tree_list[u]:
    if v!=par:
      dfs(v,u)      
  return

N,Q=map(int,input().split())

tree_list=[[] for _ in range(N+1)]
for i in range(N-1):
  a,b=map(int,input().split())
  tree_list[a].append(b)
  tree_list[b].append(a)
#print(tree_list)

ans_list=[0]*(N+1)
for i in range(Q):
  p,x=map(int,input().split())
  ans_list[p]+=x

dfs(1,0)

print(*ans_list[1:])
l, ans = len(s), []
for i in range(0,l-2):
    n = s[i:i+3]
    ans.append(abs(753-int(n)))
print(min(ans))

### FIXED CODE ###

s = input()
l, ans = len(s), []
for i in range(0,l-2):
    n = s[i:i+3]
    ans.append(abs(753-int(n)))
print(min(ans))
S = str(input())
K = int(input())

if len(S) == 1:
        print(S[0])
        exit(0)

i = 0
while S[i] == '1':
        i += 1
print(S[i])

### FIXED CODE ###

S = str(input())
K = int(input())

if len(S) == 1:
        print(S[0])
        exit(0)

i = 0
while S[i] == '1' and i <= len(S)-2:
        if K <= i + 1:
                print(S[i])
                exit(0)
        i += 1
print(S[i])
import fraction

N, X = input().split()
xList = [int(x) for x in input().split()]
N = int(N)
X = int(X)
xList.append(X)
xList.sort()
diffList = []
for x, xx in zip(xList, xList[1:]):
    diffList.append(xx - x)

diffList.sort()

print(fraction.gcd(diffList[0], diffList[-1]))

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
N, X = input().split()
xList = [int(x) for x in input().split()]
N = int(N)
X = int(X)
xList.append(X)
xList.sort()
diffList = []
for x, xx in zip(xList, xList[1:]):
    diffList.append(xx - x)
if len(diffList) > 1:
    diffList.sort()
    gcdList = []
    for x in diffList[1:]:
        gcdList.append(gcd(diffList[0], x))
    gcdList.sort()
    print(gcdList[0])
else:
    print(diffList[0])
from typing import Tuple, List


def manhattan_distance(p: Tuple[int, int], q: Tuple[int, int]) -> int:
    return abs(p[0] - q[0]) + abs(p[1] - q[1])


N, M = map(int, input().split())
students: List[Tuple[int, int]] = [tuple(map(int, input().split())) for _ in range(N)]
checkpoints: List[Tuple[int, int]] = [tuple(map(int, input().split())) for _ in range(M)]

for student in students:
    p = min([(manhattan_distance(student, checkpoint), idx) for idx, checkpoint in enumerate(checkpoints, start=1)])
    print(p[1])


### FIXED CODE ###

def manhattan_distance(p, q) -> int:
    return abs(p[0] - q[0]) + abs(p[1] - q[1])


N, M = map(int, input().split())
students = [tuple(map(int, input().split())) for _ in range(N)]
checkpoints = [tuple(map(int, input().split())) for _ in range(M)]

for student in students:
    p = min([(manhattan_distance(student, checkpoint), idx) for idx, checkpoint in enumerate(checkpoints, start=1)])
    print(p[1])
def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  turn = nextTurn(hand[turn].pop(0))
  if len(hand[turn]) == 0:
    if turn == 0:
      print("A")
    elif turn == 1:
      print("B")
    else:
      print("C")
    break
  

### FIXED CODE ###

def nextTurn(a):
  if a == "a":
    return 0
  elif a == "b":
    return 1
  else:
    return 2
    
hand = [list(input()) for i in range(3)]
turn = nextTurn(hand[0].pop(0))
while(True):
  if len(hand[turn]) == 0:
    if turn == 0:
      print("A")
    elif turn == 1:
      print("B")
    else:
      print("C")
    break
  turn = nextTurn(hand[turn].pop(0))
n = int(input())
l = []
for _ in range(n):
  A = list(map(int, input().split()))
  l.append(A)
  
l = sorted(l)
count = 0
count1 = 0
count2 = 0
for i in range(n-2):
  j = i + 1
  a = l[j][0]-l[j][1]
  b = l[j][0]+l[j][1]
  
  if l[j-1][0]+l[j-1][1] <= a and b <= l[j+1][0]-l[j+1][1]:
    count = count + 1
  if l[j-1][0]+l[j-1][1] >= a and b >= l[j+1][0]-l[j+1][1]:
    count1 = count1 + 1
  else:
    count2 = count2 + 1 

sum = count + count2/2
print(count+count1-1)

### FIXED CODE ###

h = int(input())
w = int(input())
n = int(input())

m = max(h,w)
a = n // m
b = n % m
if b == 0:
  print(a)
else:
  print(a+1)