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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n,k= map(int, io().split())
	s=[int(i) for i in io()[:n]]
	init=s[0]
	ll=[]
	m=0
	pre=init
	for c in s:
		if c == pre:
			m+=1
		else:
			ll.append(m)
			m=1
			pre=c
	ll.append(m)
	
	#print(ll)
	off= 1 if init==1 else 0
	if len(ll)<=2*k + off:
		return n
	pre=sum(ll[:2*k+off])
	rr_max=pre
	for i in range(len(ll)//2 - k):
		cc=pre - ll[2*i] - ll[2*i+1] + ll[2*(k+i)+off]+ll[2*(k+i)+1+off]
		rr_max = max(rr_max, cc)
		pre=cc
	return rr_max


#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

### FIXED CODE ###

import sys
bbn=1000000007
	
#+++++
		
def main2():
	n, k = map(int, input().split())
	sl = input()
	dd=[]
	ddv=[]
	left= sl[0]
	count=0
	pre=left
	for c in sl:
		if c == pre:
			count+=1
		else:
			dd.append(count)
			ddv.append(pre)
			pre=c
			count=1
	dd.append(count)
	ddv.append(pre)
	
	pa(ddv)
	if k == 0:
		return max([v for v,c in zip(dd,ddv) if c == '1'])
	
	ll=[]
	for i,c in zip(dd,ddv):
		if c == '0':
			pass
			
def main():
	n, k = map(int, input().split())
	sl = input()
	al=[]
	if sl[0]=='0':
		al.append(0)
	p=sl[0]
	count=1
	for c in sl[1:]:
		if c == p:
			count+=1
		else:
			al.append(count)
			count=1
			p=c
	else:
		al.append(count)
		if sl[-1]=='0':
			al.append(0)
			
	#pa(al)
	
	if 2*k+1 >= len(al):
		print(n)
		return 
	
	ret = al[0]
	for i in range(k):
		ret += al[2*i+1]
		ret += al[2*i+2]
	#pa(ret)
	rs=ret
	for i in range(k, (len(al)//2)):
		rs += al[2*i+1]
		rs += al[2*i+2]
		rs -= al[2*(i-k)+1]
		rs -= al[2*(i-k)]
		ret = max(rs, ret)
		#pa(rs)
	print(ret)
		
			
			
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
#ifndef DEBUG 
	#pragma GCC optimize ("Ofast")
#endif
#include <bits/stdc++.h>
using namespace std;

#define hfor(var, s, e) for(int var=s; int(s)<=var && var<int(e); ++var)//half-opened range
#define hfori(var, s, e) for(int var=e-1; int(s)<=var && var<int(e); --var)//inversion
#define hforo(var, s, e) int var=s; for(; int(s)<=var && var<int(e); ++var)//out declaration
#define hforoi(var, s, e) int var=e-1; for(; int(s)<=var && var<int(e); --var)
#define cfor(var, s, e) hfor(var, s, (e)+1)//closed range
#define cfori(var, s, e) hfori(var, s, (e)+1)
#define cforo(var, s, e) hforo(var, s, (e)+1)
#define cforoi(var, s, e) hforoi(var, s, (e)+1)
#define rep(x) hfor(repi,0,x)
#define all(x) x.begin(),x.end()
#define sum_in(s,e) accumulate(s,e,0ll)
#define mri(it) make_reverse_iterator(it)//*mri(it) == *prev(it)
#define gcd __gcd
template<typename C, typename RI> RI rerase(C& c, RI ri){return next(mri(c.erase(prev(ri.base()))));}
template<typename T> constexpr T inf() { return numeric_limits<T>::max() / 2; }
using f64 = double;using i64=long long;using u64=unsigned long long;
const f64 pi=acos(-1), eps=1e-12;
const int prime=998244353;//1073741783 int(2e9+11) int(1e9+9)
const int mod=int(1e9+7);

auto _dummy=(ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),
(cout<<fixed<<setprecision(11)), srand((int)time(0)), 0);
#define endl '\n'//not interactive?
#define int i64//overflow?

int n, k;
vector<int> g[100000];
bool vis[100000];

int f(int v, int p){
	vis[v]=true;
	
	int s=0;
	if(p>=0)
		for(auto i:g[p])
			s+=vis[i];
	int ret=max(k-s, 0ll);
	for(auto i:g[v])
		if(i!=p)
			ret=(ret*f(i,v))%mod;
	return ret;
}

signed main(){
	cin>>n>>k;
	hfor(i,0,n-1){
		int a,b;
		cin>>a>>b;
		a--,b--;
		g[a].push_back(b), g[b].push_back(a);
	}
	cout<<f(0,-1)<<endl;
	
	return 0;
}

/*mod=int(1e9+7)
n,k=map(int,input().split())
g=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  a-=1; b-=1
  g[a].append(b); g[b].append(a);
 
dp=[-1 for x in range(n)]
def f(v,p):
  if dp[v]!=-1:
    return dp[v]
  dp[v]=0

  s=0
  if p>=0:
    for i in g[p]:
      s += 1 if dp[i]!=-1 else 0
 
  dp[v]=max(k-s,0)
  for i in g[v]:
    if i!=p:
      dp[v]=(dp[v]*f(i,v))%mod
  return dp[v]
 
print(f(0,-1))*/


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)

mod=int(1e9+7)
n,k=map(int,input().split())
g=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(int,input().split())
  a-=1; b-=1
  g[a].append(b); g[b].append(a);
 
dp=[-1 for x in range(n)]
def f(v,p):
  if dp[v]!=-1:
    return dp[v]

  dp[v]=1
  j=1+int(v!=0)
  for i in g[v]:
    if i!=p:
      dp[v]=(dp[v]*f(i,v)*max(k-j,0))%mod
      j+=1
  return dp[v]
 
print(f(0,-1)*k%mod)
print("a=")
a = int(input())

print("b=")

b= int(input())

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


### FIXED CODE ###

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


if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")
n,a,b,c,d = map(int,input().split())
s = input()
cant = 0
sanrenzoku = 0
for i in range(a,d):
    if s[i] == "#":
        if s[i+1] == "#":
            cant = 1
    if c > d:
        if s[i] == ".":
            if s[i+1] == ".":
                if s[i+2] == ".":
                    if i > b-2:
                        if i < d:
                            sanrenzoku = 1

if cant == 1:
    print("No")
elif c > d:
    if sanrenzoku == 0:
        print("No")
    else:
        print("Yes")
else:
    print("Yes")

### FIXED CODE ###


n,a,b,c,d = map(int,input().split())
s = input()
s = s + "."
cant = 0
sanrenzoku = 0
for i in range(a-1,max(c-1,d-1)):
    if s[i] == "#":
        if s[i+1] == "#":
            cant = 1

if c > d:
    for i in range(b-2,d-1):
        if s[i] == ".":
            if s[i+1] == ".":
                if s[i+2] == ".":
                   sanrenzoku = 1

if cant == 1:
    print("No")
elif c > d:
    if sanrenzoku == 0:
        print("No")
    else:
        print("Yes")
else:
    print("Yes")
n, a, b = map(int, input().split())

if (b-a) % 2 == 0:
    ans = (b-a)/2
else:
    if (a-1) < (n-b):
        ans = a+((b-a-1)/2)
    elif (a-1) == (n-b):
        ans = n/2
    else:
        ans = n-b+1+((b-a-1)/2)

print(int(ans))


### FIXED CODE ###

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

if (b-a) % 2 == 0:
    ans = (b-a)//2
else:
    if (a-1) < (n-b):
        ans = a+((b-a-1)//2)
    elif (a-1) == (n-b):
        ans = n/2
    else:
        ans = n-b+1+((b-a-1)//2)

print(int(ans))
while 1:
    n,k = [int(i) for i in input().split()]
    if not n and k:
        break
    a = [int(input()) for i in range(n)]
    b = [0]*len(a)

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

    c = [b[i + k - 1] - b[i - 1] for i in range(n - k + 1)]

    print(max(c))


### FIXED CODE ###

while 1:
    n,k = [int(i) for i in input().split()]
    if not (n and k):
        break
    a = [int(input()) for i in range(n)]
    b = [0]*len(a)

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

    c = [b[i + k - 1] - b[i - 1] for i in range(n - k + 1)]

    print(max(c))
n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#?????????????????????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
for i in range(0,n):
    print(" ".join(map(str, C[i][:])))

### FIXED CODE ###

n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(l)] for j in range(n)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
    #A.append([int(i) for i in input().split()])
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)
    #B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
diff = [a[i]-b[i] for i in range(n)]
if sum(diff) < 0:
  print(-1)
else:
  diff.sort()
  count = 0
  ans = 0
  for i in diff:
    if i<0:
      count += i
      ans += 1
    else:
      break
  for i in diff[::-1]:
    if count>=0:
      break
    else:
      count += i
      ans += 1
print(ans)
  

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
diff = [a[i]-b[i] for i in range(n)]
if sum(diff) < 0:
  print(-1)
else:
  diff.sort()
  count = 0
  ans = 0
  for i in diff:
    if i<0:
      count += i
      ans += 1
    else:
      break
  for i in diff[::-1]:
    if count>=0:
      break
    else:
      count += i
      ans += 1
  print(ans)
an = [int(input()) for i in range(5)]
total = 0

for i in range(5):
  tot = (an[i] // 10) * 10
  an[i] -= tot
  total += tot
  if an[i] == 0:
    del an[i]
if len(an) > 0:
  total += min(an) + (len(an) - 1)*10
print(total)

### FIXED CODE ###

li = [int(input()) for i in range(5)]
al = []
ans = 0
for i in li:
  if i % 10 != 0:
    al.append(i % 10) 
  ans += i // 10
ans *= 10
if len(al) > 0:
  ans += min(al) + (len(al) - 1)*10
print(ans)
S=0
N=int(input())
tmp=N
while tmp!=0:
    S+=N%10
    tmp//=10
if N%S==0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S=0
N=int(input())
tmp=N
while tmp!=0:
    S+=tmp%10
    tmp//=10
if N%S==0:
    print('Yes')
else:
    print('No')
l = map( int , raw_input().split())

print l[0] * l[1] ' ' l[0] * 2 + l[1] * 2

### FIXED CODE ###

l = map( int , raw_input().split())

s = l[0] * l[1]
r = ( l[0] + l[1] ) * 2

print s , r
n,q=map(int,input().split())

d=[[0] for _ in range(n+1)]
d1=[0 for _ in range(n+1)]

for i in range(n-1):
  a,b=map(int,input().split())
  d[a].append(b)
  d[b].append(a)

for i in range(q):
  p,x=map(int,input().split())
  d1[p]+=x

for i in range(1,n+1):
  d[i].remove(0)
  
vi=[0 for _ in range(n+1)]

def dfs(x,i):
  vi[x]+=i+d1[x]
  for m in d[x]:
    if vi[m]==0:
      dfs(m,vi[x])    

dfs(1,0)


print(*vi[1:])

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
n,q=map(int,input().split())

d=[[0] for _ in range(n+1)]
d1=[0 for _ in range(n+1)]

for i in range(n-1):
  a,b=map(int,input().split())
  d[a].append(b)
  d[b].append(a)

for i in range(q):
  p,x=map(int,input().split())
  d1[p]+=x

#d 関係性 d1価
vi=[-1 for _ in range(n+1)]

def dfs(x,i):
  vi[x]=i+d1[x]
  for m in d[x]:
    if vi[m]==-1 and m!=0:
      dfs(m,vi[x])    

dfs(1,0)


print(*vi[1:])
N, M = map(int, input().split())

As = [int(x) for x in input().split(' ')]
As.sort()

Bs = []
Cs = []
for _ in range(M):
  b, c = [int(x) for x in input().split(' ')]
  Cs += [c for _ in range(b)]
if len(Cs) > N:
  Cs = Cs.sort(reverse=True)[: N+1]
else:
  Cs.sort()
  
num = 0
for i in range(len(Cs)):
  a = As[i]
  c = Cs[i]
  if a < c:
    num += c
  else:
    break
num += sum(As[i+1: ])
    
print(num)

### FIXED CODE ###

N, M = list(map(int, input().split()))

As = list(map(int, input().split()))
As.sort()

BCs = []
for _ in range(M):
  b, c = tuple(map(int, input().split()))
  BCs.append((b, c))
BCs.sort(key=lambda x: x[1], reverse=True)
  
num = 0
i = 0
for b, c in BCs:
  for j in range(b):
    a = As[i]
    
    if a >= c:
      break
    else:
      num += c
      i += 1
      
    if i == len(As):
      break
      
  if a >= c or i == len(As):
    break
num += sum(As[i: ])
    
print(num)
from numpy import *
N,K,*A=map(int,open(0).split())
d=zeros(K+1,int64)
d[0]=1
for a in A:
    d[a+1:]-=d.copy()[:-(a+1)]
    d=cumsum(d)%(10**9+7)
print(d[K])

### FIXED CODE ###

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

"""
(1+x+...+x^a) をたくさんかける
(1-x^{a+1}) をかけて、(1-x)^{-1}をかける
"""

import numpy as np
MOD = 10 ** 9 + 7
N,K = map(int,input().split())
dp = np.zeros(K+1, dtype=np.int64)
dp[0] = 1

for a in map(int,input().split()):
    # numpyのバージョン違いにより
    prev = dp.copy()
    dp[a+1:] -= prev[:-(a+1)]
    np.cumsum(dp, out=dp)
    dp %= MOD

answer = dp[K]
print(answer)
s = input()
a = len(s)-2
print(s[0] + int(a) + s[-1])


### FIXED CODE ###

s = input()
a = str(len(s)-2)
print(s[0] + a + s[-1])
a =input()

b = [x for x in list(a)]
if len(a) == 1:
    print(int(a))
elif len(a) == a[1:].count('9') + 1:
    print(sum(b))
else:
    print(int(b[0])-1+(len(a)-1)*9)


### FIXED CODE ###

a =input()

b = [int(x) for x in list(a)]
if len(a) == 1:
    print(int(a))
elif len(a) == a[1:].count('9') + 1:
    print(sum(b))
else:
    print(int(b[0])-1+(len(a)-1)*9)
n, m = map(int,input().split())
h = list(map(int,input().split()))
max = max(h)
count = [0 for i in range(max)]
for i in range(m):
    a, b = map(int,input().split())
    if a >= b:
        A = a
        a = b
        b = A
    count[a-1] = 1
ans = 0
for i in h:
    if count[i-1] == 0:
        ans += 1
print(ans)


### FIXED CODE ###

n, m = map(int,input().split())
h = list(map(int,input().split()))
dic = {}
for i in range(len(h)):
    dic[i] = 0
for i in range(m):
    a, b = map(int,input().split())
    if h[a-1] > h[b-1]:
        dic[b-1] = 1
    elif h[a-1] < h[b-1]:
        dic[a-1] = 1
    elif h[a-1] == h[b-1]:
        dic[b-1] = 1
        dic[a-1] = 1
ans = 0
for i in range(len(h)):
    if dic[i] == 0:
        ans += 1
print(ans)
n,k =map(int,input().split())
trees = sorted([int(input()) for _ in range(n)])
ans = float('inf')
for i in range(n):
  if i+2==n:
    break
  else:
    temp = abs(trees[i]-trees[i+k-1])
    if temp<ans:
      ans = temp
      if ans==0:
        break

print(ans)

### FIXED CODE ###

n,k =map(int,input().split())
trees = sorted([int(input()) for _ in range(n)])
ans = float('inf')
for i in range(n):
  if i+k>n:
    print(ans)
    exit()
  else:
    ans = min(trees[i+k-1]-trees[i], ans)
    if ans==0:
      print(ans)
      exit()
string = input()
index_of_A = string.index("A")
index_of_Z = string.index("Z", index_of_A, len(string)-1)

print(index_of_Z - index_of_A + 1)

### FIXED CODE ###

string = input()
index_of_A = string.index("A")
index_of_Z = string.rfind("Z")

print(index_of_Z - index_of_A + 1)
from heapq import heappush, heappop
N, K , *P = map(int, open('0').read().split())
mhq = []
Mhq = []
for c in P[:K]:
  heappush(mhq,c)
  heappush(Mhq,-c)

ans = 1
log = set()
for i,c in enumerate(P[K:]):
  while mhq[0] in log:
    heappop(mhq)
  while -Mhq[0] in log:
    heappop(Mhq)
  d = P[i]
  m = mhq[0]
  M = -Mhq[0]
  log.add(d)
  heappush(mhq,c)
  heappush(Mhq,-c)
  if not (m==d and M<c):
    ans += 1
p = P[0]
m = 1
x = 0
for c in P[1:]:
  if p<c:
    m += 1
  else:
    if m>=K:
      x += 1
    m = 1
  p = c
if m>=K:
  x += 1
print(ans-x+1)

### FIXED CODE ###

from heapq import heappush, heappop
N, K , *P = map(int, open(0).read().split())
mhq = []
Mhq = []
for c in P[:K]:
  heappush(mhq,c)
  heappush(Mhq,-c)

ans = 1
log = set()
for i,c in enumerate(P[K:]):
  while mhq[0] in log:
    heappop(mhq)
  while -Mhq[0] in log:
    heappop(Mhq)
  d = P[i]
  m = mhq[0]
  M = -Mhq[0]
  log.add(d)
  heappush(mhq,c)
  heappush(Mhq,-c)
  if not (m==d and M<c):
    ans += 1
p = P[0]
m = 1
x = 0
for c in P[1:]:
  if p<c:
    m += 1
  else:
    if m>=K:
      x += 1
    m = 1
  p = c
if m>=K:
  x += 1
if x!=0:
  ans -= x-1
print(ans)
n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[None]*len(h)
dp[0]=0

for i in range(1,k+1):
  dp[i]=abs(h[i]-h[0])

for i in range(k+1,n):
  distance=float('inf')
  for j in range(1,k+1):
    if i-j>=0:
      distance=min(distance,dp[i-j]+abs(h[i]-h[i-j]))
  dp[i]=distance
  
print(dp[-1])
    

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))

dp=[None]*len(h)
dp[0]=0

for i in range(1,k+1):
  if i<=n-1:
    dp[i]=abs(h[i]-h[0])

for i in range(k+1,n):
  distance=float('inf')
  for j in range(1,k+1):
    if i-j>=0:
      distance=min(distance,dp[i-j]+abs(h[i]-h[i-j]))
  dp[i]=distance
  
print(dp[-1])
yandy
N, M = map(int, input().split())

num = [0] * N

for i in range(M):
    a, b = map(int, input().split())
    num[a-1] += 1
    num[b-1] += 1

for i in num:
    print(i)


### FIXED CODE ###

n,m=map(int,input().split())
l=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  l[a-1]+=1
  l[b-1]+=1
for i in range(n):
  print(l[i])
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

def main():
    GI()
    CEIL = 10 ** 18

    prod = GI()
    for x in GIS():
        prod *= x
        if prod > CEIL:
            prod = -1
            break
    print(prod)

main()


### FIXED CODE ###

GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

def main():
    GI()
    CEIL = 10 ** 18

    xs = LGIS()

    prod = 1
    for x in xs:
        prod *= x
        if prod > CEIL:
            prod = -1
            break

    if prod == -1:
        print(0 if 0 in xs else -1)
    else:
        print(prod)

main()
x = input()
print(x**3)


### FIXED CODE ###

x = input()
x = int(x)
print(x**3)
s=input()
if s==Sunny:
  print("Cloudy")
elif s==Cloudy:
  print("Rainy")
else:
  print("Sunny")

### FIXED CODE ###

s=input()
if s=="Sunny":
  print("Cloudy")
elif s=="Cloudy":
  print("Rainy")
else:
  print("Sunny")
h,a = map(int,input().split())
print(int(h/a+1)


### FIXED CODE ###

h,a = map(int,input().split())
if h%a == 0:
    result = int(h/a)
else:
    result = int(h/a) + 1
print(result)
s=input()
t=s
ans=0
for i in range(len(s)):
  ans+=1-s[i]==t[i]
print(ans)

### FIXED CODE ###

s=input()
n=len(s)
if n%2:
  ms,us=s[:(n-1)//2],s[:(n-1)//2:-1]
else:
  ms,us=s[:n//2],s[:n//2-1:-1]
ans=0
for a,d in zip(list(ms),list(us)):
  if a!=d:ans+=1
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 21:00:38 2019

@author: hisaki
"""

#at coder 2019年6月2日日曜日　A問題
import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

for i in range(N):
    if S[i] == '#' and i != N-1:
        if S[i+1] == '#':
            print ("No")
            sys.exit()

def func(A_pos, B_pos):
    global N
    global A_goal
    global B_goal
    
    if A_pos == A_goal and B_pos == B_goal:
        print ("Yes")
        sys.exit()
    
    if A_pos != N-1 and S[ A_pos + 1 ] != '#' and A_pos + 1 != B_pos:#操作A
        func(A_pos+1,B_pos)
    if A_pos != N-1 and A_pos != N-2 and S[ A_pos + 2 ] != '#' and A_pos + 2 != B_pos:#操作A
        func(A_pos+2,B_pos)
    if B_pos != N-1 and S[ B_pos + 1 ] != '#' and B_pos + 1 != A_pos:#操作A
        func(A_pos,B_pos+1)
    if B_pos != N-1 and B_pos != N-2 and S[ B_pos + 2 ] != '#' and B_pos + 2 != A_pos:#操作A
        func(A_pos,B_pos+2)
    
    return

func(A_pos,B_pos)
print ("No")


    
                   





            




### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_pos, A_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_pos, B_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False
            
if flag == False:
    print ("No")
    sys.exit()
  


if A_goal < B_goal:
    print ("Yes")
    sys.exit()


if B_goal < A_goal :
    for i in range(B_pos , B_goal+1):
        if (S[i-1] == '.' or i-1 == A_pos) and (S[i]== '.') and (S[i+1] == '.'):
            print ("Yes")
            sys.exit()

            
print ("No")
n,y = map(int,input().split())
for i in range(n+1):
  for j in range(n+1):
    if (y - 1000*i - 5000*j)/10000 = n-i-j:
      print(i,j,n-i-j)
      exit()
print(-1,-1,-1)

### FIXED CODE ###

n,y = map(int,input().split())
for i in range(n+1):
  for j in range(n+1):
    if (y - 1000*i - 5000*j)/10000 == n-i-j and n-i-j>=0:
      print(n-i-j,j,i)
      exit()
print(-1,-1,-1)
def main():
    n = int(input())
    s = input()

    if n % 2 == 1:
        print("No")
        return

    if s[:len(s)/2] == s[len(s)/2:]:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    s = input()

    if n % 2 == 1:
        print("No")
        return

    if s[:len(s)//2] == s[len(s)//2:]:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
n,k,b,ans=int(input()),int(input()),[int(input())for i in range(n)],0
for i in b:ans+=min(i,k-i)*2
print(ans)

### FIXED CODE ###

n,k,b,ans=int(input()),int(input()),list(map(int,input().split())),0
for i in b:ans+=min(i,k-i)*2
print(ans)
a=list(int ,input().split())
if a[0]==a[1]==a[2] or a[1]==a[2]==a[3]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a=list(input())
if a[0]==a[1]==a[2] or a[1]==a[2]==a[3]:
  print("Yes")
else:
  print("No")
import functools

number = int(input())
origin = [int(input()) for _ in range(number)]


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

divised = origin  # initialize

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)

print(len(origin))

### FIXED CODE ###

def is_prime(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

count = 0

number = int(input())
for i in range(number):
    n = int(input())
    if is_prime(n):
        count = count + 1

print(count)
import sys

input = sys.stdin.readline


def main():
    a, b, m = map(int, input().split())
    refrigerators = list(map(int, input().split()))
    microwaves = list(map(int, input().split()))
    tickets = [list(map(int, input().split())) for _ in range(m)]
    tickets_map = {}
    for x, y, c in tickets:
        key = f'{x - 1}:{y - 1}'
        tickets_map[key] = c

    ret = 99999999999999
    for x in range(a):
        for y in range(b):
            key = f'{x}:{y}'
            d = tickets_map.get(key, 0)
            p = refrigerators[x] + microwaves[y] - d
            ret = min(ret, p)
    print(ret)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

input = sys.stdin.readline


def main():
    a, b, m = map(int, input().split())
    refrigerators = list(map(int, input().split()))
    microwaves = list(map(int, input().split()))
    tickets = [list(map(int, input().split())) for _ in range(m)]

    x_ret = min(refrigerators)
    y_ret = min(microwaves)
    ret = x_ret + y_ret
    for x, y, c in tickets:
        p = refrigerators[x - 1] + microwaves[y - 1] - c
        ret = min(ret, p)
    print(ret)


if __name__ == '__main__':
    main()
n,p = map(int, input().split())
if n==1:
    print(p)
    exit()
elif p==1:
    print(1)
    exit()

a = int(p**(1/n)+1)
for i in range(a,0,-1):
  if p%(i**n)==0:
    print(i)
    exit()

### FIXED CODE ###

n,p = map(int, input().split())
a = round(p**(1/n))
for i in range(a,-1,-1):
  if p%(i**n)==0:
    print(i)
    exit()
import math
a,b=map(float,input().split())
a=int(a)
b=int(b.replace('.',''))
print((a*b)//100)

### FIXED CODE ###

#ACになったコード（その2）
a, b = input().split()
a = int(a)
b = int(b.replace('.',''))
print(a*b//100)