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

if s[0]=="1":
    print(s[1])
else:
    print(s[0])

### FIXED CODE ###

import sys

s=input()
k=int(input())


i=0
while i<len(s) and i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")
import sys
 
 
def main():
  N = int(input())
  
  if N[-1] == 3:
    print("bon")
  elif N[-1] in (0,1,6,8):
    print("pon")
  else:
    print("hon")
 
    
main()

### FIXED CODE ###

import sys
 
def main():
  N = str(input())
  L = [0,1,6,8]
  n_last = int(N[-1])
  if n_last == 3:
    print("bon")
  elif (n_last in L):
    print("pon")
  else:
    print("hon")
 
    
main()
N, M = map(int, input().split())
r = [i for i in range(N+1)]
n = [0 for i in range(N+1)]
buf = []

def root(x):
  if x==r[x]:
    return x
  else:
    r[x] = root(r[x])
    return r[x]

def unite(x, y):
  rx = root(x)
  ry = root(y)
  if rx != ry:
    r[ry] = rx

for _ in range(M):
  a, b = map(int, input().split())
  unite(a, b)

for x in range(1, N+1):
  if r[x] != x and r[r[x]] != r[x]:
    _ = root(x)
  
  
for x in r[1:]:
  n[x] += 1
    
ans = max(n[1:])

print(ans)

### FIXED CODE ###

from collections import deque
 
N, M = map(int, input().split())
g = {i:set() for i in range(N)}
v = [-1 for i in range(N)]
for _ in range(M):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  g[a].add(b)
  g[b].add(a)
  
Q = deque()
ans = 0
for a in g:
  if v[a]==-1:
    v[a] = 1
    ans_tmp = 1
    Q.append(a)
    while len(Q)>0:
      na = Q.popleft()
      for nb in g[na]:
        if v[nb] == -1:
          v[nb] = 1
          ans_tmp += 1
          Q.append(nb)
    ans = max(ans, ans_tmp)
print(ans)
m = input()
print(f"{int(m[0])+int(m[1])+int(m[2])}", end="")

### FIXED CODE ###

m = input()
a = int(m[0]) + int(m[1]) + int(m[2])
print (a)
s=I().strip()
	arr=s.split("S")
	ans=0
	for i in arr:
		ans=max(ans,len(i))
	print(ans)

### FIXED CODE ###

import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10**6) 

I=sys.stdin.readline

 #s="abcdefghijklmnopqrstuvwxyz"

#
def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))
def mi():
	return map(int,I().strip().split())

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x





	

def main():
	s=I().strip()
	arr=s.split("S")
	ans=0
	for i in arr:
		ans=max(ans,len(i))
	print(ans)

	













	
	
	






		







		
		
	
		

	







		









if __name__ == '__main__':
	main()
N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N-1):
    A,B=map(int,input().split())
    edges[A-1].append(B-1)
    edges[B-1].append(A-1)
prevs=[0]*N
def dfs(prev,curr):
    prevs[curr]=prev
    if curr == N-1:
        return
    for c in edges[curr]:
        if c!=prev:
            dfs(curr,c)
dfs(-1,0)
paths=[N-1]
tmp=N-1
while tmp!=0:
    paths.append(prevs[tmp])
    tmp=prevs[tmp]

points=[0,0]
def count(prev,curr,player):
    points[player]+=1
    for c in edges[curr]:
        if c!=prev:
            count(curr,c,player)

nf = (len(paths)+1)//2
f,s = paths[nf-1],paths[nf]
count(s,f,0)
count(f,s,1)
pf,ps=points
print("Fennec" if pf>ps else "Snuke")


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N-1):
    A,B=map(int,input().split())
    edges[A-1].append(B-1)
    edges[B-1].append(A-1)
prevs=[0]*N
def dfs(prev,curr):
    prevs[curr]=prev
    if curr == N-1:
        return
    for c in edges[curr]:
        if c!=prev:
            dfs(curr,c)
dfs(-1,0)
paths=[N-1]
tmp=N-1
while tmp!=0:
    paths.append(prevs[tmp])
    tmp=prevs[tmp]
paths=paths[::-1]

points=[0,0]
def count(prev,curr,player):
    points[player]+=1
    for c in edges[curr]:
        if c!=prev:
            count(curr,c,player)

nf = (len(paths)+1)//2
f,s = paths[nf-1],paths[nf]
count(s,f,0)
count(f,s,1)
pf,ps=points
print("Fennec" if pf>ps else "Snuke")
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) (int i=a;i<n;i++)
#define per(i,a,n,s) (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define vecin(x) for(auto&youso_: (x) ) cin >>  youso_
#define vecout(x) for(auto&youso_: (x) ) cout << youso_ << " " ; cout << endl
template<class T>inline bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
const int inf = 1e9+10;
const int mod = 1e9+7;
const long long llinf = 1e18;
#define _GLIBCXX_DEBUG
// head

int main(){
    int r;
    cin >> r;
    cout << 3*r*r << endl;
}

### FIXED CODE ###

r = int(input())
print(r*r*3)
def solve(s):

    dic = {}
    ll = 'qwertasdfgzxcvb'
    rr = 'yuiophjklnm'

    for l_i in list(ll):
        dic[l_i] = -1

    for r_i in list(rr):
        dic[r_i] = 1

    ans = 0
    prev = 0

    for s_i in s:
        current = dic[s_i]
        if current != prev:
            if abs(current - prev) == 2:
                ans += 1

        prev = current

    return ans


while 1:
    s = input()
    if s == '#':
        break

    print(solve(s))

### FIXED CODE ###



def solve(s):

    dic = {}
    ll = 'qwertasdfgzxcvb'
    rr = 'yuiophjklnm'

    for l_i in list(ll):
        dic[l_i] = -1

    for r_i in list(rr):
        dic[r_i] = 1

    ans = 0
    prev = 0

    for s_i in s:
        current = dic[s_i]
        if current != prev:
            if abs(current - prev) == 2:
                ans += 1

        prev = current

    return ans


while 1:
    s = raw_input()
    if s == '#':
        break

    print(solve(s))
x1,y1,x2,y2=map(int, input().split())
print(((x1-x2)**2+(y1-y2)**2)**0.5)

### FIXED CODE ###

x1,y1,x2,y2=map(float, input().split())
print(((x1-x2)**2+(y1-y2)**2)**0.5)
x = int(input())
if X < 1200:
    print("ABC")
else:
    print("ARC")

### FIXED CODE ###

x = int(input())
if x < 1200:
    print("ABC")
else:
    print("ARC")
n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
b = [a[0]-1] + [a[i+1]-a[i]-2 for i in range(m-1)] + [n-a[m-1]-1]
c = [1,1]+[0]*(n-1)
for i in range(2,n+1):
  c[i] = c[i-1] + c[i-2]
ans = 1
for j in b:
  if j == -1:
    ans = 0
    break
  ans = ans * c[j] %1000000007
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
b = []
if a:
  b = [a[0]-1] + [a[i+1]-a[i]-2 for i in range(m-1)] + [n-a[m-1]-1]
c = [1,1]+[0]*(n-1)
for i in range(2,n+1):
  c[i] = c[i-1] + c[i-2]
ans = 1
if b:
  for j in b:
    if j == -1:
      ans = 0
      break
    ans = (ans * c[j]) %1000000007
else:
  ans = c[n] % 1000000007
print(ans)
# from math import factorial
from sys import exit
n,m,k = map(int, input().split())
if m == 1:
    if k == n-1:
        print(1)
    else:
        print(0)
    exit()
MOD = 998244353

ans = tmp = (m * (m-1) ** (n-1)) % MOD

for i in range(k):
    tmp *= (n-1-i)
    tmp %= MOD
    tmp *= pow((m-1) * (i+1), -1, MOD)
    ans += tmp
    ans %= MOD

print(ans)

### FIXED CODE ###

# from math import factorial
from sys import exit
n,m,k = map(int, input().split())
if m == 1:
    if k == n-1:
        print(1)
    else:
        print(0)
    exit()
MOD = 998244353

ans = tmp = (m * (m-1) ** (n-1)) % MOD

for i in range(k):
    tmp *= (n-1-i)
    tmp %= MOD
    tmp *= pow((m-1) * (i+1), -1, MOD)
    ans += tmp
    ans %= MOD

print(ans)
import sys
input = sys.stdin.readline
N = int(input())
X = input().strip()

if not '1' in X:
    for i in range(N):
        print(0)
    exit()

M = 2*10**5+ 1
pc = [0]*(M+2)
for i in range(1,M+2):
    j = i
    t = 0
    while i > 0:
        k = bin(i).count('1')
        i %= k
        t += 1
    pc[j] = t

X1 = X.count('1')
X0 = N - X1

Rp1 = []
Rm1 = []
Bp1 = []
Bm1 = []
for i, x in enumerate(list(X[::-1])):
    tp1 = pow(2,i,X1+1)
    tm1 = pow(2,i,X1-1)
    Bp1.append(tp1)
    Bm1.append(tm1)
    if x == '1':
        Rp1.append(tp1)
        Rm1.append(tm1)
    else:
        Rp1.append(0)
        Rm1.append(0)

basep1 = sum(Rp1)
basem1 = sum(Rm1)
Rp1 = Rp1[::-1]
Rm1 = Rm1[::-1]
Bp1 = Bp1[::-1]
Bm1 = Bm1[::-1]

#print("base",basep1)
#print("base",basem1)
for bp1,bm1,x in zip(Bp1,Bm1,X):
    if x == '1':
        t = basem1 - bm1
        MOD = X1 - 1
    else:
        t = basep1 + bp1
        MOD = X1 + 1

    #print("x",x,"t",t)
    #print(t % MOD,MOD)
    print(pc[t % MOD] + 1)




### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
X = input().strip()

def solve(N,X):
    if not '1' in X:
        for i in range(N):
            print(1)
        exit()

    def popcount(n):
        t = 0
        while n > 0:
            k = bin(n).count('1')
            n %= k
            t += 1
        return t

    X1 = X.count('1')

    Rp1 = []
    Rm1 = []
    Bp1 = []
    Bm1 = []

    for i, x in enumerate(list(X[::-1])):
        tp1 = pow(2,i,X1+1)
        if X1-1 > 0:
            tm1 = pow(2,i,X1-1)
        else:
            tm1 = 0
        Bp1.append(tp1)
        Bm1.append(tm1)
        if x == '1':
            Rp1.append(tp1)
            Rm1.append(tm1)
        else:
            Rp1.append(0)
            Rm1.append(0)

    basep1 = sum(Rp1) % (X1+1)
    if X1-1 > 0:
        basem1 = sum(Rm1) % (X1-1)
    else:
        basem1 = 0
    Rp1 = Rp1[::-1]
    Rm1 = Rm1[::-1]
    Bp1 = Bp1[::-1]
    Bm1 = Bm1[::-1]

    #print("base",basep1)
    #print("base",basem1)
    for bp1,bm1,x in zip(Bp1,Bm1,X):
        if x == '1':
            t = basem1 - bm1
            MOD = X1 - 1
            if MOD <= 0:
                print(0)
                continue
        else:
            t = basep1 + bp1
            MOD = X1 + 1
        #print("x",x,"t",t)
        #print(t % MOD,MOD)
        print(popcount(t % MOD) + 1)

solve(N,X)
A=int(input())
B=int(input())

print(A+B or A-B)

### FIXED CODE ###

a,op,b=input().split() #文字列
if op=='+':print(int(a)+int(b))
else:print(int(a)-int(b))
K=int(input())
A,B=map(int,input().split())
flag=False
a=0
while flag:
    
    for i in range(A,B,1):
        if i % K ==0:
            print("OK")
            a+=1
            flag=True
            break
        else:    

    if flag:
        break
        
if a==0:
  print("NG")
        

### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())
a=0    
for i in range(A,B+1):
    if i % K ==0:
       a=1
        
if a==0:
  print("NG")
    
else:
  print("OK")
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = []
for _ in range(n):
    B.append(input())

for b in B:
    for x in range(3):
        for y in range(3) :
            if a[x][y] == b:
                a[x][y] = 0

if A[0][0] * A[1][0] * A[2][0] == 0 or A[0][1] * A[1][1] * A[2][1] == 0 or A[0][2] * A[1][2] * A[2][2] == 0 or A[0][0] * A[0][1] * A[0][2] == 0 or A[1][0] * A[1][1] * A[1][2] == 0 or A[2][0] * A[2][1] * A[2][2] == 0 or A[0][0] * A[1][1] * A[2][2] == 0 or A[0][2] * A[1][1] * A[2][0] == 0:
    print("Yes")
else:
    print("No") 


### FIXED CODE ###

a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())
N=int(input())
L=[int(input()) for i in range(N)]
if a in L and b in L and c in L:
  print('Yes')
elif d in L and e in L and  f in L:
  print('Yes')
elif g in L and h in L and  i in L:
  print('Yes')
elif a in L and d in L and  g in L:
  print('Yes')
elif b in L and e in L and  h in L:
  print('Yes')
elif c in L and f in L and  i in L:
  print('Yes')
elif a in L and e in L and  i in L:
  print('Yes')
elif c in L and e in L and  g in L:
  print('Yes')
else:
  print('No')
n,k= list(map(int, input().split()))
s = input()


s = s[:n+1]
print( s[:k] + s[k].lower() + s[k+1:-1])


### FIXED CODE ###

n,k= list(map(int, input().split()))
s = input()
s = s[:n]
k -= 1


print(s[:k] + s[k].lower() + s[k+1:])
import sys
input = sys.stdin.readline
from  math import log

x = int(input())
eps = 1e-9
a = 1
while a**5 <= x:
    diff = a**5-x
    if diff < 0:
        diff = abs(diff)
        sign = True
    else:
        sign = False
    if abs(diff**0.2 - round(diff**0.2)) < eps:
        b = round(round(diff**0.2))
        if sign:
            b = -b
        break
    a += 1
print a,int(b)


### FIXED CODE ###

import sys
input = sys.stdin.readline

x = int(input())
eps = 1e-9
a = 1
while True:
    diff = a**5-x
    if diff < 0:
        diff = abs(diff)
        sign = True
    else:
        sign = False
    if abs(diff**0.2 - round(diff**0.2)) < eps:
        b = round(diff**0.2)
        if sign:
            b = -b
        break
    a += 1
print a,int(b)
N = int(input())
H = input().split()
for i in range(N):
    H[i] = int(H[i])

ochinchin = True
for i in range(N):
    if H[i+1]<H[i]:
        H[i] -= 1
        if H[i+1]<H[i]:
            ochinchin = False
            break

if ochinchin:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N = int(input())
H = []
H = input().split(" ")
for i in range(N):
    H[i] = int(H[i])-1

ochinchin = True
for i in range(1, N):
    if H[i] < H[i-1]:
        H[i] += 1
        if H[i] < H[i-1]:
            ochinchin = False
            break
            

if ochinchin:
    print("Yes")
else:
    print("No")
# -*- coding: utf-8 -*-
i = input()
n = len(i)
ans = 0
for j in range(n + 1):
  if j == n and j % 2:
    ans += int(i) - int(str(9) * (j - 1))
  elif j % 2 == 1:
    ans += 10 ** j - int(str(9) * (j - 1)) - 1
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
i = input()
n = len(i)
ans = 0
for j in range(n + 1):
  if j == n and j % 2 == 1 and j == 1:
    ans += int(i)
  elif j == n and j % 2 == 1:
    ans += int(i) - int(str(9) * (j - 1))
  elif j == 1:
    ans += 9
  elif j % 2 == 1:
    ans += 10 ** j - int(str(9) * (j - 1)) - 1
print(ans)
x = int(input())
y = int(input())
print(y/2+x)



### FIXED CODE ###

x,y= map(int,input().split())

print(int(y/2+x))
a, b = input().split()

if (a+b) %3 == 0:
    print("Possible")
elif a%3 == 0:
    print("Possible")
elif b%3 == 0:
    print("Possible")
else:
    print("Impossible")


### FIXED CODE ###

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

if (a+b)%3 == 0:
    print("Possible")
elif a%3 == 0:
    print("Possible")
elif b%3 == 0:
    print("Possible")
else:
    print("Impossible")
N = input()
A = input()
C = 0
C = N % 500
if C <= A;
   print(Yes)
else;
   print(No)

### FIXED CODE ###

N = int(input());
A = int(input());
C = 0;
C = N % 500;
if C <= A:
  print("Yes");  
else:
  print("No");
n, m = map(int, input().split())
a = list(map(int, input().split()))

def calc(n):
    ret = 0
    while n%2 == 0:
        ret +=1
        n/=2
    return ret
flag = True
t = 0
for i in range(n-1):
    t = 2**calc(a[i])
    if calc(a[i]) == calc(a[i+1]):
        continue
    else:
        flag = False
        print(0)
        exit()

a = [a[i]//t for i in range(n)]

def gcd(a, b):
    if a%b == 0:
        return b
    else:
        return gcd(b, a%b)

gcd_a = a[0]
for i in range(1,n):
    p = max(gcd_a, a[i])
    q = min(gcd_a, a[i])
    gcd_a = gcd_a*a[i]//gcd(p, q)

if flag:
    if (m//gcd_a)%2 == 0:
        print((m//gcd_a)//2)
    else:
        print((m//gcd_a+1)//2)

else:
    print(0)


### FIXED CODE ###

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

for i in range(n):
    a[i] = a[i]//2
    
# print(a)
def calc(n):
    ret = 0
    while n%2 == 0:
        ret +=1
        n//=2
    return ret


flag = True
t = 0
for i in range(n-1):
    t = 2**calc(a[i])
    if calc(a[i]) == calc(a[i+1]):
        # print(calc(a[i]),calc(a[i+1]))
        continue
    else:
        flag = False
        break


def gcd(a, b):
    if a%b == 0:
        return b
    else:
        return gcd(b, a%b)



if flag:
    lcm = 1
    for i in range(n):
        p = max(lcm, a[i])
        q = min(lcm, a[i])
        lcm = lcm*a[i]//gcd(p, q)
        # print(lcm)
    if (m//lcm)%2 == 0:
        print(int((m//lcm)//2))
    else:
        print(int((m//lcm+1)//2))

else:
    print(0)
flag = 1
keta,n = map(int,input().split())
sc = []
for i in range(n):
    sc.append(list(map(int,input().split())))

ans = [None]*n

for j in sc:
    if j[0] == 1 and j[1] == 0:
        flag = 0
    elif ans[j[0]-1] == None:
        ans[j[0]-1] = j[1]
    elif ans[j[0]-1] != j[1]:
        flag = 0
        
        
for k in range(len(ans)):
    if k == 0 and ans[0] == None:
        ans[0] = 1
    elif ans[k] == None:
        ans[k] = 0
            
ans_s = ""
for l in ans:
    ans_s += str(l)
    
if flag == 0:
    print("-1")        
else:
    print(ans_s)  

### FIXED CODE ###

flag = 1
keta,n = map(int,input().split())
sc = []
for i in range(n):
    sc.append(list(map(int,input().split())))

ans = [None]*keta

for j in sc:
    if j[0] == 1 and j[1] == 0 and keta != 1:
        flag = 0

    else:
        try:
            if ans[j[0]-1] == None:
                ans[j[0]-1] = j[1]
            elif ans[j[0]-1] != None and ans[j[0]-1] != j[1]:
                flag = 0
        except:
            flag = 0
        
        
for k in range(len(ans)):
    if k == 0 and ans[0] == None and keta != 1:
        ans[0] = 1
    elif ans[k] == None:
        ans[k] = 0
            
ans_s = ""
for l in ans:
    ans_s += str(l)
    
if flag == 0:
    print("-1")        
else:
    print(ans_s)
dic = {}
for key, a in zip(range(1, n+1), list(map(int,input().split()))):
    dic[key] = a
 
keynum = 0
log = [-1]*(n+1)
next = dic[1]
step = 1
log[next] = step
k -= 1
while k:
    next = dic[next]
    step += 1
    k -= 1
    if log[next] != -1:
        k %= log[next] - step
    else:
        log[next] = step
print(next)

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
dic = {}
for key, a in zip(range(1, n+1), a):
    dic[key] = a
 
log = [-1]*(n+1)
next = dic[1]
step = 1
log[next] = step
k -= 1
while k:
    next = dic[next]
    step += 1
    k -= 1
    if log[next] != -1:
        k %= log[next] - step
    else:
        log[next] = step
print(next)
import numpy as np
n,q = map(int,input().split())
s = input()
check = np.zeros(n)
for i in range(n):
    if s[i] == "A" and s[i+1] == "C":
        check[i] = 1
for i in range(q):
    l,r = map(int,input().split())
    cnt = 0
    for j in range(l-1,r-1):
        if check[j] == 1:
            cnt += 1
    print(cnt)

### FIXED CODE ###

n,q = map(int,input().split())
s = input()
li = [0]*n
for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        li[i+1] = li[i] + 1
    else:
        li[i+1] = li[i]
for i in range(q):
    l,r = map(int,input().split())
    print(li[r-1]-li[l-1])
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
A = [0]*N
if not(1 in a):
  A[0] = 1
if not(2 in a):
  A[1] = 1 + A[0]

for i in range(2,N):
    if i+1 in a:
      A[i] = 0
    else:
      A[i] = A[i-2] + A[i-1]
print(A[N-1] %1000000007)

### FIXED CODE ###

N,M = map(int,input().split())
a = set(int(input()) for x in range(M))
A = [0]*(N+1)
mod = 1000000007
A[0] = 1
if not(1 in a):
  A[1] = 1
for i in range(2,N+1):
    if i in a:
      A[i] = 0
    else:
      A[i] = (A[i-2] + A[i-1]) % mod
print(A[N])
a, b, c = [int(i) for i in input().split()]

if a*b < (c - a - b)*(c - a - b)/4 and 4*a*b - (c - a - b)*(c - a - b) < 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b, c = [int(i) for i in input().split()]

if c <= a + b:
    print("No")
elif 4*a*b < (c - a - b)*(c - a - b):
    print("Yes")
else:
    print("No")
P = int(input())
Q = int(input())
R = int(input())

X = min[P, Q, R]

print(P + Q + R - X)

### FIXED CODE ###

P, Q, R = map(int, input().split())
 
X = max([P, Q, R])
 
print(P + Q + R - X)
n,m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
keta = [-1] * n
if n == 1:
  for s,c in sc:
    ans = -1
    if ans == -1:
      ans = c
    else:
      print(-1)
      exit()
  print(ans)
else:
  for s,c in sc:
    s-=1
    if keta[s] == -1 or keta[s] == str(c):
      keta[s] = str(c)
    else:
      print(-1)
      exit()
  ans = ""
  for k,i in enumerate(keta):
    if i == -1:
      if k == 0:
        ans += "1"
      else:
        ans += "0"
    else:
      ans += i   
  if ans[0] == "0":
    print(-1)
    exit()
  else:
    print(ans)

### FIXED CODE ###

n,m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
keta = ["-1"] * n
if n == 1:
  ans = -1
  for s,c in sc:
    if ans == -1 or ans == c:
      ans = c
    else:
      print(-1)
      exit()
  if ans == -1:
    print(0)
  else:
    print(ans)
else:
  for s,c in sc:
    s-=1
    if keta[s] == "-1" or keta[s] == str(c):
      keta[s] = str(c)
    else:
      print(-1)
      exit()
  ans = ""
  for k,i in enumerate(keta):
    if i == "-1":
      if k == 0:
        ans += "1"
      else:
        ans += "0"
    else:
      ans += i   
  if ans[0] == "0":
    print(-1)
    exit()
  else:
    print(ans)
import math

def factorization(n):
    div = 2
    fct = []
    while div * div <= n:
        while n % div == 0:
            n //= div
            fct.append(div)
        div += 1
    if n > 1:
        fct.append(n)
    return fct

if __name__ == '__main__':
    A, B = map(int, input().split())
    gcd = math.gcd(A, B)
    if gcd == 1:
        print(1)
        exit()
    facts = set(factorization(gcd))
    print(len(facts) + 1)


### FIXED CODE ###

import math
import fractions
gcd = math.gcd if hasattr(math, "gcd") else fractions.gcd

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

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

g = gcd(A, B)

print(len(set(factorize(g)))+1)
from math import factorial as f
n,p,*a=map(int,open(0).read().split())
x=len([i for i in a if i%2])
y=n-x

xx=0
for i in range(p,x,2):
    xx+=f(x)//f(i)//f(x-i)

yy=0
for i in range(0,y):
    yy+=f(y)//f(i)//f(y-i)

if x>0 and y>0:
    print(xx*yy+xx*(p^0)+yy*(p^1))
elif x==0:
    print(yy(p^1))
else:
    print(xx)

### FIXED CODE ###

n,p,*a=map(int,open(0).read().split())
if len([i for i in a if i%2])==0:
    print(2**n*(p^1))
else:
    print(2**(n-1))
#from functools import lru_cache
import sys
from itertools import product,combinations,accumulate
from functools import reduce,lru_cache
import heapq

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

s = rvfunc(int)(reader())
n,k=s[0]
p=s[1]
c=s[2]

def pnt(i):
    out = []
    current=i
    for j in range(n):
        current=p[current-1]
        out.append(c[current-1])
    return out
def loc(i):
    out = []
    current=i
    for j in range(n):
        current=p[current-1]
        out.append(current)
    return out
    
def acc(i):    
    p,l=pnt(i),loc(i)
    sp = sum(p)
#    print(p,sp)
    init = l.index(i)
    pini = p[init:]+p[:init]
    last = p[(init+int((k-1)%n))%n]
    plst = p[:last]
    if k+1<n:
        return max(list(accumulate(pini[:k-1])))
    else:
        if sp<0:
            return max(list(accumulate(p)))
        else:
            return max(list(accumulate(p)))+sum(p[:last])+sp*int((k-1)/n)

print(max(vfunc(acc)(range(1,n+1))))


### FIXED CODE ###

import sys
from itertools import product,combinations
from functools import reduce,lru_cache
import heapq

def vfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:f(*x,**kwargs),*lst))

def rvfunc(f): return lambda *lst, **kwargs: list(map(lambda *x:rvfunc(f)(*x,**kwargs) if all(vfunc(lambda y:isinstance(y,list))(x)) else f(*x,**kwargs),*lst))

def reader():return vfunc(lambda l:l.split())(sys.stdin.readlines())

s=reader()

print(max(vfunc(len)(s[0][0].split('S'))))
s,w=[int(x) for x in input().splir()]

if(s>w):
  print("safe")
else:
  print("unsafe")

### FIXED CODE ###

s,w=[int(x) for x in input().split()]
 
if(s>w):
  print("safe")
else:
  print("unsafe")