peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()

if c < d:
    print("Yes" if s[a - 1:d].count("##") == 0 else "No")
else:
    print("Yes" if s[a - 1:c].count("##") ==
          0 and s[b - 2:d + 1].count("...") > 0 else "No")
# Judge status: Accepted
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, K = I()
a = []
for i in range(N):
    x = k()
    a.append(x)

a.sort()

print(min(a[i+K-1]-a[i] for i in range(N-K+1)))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
start = n - 1
while start >= 0:
    print(a[start],end=' ')
    start -= 2
if n % 2 == 0:
    start = 0
else:
    start = 1
while start < n:
    print(a[start],end=' ')
    start += 2
# Judge status: Wrong Answer
import math
H,N=map(int,input().split())
A=[]
B=[]
eff=[]
mp=0

for i in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
    eff.append(a/b)

while H!=0:
    eff_max_index=eff.index(max(eff))
    tmp=math.floor(H/A[eff_max_index])
    H-=tmp*A[eff_max_index]
    mp+=tmp*B[eff_max_index]
    for i in range(N):
        if A[i]>H:
            A[i]=H
            eff[i]=A[i]/B[i]
print(mp)
# Judge status: Accepted
from math import factorial

N, M = map(int, input().split())
if abs(N - M) > 1:
    ret = 0
elif N == M:
    ret = factorial(N) * factorial(M) * 2
else:
    ret = factorial(N) * factorial(M)

print(ret % (10 ** 9 + 7))
# Judge status: Accepted
# -*- coding: utf-8 -*-

# 整数の入力
a = int(input())
# スペース区切りの文字列の入力
st = input().split()
st_list = []
st_list = [int(st) for st in st]

num = 0
flg = 0
for num in range(len(st_list)):
  if(st_list[num] % 2 == 0):
    if(st_list[num] % 5 != 0 and st_list[num] % 3 != 0):
      flg = 1
if(flg == 0):
  print("APPROVED")
else:
  print("DENIED")
# Judge status: Accepted
"""
author : halo2halo
date : 31, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S = readline().decode('utf8')

ans = 0
cnt=0
for i in S:
    
    if i == 'I':
        cnt += 1
    else:
        cnt -= 1

    ans=max(ans, cnt)
print(ans)
# Judge status: Wrong Answer
A, B = map(int, input().split())

C = B//A + 1

number_of_mouth = A * C - (C-1)

if number_of_mouth >= B:
    print(C)

elif A == B:
    print('1')

else:
    C += 1
    print(C)
# Judge status: Accepted
a, b, c = list(map(int, input().split()))

if c-a-b > 0:
    if 4*a*b < (c-a-b)**2:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Wrong Answer
A, B = map(int, input().split())

count = 0
for q in range(A, B):
    if list(str(q)) == list(reversed(str(q))):
        count += 1
print(count)
# Judge status: Accepted
N, MIN, MAX = map(int, input().split())

sum_min = (N-1)*MIN + MAX
sum_max = (N-1)*MAX + MIN
# print(sum_max)
# print(sum_min)

if N > 1:
    if sum_max >= sum_min:
        print(sum_max - sum_min + 1)
    else:
        print(0)
elif N == 1:
    if MIN!= MAX:
        print(0)
    else:
        print(1)
# Judge status: Accepted
n = int(input())

if n%2 == 0:
  ans = 0
  l = 1
  while(True):
    if n//pow(5, l) == 0:
      break
    ans += n//pow(5, l)//2
    l+=1
  print(ans)
else:
  print(0)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
bottom = sum(A)
 
if bottom <= 0:
  print(-1)
  exit()
 
ret = 1
children = 1 - A[0]
bottom -= A[0]
 
for i in range(N):
    children = children * 2 - A[i+1]
    if children <= -1:
      ret = -1
      break
    
    bottom -= A[i+1]
    if children >= bottom:
      children = bottom
    ret += children + A[i+1]
print(ret)
# Judge status: Accepted
from collections import deque
n = int(input())
a = list(map(int, input().split()))
b = deque()

ok = True
for i in range(n):
  if ok:
    b.append(a[i])
    ok = False
  else:
    b.appendleft(a[i])
    ok = True

b = list(map(str, list(b)))
if ok:
  print(" ".join(b))
else:
  print(" ".join(b[::-1]))
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
from fractions import gcd
from functools import reduce

n,m,*alst = list(map(int,read().split()))
mm=2*m
def lcm(x,y):
  g=gcd(x,y)
  if x//g %2==0 or y//g%2==0:
    return 0
  g=x*y//g
  if g>mm:
    return 0
  return g
g=reduce(lcm,alst)
if g==0:
  print(0)
  quit()
else:
  res=(mm//g)
  print(res//2+res%2)
# Judge status: Accepted
import math
n, x, t = map(int, input().split())
print(t * math.ceil(n/x))
# Judge status: Accepted
n,Y = map(int,(input().split()))
x = 0
y = 0
z = 0
f = True
for i in range(n+1):
    for j in range(n+1):
        k=Y-i*10000-j*5000
        if k==(n-i-j)*1000 and k>=0:
            x=i
            y=j
            z=int(k/1000)
            f=False
if f :
    x = -1
    y = -1
    z = -1
print(x,y,z)
# Judge status: Accepted
import sys
def input():
    return sys.stdin.readline()[:-1]
N=int(input())
l=[None]*N
for i in range(N):
    X,L=map(int,input().split())
    l[i]=(X-L,X+L)
l.sort(key=lambda x: x[1])
t=-10**12
a=0
for i in l:
    if t<=i[0]:
        a+=1
        t=i[1]
print(a)
# Judge status: Accepted
from math import ceil, log2

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

ans = 0
d = {}
d[0] = 1
for i in range(n, 0, -1):
    c = ceil(log2(k / i))
    if c < 0:
        c = 0
    if c not in d:
        d[c] = pow(1/2, c)
    ans += d[c] / n

print(ans)
# Judge status: Accepted
n=int(input())
lis=['AC', 'WA', 'TLE', 'RE']
ans=[0,0,0,0]
for _ in range(n):
    s=input()
    ans[lis.index(s)]+=1

for i in range(4):
    print(lis[i]+' x '+str(ans[i]))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
d = {}
for x in a:
    d[x] = d.get(x, 0) + 1
l = []
ans = 0
for num, cnt in sorted(d.items(), key=lambda x: x[0], reverse=True):
    if cnt > 3:
        ans = num ** 2
        print(ans)
        exit()
    elif cnt > 1:
        l.append(num)
        if len(l) == 2:
            ans = l[0] * l[1]
            print(ans)
            exit()
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
X = list(map(int, input().split()))

ans = 10**10
for i in range(n-k+1):
  d1 = abs(X[i]) + abs(X[i] - X[i+k-1])
  d2 = abs(X[i+k-1]) + abs(X[i] - X[i+k-1])
  if ans > min(d1, d2):
    ans = min(d1,d2)
if ans == 10**10:
  print(0)
else:
  print(ans)
# Judge status: Wrong Answer
import sys
k = int(input())
if k % 7 == 0:
    k = k // 7
tmp = 1
for i in range(k+2):
    if tmp == 0:
        print(i+1)
        sys.exit()
    tmp = (tmp * 10 + 1) % k
print(-1)
# Judge status: Accepted
n,m = map(int,input().split())

rest = []
for i in range(m):
    a,b = input().split()
    rest.append((int(a),b))

done = False

for i in range(0,1000):
    x = str(i)
    if (len(x) == n):
        ok = True
        for t in rest:
            if (x[t[0] - 1] != t[1]):
                ok = False
                break
        if ok:
            print(i)
            done = True
            break

if not done:
    print(-1)
# Judge status: Wrong Answer
n = list(map(int,input().split()))
vote = list(map(int,input().split()))
a = 4*n[1]*sum(vote)
result = 0
for i in range(n[0]):
  if vote[i]<a:
    result += 1
if result<n[1]:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
n = int(input())
dic = {}
lis = []
lis2 = []

for i in range(n):
  moji = input()
  if moji not in dic:
    dic[moji] = 0
  dic[moji] += 1
  
for i in sorted(dic.items(), key=lambda x:x[1]):
    lis.append(i)
  
lis.reverse()

for j in lis:
  if lis[0][1] == j[1]:
    lis2.append(j[0])
  else:
    break

lis2.sort()
for i in range(len(lis2)):
  print(lis2[i])
# Judge status: Wrong Answer
n=int(input())
ans=0
x=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b and i==x+1:
        ans+=1
        x=i
        if ans==3:
            x=0
            break
    elif a==b and i!=x+1:
        x=i
        ans=0
if ans==3:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
S = input()
if S[-1] == 's':
  print(S)
else:
  print(S + 's')
# Judge status: Accepted
s = input()
if(len(s) < 5):
    print(0)
else:
    t = [0]*2019
    t[0] = 1
    p = 0
    temp = 0
    temp2 = 1
    for i in range(1,len(s)+1):
        temp2 *= 10
        temp2 %= 2019
        t[(temp + temp2*int(s[-i]))%2019] += 1
        temp += temp2*int(s[-i])
    for i in range(2019):
        p += (t[i]*(t[i]-1))//2
    print(p)
# Judge status: Accepted
a,b,c = map (int, input ().split ())
x = round (a*b/2)
print (x)
# Judge status: Accepted
S = list(input())

l = len(S)
for i in range(l):
    for j in range(i,l):
        tmp = S[:i] + S[j:]
        if "".join(tmp) == "keyence":
            print("YES")
            exit()
print("NO")
# Judge status: Accepted
N,M = [int(i) for i in input().split()]

ans = min(N,M//2)
if N < M//2:
    M -= 2*N
    ans += M//4

print(ans)
# Judge status: Accepted
X = int(input())

N = X - 100
ans = 100
for i in range(10000):
  if X <= ans:
    print(i)
    break
  ans += ans // 100
# Judge status: Wrong Answer
import sys
s = input()
a = 'dream'
b = 'dreamer'
c = 'erase'
d = 'eraser'
for i in range(len(s)):  
  if not s[i] == a[i//4] or s[i] == b[i//5] or s[i] == c[i//4] or s[i] == d[i//5]:
    print('NO')
    sys.exit( )
print('YES')
# Judge status: Accepted
#abc113 a
x,y=map(int,input().split())
print(x+y//2)
# Judge status: Accepted
N=int(input())
A=1000*(N//1000)-N
B=((N//1000)+1)*1000-N
if A<=B and A>=0:
  print(int(A))
else:
  print(int(B))
# Judge status: Wrong Answer
import bisect
H,N = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
dp = [[10**18]*10**4 for _ in range(N+1)]
for i in range(N+1):
  dp[i][0]=0
mi=10**9
for i in range(N):
  for w in range(10**4):
    dp[i+1][w]=min(dp[i+1][w],dp[i][w])
    if w-AB[i][1]>=0:
      dp[i+1][w]=min(dp[i+1][w],dp[i + 1][w - AB[i][0]] + AB[i][1])
for i in range(H,10**4):
  mi = min(mi,dp[N][i])
print(mi)
# Judge status: Wrong Answer
import math
n = int(input())
print(math.ceil(n))
# Judge status: Wrong Answer
from sys import stdin

a, b, c = [int(x) for x in stdin.readline().rstrip().split()]

print("Yes" if not ((a == b == c) or (a != b != c)) else "No")
# Judge status: Wrong Answer

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

flg = False

for i in range(b):
    if a_temp % b == c:
        print('Yes')
        exit()
    a_temp += a
else:
    print('No')
# Judge status: Wrong Answer
a, b = list(map(int, input().split()))
if a % 3 == 0 or b & 3 == 0 or (a + b ) % 3 == 0:
  print('Possible')
else:
  print('Impossible')
# Judge status: Accepted
from heapq import *
N,M = map(int,input().split())
l = [[0] for _ in range(M+1)] 
for _ in range(N):
    a, b = map(int, input().split())
    if a<=M:
        l[a].append(b)

ans = 0
h = []

for i in range(1,M+1):
  for j in l[i]:
    heappush(h, -j)
  ans += heappop(h)
ans *= -1
print(ans)
# Judge status: Accepted
import collections,sys
def I(): return int(sys.stdin.readline().rstrip())
def S(): return sys.stdin.readline().rstrip()
s = [S() for _ in range(I())]
t = [S() for _ in range(I())]
ans = 0
count_s = collections.defaultdict(int)
count_t = collections.defaultdict(int)
for x in s:
    count_s[x] += 1
for y in t:
    count_t[y] += 1
for k,v in count_s.items():
    ans = max(ans,v-count_t[k])
print(ans)
# Judge status: Accepted
def solve(lx, rx):
    diff = min(rx) - max(lx)
    ans = diff+1 if diff >= 0 else 0
    return ans


if __name__ == '__main__':
    n, m = map(int, input().split())
    lx = []
    rx = []

    for i in range(m):
        l, r = map(int, input().split())
        lx.append(l)
        rx.append(r)

    print(solve(lx, rx))
# Judge status: Accepted
n, k = map(int, input().split())
ls = list(map(int, input().split()))

exv = 0

for j in range(k):
    exv += (ls[j] + 1) / 2

ans = exv

for i in range(k, n):
    exv += (ls[i] + 1) / 2
    exv -= (ls[i - k] + 1) / 2
    
    if exv > ans:
        ans = exv

print(ans)
# Judge status: Wrong Answer
from decimal import *

import numpy as np

import math

if __name__ == '__main__':
    n = int(input())
    b, c = map(int, input().split())
    list =[]
    min = 100000
    d = [int(i) for i in input().split()]

    for i in d:
        a =Decimal(i)*Decimal(0.006)
        diff=0
        if a > c:
            diff =abs(c+a)
        else:
            diff =abs(c-a)
        list.append(diff)
        if min > diff:
            min=diff
    print(list.index(min)+1)
# Judge status: Accepted
import sys

N=int(input())
temp=0
ans=[]
for i in range(1,N+1):
  temp+=i
  if temp==N:
    for j in range(1,i+1):
      print(j)
    else:
      sys.exit()
  elif temp>N:
    for j in range(1,i+1):
      if j==temp-N:
        continue
      print(j)
    else:
      sys.exit()
# Judge status: Wrong Answer
a, b = map(int, input().split())
ans = (a+b)//2+1
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = [int(a) for a in input().split()]

next_target = 1

idx = []

for i, a in enumerate(A):
    if a == next_target:
        idx.append(i)
        next_target += 1

if not idx:
    print(-1)
else:
    prev = -1
    sum_ = 0
    for x in idx:
        sum_ += x - prev - 1
        prev = x

    print(sum_)
# Judge status: Wrong Answer
#スペース区切りの整数の入力
h1, m1, h2, m2, k = map(int, input().split())


asa = h1 * 60 + m1
yoru = h2 * 60 + m2


if(((yoru - asa )%k) == 0):
  ans = int((yoru - asa )/k)-1
else:
  ans = int((yoru - asa )/k)
print(ans* k)
# Judge status: Accepted
f=lambda:map(int,input().split())
n,m=f(); l=list(f())
import fractions as f
k=1
for i in l:
  i//=2; k=k*i//f.gcd(k,i)
  if (k//i)%2<1 or k>m: print(0); break
else: print(m//k-m//(k*2))
# Judge status: Accepted
N=int(input())
L1=[]
L2=[]
L3=[]
for i in range(N):
    x,y=map(int,input().split())
    L1.append(x+y)
    L2.append(x-y)
    L3.append(y-x)
L1.sort()
L2.sort()
L3.sort()

M1=L1[-1]-L1[0]
M2=L2[-1]-L2[0]
M3=L3[-1]-L3[0]
print(max(M1,M2,M3))
# Judge status: Accepted
n = int(input())
line = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*line)]

def f(x,y):
  return x-y

def g(x,y):
  return x+y
  
print(max(max([f(x[i],y[i]) for i in range(n)])-min([f(x[i],y[i]) for i in range(n)]), max([g(x[i],y[i]) for i in range(n)])-min([g(x[i],y[i]) for i in range(n)])))
# Judge status: Wrong Answer
N = int(input())
ls = []
f = 0
for i in range(N):
  ls.append(int(input()))
for i in range(N):
  if ls[i]%2 != 0:
    print(sum(ls))
    f += 1
    break
if f == 0:
  print(0)
# Judge status: Accepted
def main():
    a, b, c, x, y = map(int, input().split())

    ans = 1000000007
    for i in range(100001):
        cost = c * i * 2 + a * max(0, x - i) + b * max(0, y - i)
        if cost < ans:
            ans = cost

    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
l = list(map(int,input().split()))

S = sum(l)

for i in range(N):
    tmp = S - l[i]
    if tmp < l[i]:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
import collections
import heapq
n = int(raw_input())
ais = [0] + map(int, raw_input().split()) 
res = [0 for __ in range(n +1)]
used = set([])
for u in range(n, 0, -1):
	c = u*2
	cumul = 0
	for jj in range(u, n+1, u):
		cumul += res[jj]
	
	if ais[u] != (cumul % 2): 
		res[u] = 1
		used.add(u)
s = sum(res)
print s
if s:
	for x in used: print x,
	print
# Judge status: Accepted
import itertools

n=int(input())
data=[x+1 for x in range(n)]
p = [int(_) for _ in input().split()]
q = [int(_) for _ in input().split()]
a=b=-1
i=0
for d in itertools.permutations(data):
  if list(d)==p:
    a=i
  if list(d)==q:
    b=i
  
  i+=1
    
print(abs(a-b))
# Judge status: Accepted
s=int(input())
x3,y3,x2,y2,y1=0,0,-int(-s**0.5//1),1,-int(-s**0.5//1)
x1=x2*y1-s
if x2*y1-s==0:
    x1,y2=0,0
print(x1,y1,x2,y2,x3,y3)
# Judge status: Wrong Answer
N = int(input())

result = 0
n = N
i = 2
e = 1
while n%(i**e)==0:
    n = n//(i**e)
    result += 1
    e += 1

for i in range(3,int(N**(1/2)+1),2):
    e = 1
    while n%(i**e)==0:
        n = n//(i**e)
        result += 1
        e += 1

if result == 0 and N != 1:
    result = 1

print(result)
# Judge status: Wrong Answer
a, b, k = map(int, input().split())

for i in range(k):
    if a + i > b:
        break
    print(a + i)

for i in range(k):
    if b - i < a:
        break
    print(b-i)
# Judge status: Accepted
a,b =map(int,input().split())
ans = []
for i in range(1,10**4+1):
  if int(i * (8/100)) == a and int(i*(10/100)) == b:
    ans.append(i)
print('-1' if ans == [] else min(ans))
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 17:23:47 2020

@author: shinba
"""

A = list(map(int,input().split()))
k = int(input())

A.sort()

print(A[2]*(2**k)+A[0]+A[1])
# Judge status: Accepted
def resolve():
    import math
    A, B, C, X, Y = map(int, input().split())
    ans = []
    for i in range(max(X, Y)*2+1):
        ans.append(C*i + A*(max(X-i/2, 0)) + B*(max(Y-i/2, 0)))
    print(math.floor(min(ans)))
resolve()
# Judge status: Accepted
N=int(input())
if N<=111:
    print(111)
elif 112<=N and N<=222:
    print(222)
elif 223<=N and N<=333:
    print(333)
elif 334<=N and N<=444:
    print(444)
elif 445<=N and N<=555:
    print(555)
elif 556<=N and N<=666:
    print(666)
elif 667<=N and N<=777:
    print(777)
elif 778<=N and N<=888:
    print(888)
elif 889<=N and N<=999:
    print(999)
# Judge status: Accepted
import math
X=int(input())
tmp=100
t=1
while tmp<X:
  tmp=math.floor(tmp*1.01)
  t+=1
print(t-1)
# Judge status: Accepted
n = int(input())

N = n//15

print(n*800-200*N)
# Judge status: Accepted
import math

N, H = map(int, input().split())
ab=[]
for _ in range(N):
    ab.append(tuple(map(int, input().split())))
A = [el[0] for el in ab]
M=max(A)
B=[el[1] for el in ab if el[1]>M]

throw=sum(B)

if H>throw:

    print(math.ceil((H-throw)/M) + len(B))
else:
    B.sort(reverse=True)
    for i in range(N-1):
        if B[i]>=H:
            print(i+1)
            break
        B[i+1]+=B[i]
    else:
        print(N)
# Judge status: Accepted
cand_num, tenka = map(int, input().split(" "))
candles = list(map(int, input().split(" ")))
mini = 10 ** 9

for i in range(cand_num - tenka + 1):
    if candles[i] * candles[tenka + i - 1] >= 0:
        temp = max(abs(candles[i]), abs(candles[tenka + i - 1]))
    else:
        temp = min(abs(candles[i]), abs(candles[tenka + i- 1])) * 2 + max(abs(candles[i]), abs(candles[tenka + i - 1]))
    mini = temp if mini > temp else mini
print(mini)
# Judge status: Accepted
N=int(input())
d=sorted(list(map(int,input().split())))
print(d[N//2]-d[N//2-1])
# Judge status: Accepted
string=input()
list=[]
for i in range(0,len(string)):
         if string[i] not in list:
            list.append(string[i])

         if string[i] not in list:
            list.append(string[i])

if(len(list)==2):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
X, Y = map(int, input().split())

A = X
ans = 1

while 2*A <= Y:
    A *= 2
    ans += 1

print(ans)
# Judge status: Accepted
S = list(input())
K = int(input())

for i in range(K):
    if S[i] != "1":
        print(S[i])
        exit()
    if i + 1 == K:
        print(S[i])
        exit()
print("1")
# Judge status: Accepted
x, y = map(int, input().split())

ans = 0
while x <= y:
    x = x * 2
    ans += 1
print(ans)
# Judge status: Accepted
import sys
import math
n,h=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
a=[ab[i][0] for i in range(n)]
A=max(a)
b=[ab[i][1] for i in range(n) if ab[i][1]>A]
b=sorted(b,reverse=True)
cnt=0
for i in b:
  h-=i
  cnt+=1
  if h<=0:
    print(cnt)
    sys.exit()
print(cnt+math.ceil(h/A))
# Judge status: Accepted
a,b,c=sorted(map(int, input().split()))
print(10*c+b+a)
# Judge status: Accepted
S = input()
ans = False
for i in range(0, len(S)):
    for j in range(len(S)-i+1):
        ns = S[:j] + S[j+i:]
        if ns == 'keyence':
            ans = True
            break
    if ans:
        break
print('YES' if ans else 'NO')
# Judge status: Accepted
def resolve():
    #n=int(input())
    #a,b=map(int,input().split())
    #x=list(map(int,input().split()))
    #a=[list(map(lambda x:int(x)%2,input().split())) for _ in range(h)]
    a,b=map(int,input().split())
    if a>=13:
        print(b)
    elif a>=6:
        print(b//2)
    else:
        print(0)
    

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
N = int(input())
rests = []

for i in range(1, N+1):
    S, P = input().split()
    rests.append((S, int(P), i))

rests.sort(key=lambda x: x[0]+chr(100-x[1]))
for rest in rests:
    print(rest[2])
# Judge status: Accepted
from collections import Counter
n=int(input())
a=list(map(int, input().split()))
q=int(input())
cou=Counter(a)
arr=list(cou.items())
dic={}
for item in arr:
    dic[item[0]]=item[1]
ans=sum(a)
for _ in range(q):
    b,c=map(int,input().split())
    if not b in dic.keys():
      print(ans)
      continue
    if not c in dic.keys():
      dic[c]=0
    tmpb=dic.pop(b)
    tmpc=dic.pop(c)
    ans+=(c-b)*tmpb
    dic[c]=tmpb+tmpc
    print(ans)
# Judge status: Accepted
price, poket_money, max_music = map(int, input().split())

music_times = -1
for i in range(0, poket_money + 1, price):
    music_times += 1
    if max_music == music_times:
        break

print(music_times)
# Judge status: Wrong Answer
#coding:utf-8

a = input()

if a == "SSS":
    print("0")

elif a == "RRR":
    print("3")

elif a == "RRS" or "SRR":
    print("2")

else :
    print("1")
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
count = 0
if A == B and B == C:
  print(-1)
  exit()

while A%2 == 0 and B%2 == 0 and C%2 == 0:
  A, B, C = B//2+C//2, A//2+C//2, A//2+B//2
  count += 1
print(count)
# Judge status: Wrong Answer
T = input()
lent = len(T)
mlist = []
    
for i in range(lent):
    if T[lent - (i+1)] == "?":
        if i == 0:
            mlist.append("D")
        elif mlist[i-1] == "D":
            mlist.append("P")
        else:
            mlist.append("D")
    else:
        mlist.append(T[lent - (i+1)])

mlist.reverse()
print(''.join(mlist))
# Judge status: Wrong Answer
N,K=input().split()
N=int(N)
K=int(K)
a=[]
a=[int(a) for a in input().split()]
a.sort()
print(sum(a[0:K-1]))
# Judge status: Wrong Answer
S,W=map(int,input().split())

if (W>=(S/2)):
  print('unsafe')
else:
  print('safe')
# Judge status: Accepted
S = str(input())
T = str(input())
m = len(S)
n = len(T)
mn = m
for i in range(m-n+1):
    sub = S[i:i+n]
    counter = 0
    for j in range(n):
        if sub[j] != T[j]:
            counter += 1
    if mn > counter:
       mn = counter 
print(mn)
# Judge status: Accepted
a=int(input())

if a<=1:
	print(0)

else:
	n=(10**a)-(9**a)*2+(8**a)
	print(n%1000000007)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>=b:
    print(str(a)*b)
else:
    print(str(b)*a)
# Judge status: Wrong Answer
s = input()
a = [s[0]]
tmp = ""
cnt = 1

for i in range(1, len(s)):
    tmp = tmp + s[i]
    if s[-1] != tmp:
        a.append(tmp)
        tmp = ""
        cnt += 1
    else:
        continue
print(cnt)
# Judge status: Accepted
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
from itertools import permutations

def resolve():
    N=int(input())
    l=[[0,0] for i in range(N)]
    for i in range(N):
        x,y=map(int,input().split())
        l[i][0],l[i][1]=x,y

    p=permutations(l)
    dist = 0
    for v in p:
        for i in range(N-1):
            dist+=((v[i][0]-v[i+1][0])**2+(v[i][1]-v[i+1][1])**2)**0.5

    print(dist/len(list(permutations((l)))))


resolve()
# Judge status: Accepted
N = int(input())
W = [input() for _ in range(N)]
sorted_W = sorted(W)
for i in range(len(sorted_W) - 1):
    if sorted_W[i] == sorted_W[i + 1]:
        print('No')
        exit()
for i in range(len(W) - 1):
    if W[i][-1] != W[i + 1][0]:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
S = input("S?")
if S[0] == S[1] and S[0] == S[2]:
    print("No")
else:
    print("Yes")