Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import math
import heapq

N, M = map(int, input().split())
MAX = math.inf

nodes = [[] for i in range(N+1)]

for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    nodes[u].append(v)

S, T = map(int, input().split())
S -= 1
T -= 1

# init
d = [
    [math.inf for i in range(N)],
    [math.inf for i in range(N)],
    [math.inf for i in range(N)],
]
d[0][S] = 0
queue = []
heapq.heappush(queue, [0, 0, S])

while queue:
    p, m, n = heapq.heappop(queue)
    if m == 0 and n == T:
        print(int(p/3))
        quit()
    for to in nodes[n]:
        if d[(m+1) % 3][to] > d[m][n] + 1:
            d[(m+1) % 3][to] = d[m][n] + 1
            heapq.heappush(queue, [
                d[(m+1) % 3][to],
                (m+1) % 3,
                to
            ])

print(-1)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import heapq

N, M = map(int, input().split())
MAX = float("inf")

nodes = [[] for i in range(N+1)]

for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    nodes[u].append(v)

S, T = map(int, input().split())
S -= 1
T -= 1

# init
d = [
    [MAX for i in range(N)],
    [MAX for i in range(N)],
    [MAX for i in range(N)],
]
d[0][S] = 0
queue = []
heapq.heappush(queue, [0, 0, S])

while queue:
    p, m, n = heapq.heappop(queue)
    if m == 0 and n == T:
        print(int(p/3))
        quit()
    for to in nodes[n]:
        if d[(m+1) % 3][to] > d[m][n] + 1:
            d[(m+1) % 3][to] = d[m][n] + 1
            heapq.heappush(queue, [
                d[(m+1) % 3][to],
                (m+1) % 3,
                to
            ])

print(-1)
import bisect
a,b,q=map(int,input().split())
s=[]
t=[]
for i in range(a):
    s.append(int(input()))
for i in range(b):
    t.append(int(input()))
for i in range(q):
    x=int(input())
    si=bisect.bisect_left(s,x)
    ti=bisect.bisect_left(t,x)
    if si==a:
        sk=[s[a-1]]
    elif si==0:
        sk=[s[0]]
    else:
        sk=[s[si-1],s[si]]
    if ti==0:
        tk=[t[0]]
    else:
        tk=[t[ti-1],t[ti]]
    ans=1000000000000
    for f in sk:
        for g in tk:
            ans=min(ans,abs(x-f)+abs(f-g),abs(x-g)+abs(g-f))
print(ans)

### FIXED CODE ###

import bisect
a,b,q=map(int,input().split())
s=[]
t=[]
for i in range(a):
    s.append(int(input()))
for i in range(b):
    t.append(int(input()))
for i in range(q):
    x=int(input())
    si=bisect.bisect_left(s,x)
    ti=bisect.bisect_left(t,x)
    if si==a:
        sk=[s[a-1]]
    elif si==0:
        sk=[s[0]]
    else:
        sk=[s[si-1],s[si]]
    if ti==0:
        tk=[t[0]]
    elif ti==b:
        tk=[t[b-1]]
    else:
        tk=[t[ti-1],t[ti]]
    ans=1000000000000
    for f in sk:
        for g in tk:
            ans=min(ans,abs(x-f)+abs(f-g),abs(x-g)+abs(g-f))
    print(ans)
n = int(input())
a = input()
b = input()
c = input()
cnt2 = 0
cnt3 = 0
for i in range(n):
  nsame = len(set([a[i], b[i], c[i]])):
    if nsame == 2:
      cnt2 += 1
    elif nsame == 1:
      cnt3 += 1
ans = 2*n - cnt2 - 2*cnt3
print(ans)
    

### FIXED CODE ###

n = int(input())
a = input()
b = input()
c = input()
cnt2 = 0
cnt3 = 0
for i in range(n):
  nsame = len(set([a[i], b[i], c[i]]))
  if nsame == 2:
    cnt2 += 1
  elif nsame == 1:
    cnt3 += 1
ans = 2*n - cnt2 - 2*cnt3
print(ans)
"""
author : halo2halo
date : 13,Nov,2019
"""

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

print(3*int(read()**2))


### FIXED CODE ###

"""
author : halo2halo
date : 13,Nov,2019
"""

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

print(3*int(read())**2)
n,a,b = map(int,input().split())
m = 10**9+7

def nCr(n_, r_, m_):
  c = min(r_ , n_ - r_)
  bunshi = 1
  bunbo = 1
  for i in range(1,c+1):
    bunshi = bunchi * (n_+1-i) % m_
    bunbo = bunbo * i % m_
  return bunshi * pow(bunbo, m_-2, m_) % m_


ans = pow(2,n,m)-1
ans -= nCr(n,a,m)
ans %= m
ans -= nCr(n,b,m)
ans %= m
print(ans)

### FIXED CODE ###

n,a,b = map(int,input().split())
m = 10**9+7

def nCr(n_, r_, m_):
  c = min(r_ , n_ - r_)
  bunshi = 1
  bunbo = 1
  for i in range(1,c+1):
    bunshi = bunshi * (n_+1-i) % m_
    bunbo = bunbo * i % m_
  return bunshi * pow(bunbo, m_-2, m_) % m_


ans = pow(2,n,m)-1
ans -= nCr(n,a,m)
ans %= m
ans -= nCr(n,b,m)
ans %= m
print(ans)
import math
x=int(input())
y= math.sqrt(x)
z= y//1
print(int(z)

### FIXED CODE ###

import math
x=int(input())
y= math.sqrt(x)
z= y//1
a=z**2
print(int(a))
n = input()

def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]

   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))

   print m[0][len(n)-1]

for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)

### FIXED CODE ###

n = input()
M = []
 
def scalar(n):
   m = [[0 for i in range(len(n))] for j in range(len(n))]
 
   for l in range(2, len(n)+1):
      for i in range(0, len(n)-l+1):
         j = i + l - 1
         m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j))
 
   print m[0][len(n)-1]
 
for i in range(n):
   M.append(map(int, raw_input().split()))
scalar(M)
N = int(input())
A = list(map(int, input().split()))
MOD = 10 **9 + 7
 
ni = [0 for _ in range(60)]
for i in range(N):
    tmp = A[i]
    count = 0
    while(True):
        if tmp % 2 == 1:
            ni[count] += 1
        count += 1
        tmp = tmp // 2
        if tmp == 0:
            break
ans = 0
for j in range(60):
    ans += (ni[j] * (N-ni[j])) * 2 ** j 
 
print(ans%MOD)

### FIXED CODE ###

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

if a+b+c>=22:
    print("bust")
else:
    print("win")
n = "keyence"
s = input()
cnt = 0


for i in s:
    if n[0] == i:
        n = n[1:]
        if cnt > 0:
            cnt = -1
    elif n[0] != i:
        if cnt == -1:
            break
        cnt += 1

if n == "":
    print("YES")
else:
    print("NO")

### FIXED CODE ###

n = "keyence"
s = input()

for i in s:
    if n[0] == i: #文字が一致するなら
        n = n[1:] #比較中の文字を削る
    else:
        break

n = n[::-1]

for i in s[::-1]:
    if n == "":
        break
    elif n[0] == i:
        n = n[1:]
    else:
        break

if n == "":
    print("YES")
else:
    print("NO")
N=int(input())
if N[-1] = 2 :
    print("hon")
elif N[-1] = 4 :
    print("hon")
elif N[-1] = 5 :
    print("hon")
elif N[-1] = 7 :
    print("hon")
elif N[-1] = 9 :
    print("hon")
elif N[-1] = 1 :
    print("pon")
elif N[-1] = 6 :
    print("pon")
elif N[-1] = 8 :
    print("pon")
else :
    print("bon")

### FIXED CODE ###

N=input()
if N[-1] == '2' :
    print("hon")
elif N[-1] == '4' :
    print("hon")
elif N[-1] == '5' :
    print("hon")
elif N[-1] == '7' :
    print("hon")
elif N[-1] == '9' :
    print("hon")
elif N[-1] == '0' :
    print("pon")
elif N[-1] == '1' :
    print("pon")
elif N[-1] == '6' :
    print("pon")
elif N[-1] == '8' :
    print("pon")
else :
    print("bon")
n, m = map(int, input().split())
lst = list(map(int, input().split()))
lst = sorted(lst, key = lambda x:-x)
dic = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

s = set()
for i in lst:
    s.add(dic[i])
s = list(sorted(s))

dp = [0] * (n+1)
for i in range(0, n+1):
    a = 0
    max_a = 0
    for j in s:
        if i == j and dp[i-j] == 0:
            a = 1
        elif i - j >= 0 and dp[i-j] > 0:
            a = dp[i-j] + 1
        if max_a < a:
            max_a = a
    dp[i] = max_a

def out(dp, dic, n, ans, ans_digit, lst):
    if len(ans) == ans_digit-1:
        for i in lst:
            if n == dic[i]:
                return ans + str(i)
    else:
        for i in lst:
            if n - dic[i] >= 0:
                if dp[n] -1 == dp[n-dic[i]]:
                    ans += str(i)
                    next_n = n - dic[i]
                    break
        return out(dp, dic, next_n, ans, ans_digit, lst)
    
print(out(dp, dic, n, '', dp[n], lst))

### FIXED CODE ###

n, m = map(int, input().split())
lst = list(map(int, input().split()))
lst = sorted(lst, key = lambda x:-x)
dic = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

s = set()
for i in lst:
    s.add(dic[i])
s = list(sorted(s))

dp = [0] * (n+1)
for i in range(0, n+1):
    a = 0
    max_a = 0
    for j in s:
        if i-j < 0:
            pass
        elif i == j:
            a = 1
        elif i - j > 0 and dp[i-j] > 0:
            a = dp[i-j] + 1
        if max_a < a:
            max_a = a
    dp[i] = max_a

ans = ''
ans_digit = dp[n]
while len(ans) < ans_digit:
    if len(ans) == ans_digit-1:
        for i in lst:
            if n == dic[i]:
                ans += str(i)
                break
    else:
        for i in lst:
            if n - dic[i] >= 0:
                if dp[n] -1 == dp[n-dic[i]]:
                    ans += str(i)
                    n -= dic[i]
                    break
    
print(ans)
H, N = map(int, input().split())
A = sorted(list(map(int, input().split())))

if H < A[-1] + A[-2]:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

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

if H <= A:
    print('Yes')
else:
    print('No')
n = int(input())
a = [int(input()) for i in range(n)]
b = [int(input()) for i in range(n)]
c = [int(input()) for i in range(n-1)]

ans = sum(b)
for i in range(1,n):
    if a[i]-1==a[i-1]:
        ans+=c[i-1]
print(ans)

### FIXED CODE ###

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

m=0
for i in range(n-1):
  if a[i+1]==a[i]+1:
    m=m+c[a[i]-1]

print(sum(b)+m)
n, quantum = [int(i) for i in input().split()]
processes = []
for i in range(n):
    processes.append(input())
for i in range(n):
    processes[i].split()
head, tail = 0, len(processes)


def enqueue(x):
    global processes, tail
    processes.append(0)
    processes[tail] = x
    tail += 1


def dequeue():
    global head
    head += 1


for i in range(n):
    int(processes[i][1])

time, count = 0, 0
while count < n:
    y = processes[head][1] - quantum
    if y < 0:
        print(str(processes[head][0]) + " " + str(time + processes[head][1]))
        dequeue()
        time += y
        count += 1
    else:
        processes[head][1] -= quantum
        enqueue(processes[head])
        dequeue()

    time += quantum



### FIXED CODE ###

def parse(l):
    name, time = l.split()
    a = [name, int(time)]
    return a


n, quantum = map(int, input().split())
queue = []
for i in range(n):
    queue.append(parse(input()))
head = 0


def enqueue(x):
    global queue
    queue.append(x)


def dequeue():
    global head
    head += 1


total_time, count = 0, 0
while count < n:
    y = queue[head][1] - quantum
    if y <= 0:
        print(str(queue[head][0]) + " " + str(total_time + queue[head][1]))
        dequeue()
        total_time += y
        count += 1
    else:
        queue[head][1] -= quantum
        enqueue(queue[head])
        dequeue()

    total_time += quantum
import sys
#sys.setrecursionlimit(10 ** 7)

dct = {"#": 0, ".": 1, "-": 2}


def f(c):
    return dct[c]


h, w = map(int, input().split())
s = [[2] * (w + 2)]
for _ in range(h):
    s.append([2] + list(map(f, input())) + [2])
s.append([2] * (w + 2))

d = [(-1, 0), (1, 0), (0, -1), (0, 1)]


def dfs(col, hh, ww):
    if s[hh][ww] != col:
        return

    cnt[col] += 1
    s[hh][ww] = 2

    for dh, dw in d:
        nh = hh + dh
        nw = ww + dw
        dfs(1-col, nh, nw)


ans = 0
for hi in range(1, h + 1):
    for wi in range(1, w + 1):
        cnt = [0, 0]
        if s[hi][wi] != 2:
            dfs(s[hi][wi], hi, wi)
        ans += cnt[0] * cnt[1]

print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

dct = {"#": 0, ".": 1, "-": 2}


def f(c):
    return dct[c]


h, w = map(int, input().split())
s = [[2] * (w + 2)]
for _ in range(h):
    s.append([2] + list(map(f, input())) + [2])
s.append([2] * (w + 2))

d = [(-1, 0), (1, 0), (0, -1), (0, 1)]


def dfs(col, hh, ww):
    if s[hh][ww] != col:
        return

    cnt[col] += 1
    s[hh][ww] = 2

    for dh, dw in d:
        nh = hh + dh
        nw = ww + dw
        dfs(1-col, nh, nw)


ans = 0
for hi in range(1, h + 1):
    for wi in range(1, w + 1):
        cnt = [0, 0]
        if s[hi][wi] != 2:
            dfs(s[hi][wi], hi, wi)
        ans += cnt[0] * cnt[1]

print(ans)
str=input()
a=0

if str[0]==1:
  a++
  
if str[1]==1:
  a++
  
if str[2]==1:
  a++
  
print(a)


### FIXED CODE ###

num=input()
a=0
 
if int(num[0])==1:
  a+=1
  
if int(num[1])==1:
  a+=1
  
if int(num[2])==1:
  a+=1
  
print(a)
n, k = map(int, input().split())
s = input()
s += '0'
s = '0' + s

t = []
accum_mode = False
l = r = 0

for i in range(1, n + 1):
    if s[i - 1] == '0' and s[i] == '1':
        l = i
    if s[i] == '1' and s[i + 1] == '0':
        r = i
        t.append((l, r))

res = 0

if k < len(t):
    for i in range(len(t) - k):
        tmp = t[i + k][1] - t[i][0]
        res = max(res, tmp)
    if t[0][0] != 1:
        tmp = t[k - 1][1]
        res = max(res, tmp)
else:
    for i in range(len(t)):
        res = t[-1][1] - t[0][0]
    if t[0][0] != 1:
        tmp = t[min(k, len(t))-1][1]
        res = max(res, tmp)

print(res)

### FIXED CODE ###

n, k = map(int, input().split())
s = input()
s += '0'
s = '0' + s

t = []
l = r = 0

for i in range(1, n + 1):
    if s[i - 1] == '0' and s[i] == '1':
        l = i
    if s[i] == '1' and s[i + 1] == '0':
        r = i
        t.append((l, r))

if len(t) > 0:
    res = 0

    if k < len(t):
        for i in range(len(t) - k):
            tmp = t[i + k][1] - t[i][0]
            res = max(res, tmp)
        if t[0][0] != 1:
            tmp = t[k - 1][1] - 1
            res = max(res, tmp)
        if t[-1][1] != n:
            tmp = n - t[-k][0]
            res = max(res, tmp)
    else:
        for i in range(len(t)):
            res = t[-1][1] - t[0][0]
        if t[0][0] != 1:
            tmp = t[min(k, len(t))-1][1] - 1
            res = max(res, tmp)
        if t[-1][1] != n:
            tmp = n - t[-min(k,len(t))][0]
            res = max(res, tmp)

    print(res + 1)
else:
    print(n)
s=intput()
s[3]='8'
print(s)

### FIXED CODE ###

s=list(input())
s[3]='8'
print("".join(s))
a, b, c, k = map(int, input().split())
a, b, c, k = map(int, input().split())
j = k-(a+b)
j = 0 if j < 0 else j
print(a-j if k > a else k)

### FIXED CODE ###

a, b, c, k = map(int, input().split())
j = k-(a+b)
j = 0 if j < 0 else j
print(a-j if k > a else k)
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

cnt = [-1] * n
ans = -1
cnt_sc = [-1] * n
for i in sc:
    cnt_sc[i[0] - 1] = 1

for i in range(n):
    if cnt_sc[i] == -1:
        if i == 0:
            sc.append([i+1, 1])
        else:
            sc.append([i+1, 0])

for i in range(1000):
    if sum(cnt) == 0:
        break
    lst = []
    tmp = i
    while i > 0:
        lst.append(i % 10)
        i //= 10
    lst.reverse()

    cnt = [-1]*m
    if len(lst) != n:
        continue
    for j in sc:
        if lst[j[0] - 1] == j[1]:
            cnt[j[0] - 1] = 0
    ans = tmp

print(ans)


### FIXED CODE ###

import sys
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

ans = [-1] * n
for i in sc:
    s, c = i
    if (ans[s-1] == c) | (ans[s-1] == -1):
        ans[s-1] = c
    else:
        print(-1)
        sys.exit()

for i in range(n):
    if ans[i] == -1:
        if (i == 0) & (n != 1):
            ans[i] = 1
        else:
            ans[i] = 0

if n != 1:
    if ans[0] == 0:
        print(-1)
        sys.exit()

print(*ans, sep='')
from functools import reduce
from math import gcd
input()
aa=list(map(int,input().split()))
lcm=reduce((lambda a,b:a*b//gcd(a,b)),aa)
m=lcm-1
print(sum(m%a for a in aa))

### FIXED CODE ###

from functools import reduce
from fractions import gcd
input()
aa=list(map(int,input().split()))
lcm=reduce((lambda a,b:a*b//gcd(a,b)),aa)
m=lcm-1
print(sum(m%a for a in aa))
# -*- coding: utf-8 -*-

S = input()
n = len(S)
T = []

for i in range(len(S)-1):
    if S[i] != S[i+1]:
        t = max(i+1, n-i-1)
        T.append(t)
print(min(T))


### FIXED CODE ###

# -*- coding: utf-8 -*-

S = input()
n = len(S)
T = []

for i in range(len(S)-1):
    if S[i] != S[i+1]:
        t = max(i+1, n-i-1)
        T.append(t)
if len(T) == 0:
    print(n)
else:
    print(min(T))
r = int(input())
g = int(input())

print(2g - r)


### FIXED CODE ###

r = int(input())
g = int(input())

print(2*g - r)
l  = [int(x) for x in input().split()]
a, b = l[0], l[1]
if a <= b:
    print(int(str(b)*a))
else:
    print(int(str(a)*b))

### FIXED CODE ###

l  = [int(x) for x in input().split()]
if l[0]==l[1]:
    print('Yes')
else:
    print('No')
import itertools

x = int(input())
n = 100
table = [pow(i, 5) for i in range(-n, n+1)]
choices = list(itertools.product([i for i in range(len(table))], repeat=2))

for choice in choices:
    left = choice[0]
    right = choice[1]
    if table[left] - table[right] == x:
        if left == n:
            ans_left = 0
        elif left < n:
            ans_left = left - n
        else:
            ans_left = left % n
            
        if right == n:
            ans_right = 0
        elif right < n:
            ans_right = right - n
        else:
            ans_right = right % n
        break

print(ans_left, ans_right)

### FIXED CODE ###

import itertools

x = int(input())
n = 200
table = [pow(i, 5) for i in range(-n, n+1)]
choices = list(itertools.product([i for i in range(len(table))], repeat=2))

for choice in choices:
    left = choice[0]
    right = choice[1]
    if table[left] - table[right] == x:
        if left == n:
            ans_left = 0
        elif left < n:
            ans_left = left - n
        else:
            ans_left = left % n
            
        if right == n:
            ans_right = 0
        elif right < n:
            ans_right = right - n
        else:
            ans_right = right % n
        break

print(ans_left, ans_right)
import collections
import math
def calculateProb(counts):
    ways = 0
    for key in counts.keys():
        if counts[key] < 2:
            continue
        if counts[key] in cache:
            ways += cache[counts[key]]
        else:
            val = counts[key]
            cache[val] = math.factorial(val)/math.factorial(2)/math.factorial(val - 2)
            ways += cache[val]
    return ways

def getfact(val):
    if val < 2:
        return 0
    return math.factorial(val)/math.factorial(2)/math.factorial(val - 2)


n = int(input())

values = list(map(int, input().split(' ')))
counts = collections.Counter(values)

cache = {}
ways = calculateProb(counts)
for k in range(n):
    curVal = values[k]
    count = counts[curVal]
    temp = ways
    ways = ways - getfact(count)  + getfact(count - 1)
    print(int(ways))
    ways = temp

### FIXED CODE ###

import collections
import math
def calculateProb(counts):
    ways = 0
    for key in counts.keys():
        if counts[key] < 2:
            continue
        else:
            val = counts[key]
            ret = val*(val-1)/2
            ways += ret
    return ways

def getfact(val):
    if val < 2:
        return 0
    return val*(val-1)/2


n = int(input())

values = list(map(int, input().split(' ')))
counts = collections.Counter(values)

ways = calculateProb(counts)
for k in range(n):
    curVal = values[k]
    count = counts[curVal]
    temp = ways
    ways = ways - getfact(count)  + getfact(count - 1)
    print(int(ways))
    ways = temp
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def solve():

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

    
    return lcm(A,B)
print(solve())


### FIXED CODE ###


import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
def solve():

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

    
    return lcm(A,B)
print(solve())
s,t = list(input().split())
if s in t:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = input()
t = input()
if s == t[:-1]:
    print('Yes')
else:
    print('No')
import sys
input = sys.stdin.readline
from collections import deque
def main():
    N, M = map(int, input().split())
    A = deque([int(input()) for i in range(M)])
    dp = [0]*N
    # 一段目と二段目への行き方
    dp[0] = 1
    dp[1] = 2
    out = A.popleft()
    for i in range(2,N):
        if i+1 == out:
            dp[i] = 0
            if len(A) != 0:
                out = A.popleft()
        else:
            if dp[i-2] != 0 or dp[i-1] != 0:
                dp[i] = dp[i-2] + dp[i-1]
    if dp[N-1] != 0:
        print(dp[N-1]%(10**9 + 7))
    else:
        print(0)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque
def main():
    N, M = map(int, input().split())
    A = deque([int(input()) for i in range(M)])
    if N == 1:
        print(1)
    else:
        dp = [0]*N
        # 一段目と二段目への行き方
        if len(A) != 0:
            out = A.popleft() 
        else:
            out = 0

        if out != 1:
            dp[0] = 1
        else:
            dp[0] = 0
            if len(A) != 0:
                out = A.popleft()
        if out != 2:
            dp[1] = 1+dp[0]
        else:
            dp[1] = 0
            if len(A) != 0:
                out = A.popleft()

        for i in range(2,N):
            if i+1 == out:
                dp[i] = 0
                if len(A) != 0:
                    out = A.popleft()
            else:
                if dp[i-2] != 0 or dp[i-1] != 0:
                    dp[i] = dp[i-2] + dp[i-1]

        if dp[N-1] != 0:
            print(dp[N-1]%(10**9 + 7))
        else:
            print(0)
    
if __name__ == '__main__':
    main()
n,k=map(int,input().split())
s=list(input())

RL=0
LR=0

fo=0

if n<3:
  if n==1:
    print(0)
  else:
    print(1)
    
else:
  for i in range(n):
    if s[i]=='R' and i<n-1:
      if s[i+1]=='R':
        fo+=1
    if s[i]=='L' and 0<i:
      if s[i-1]=='L':
        fo+=1
        
    if i<n-1:
      if s[i]=='R' and s[i+1]=='L':
        RL+=1
      elif s[i]=='L' and s[i+1]=='R':
        LR+=1
        
  si=min(k,RL,LR)
  no=k-si
  LR_rest=LR-si
  RL_rest=RL-si
  if no==0:
    ans=fo+si*2
  else:
    ans=fo+si*2
    if s[0]=='L':
      if LR_rest>0:
        ans+=1
        LR_rest-=1
        no-=1
    if no>0:
      if s[-1]=='R':
        if LR_rest>0:
          ans+=1
  print(ans)
      
        
        


### FIXED CODE ###

n=int(input())
print(n**3)
S = input()
K = int(input())
if (S.count('1') == len(S)):
  print('1')
else:
  p = 0
  while (S[p] == S[p+1] == '1'):
    p += 1
if (p+1 >= K):
  print('1')
else:
  if (p == 0):
    if (S[0] == '1'):
      print(S[1])
    else:
      print(S[0])
  else:
    print(S[p+1])

### FIXED CODE ###

S = input()
K = int(input())
for i in range(K):
  if (int(S[i]) != 1):
    print(S[i])
    exit()
print(1)