Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

def main():
  M=10**9+7
  d=[1]+[0]*12
  for c in input():
    if c>'9':
      d=[sum(d[(j-k)*9%13]for j in range(10))%M for k in range(13)]
    else:
      d=[d[(int(c)-k)*9%13]for k in range(13)]
  print(d[5])
main()

### FIXED CODE ###

d=[1]+[0]*12
for i,c in enumerate(input()):
 p=[0]*13
 for j in range(13):
  for k in range(10):p[(j*10+k)%13]+=d[j]*(c>'9'or k==int(c))
 d=[t%(10**9+7)for t in p]
print(d[5])
### BUGGY CODE ###

n,m=map(int,input().split())
a=[]
b=[]
C=[]
s=[0 for i in range(n)]
s[0] = "Yes"
 
for i in range(m):
  c,d=map(int,input().split())
  a.append(c)
  b.append(d)
 
def Next(be):
  C.clear()
  for j in be:
    for i in range(len(a)):
      if a[i] == j:
        
        if s[b[i]-1]==0 and 0 == be.count(b[i]):
          C.append(b[i])
          s[b[i]-1]=j
        continue
      if b[i] == j:
        
        if s[a[i]-1]==0 and 0 == be.count(a[i]):
          C.append(a[i])
          s[a[i]-1]=j
        continue
  return C
co=[1]
for i in range(m):
  if s.count(0) == 0:
    break
  co = Next(list(co))
 
for i in s:
  print(i)

### FIXED CODE ###

from collections import deque

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

graph = [[] for _ in range(N + 1)]
for i in range(M):
  graph[a[i]].append(b[i])
  graph[b[i]].append(a[i])

    # bfs
queue = deque([1])
signposts = [0] * (N + 1)
signposts[1] = 1
while queue:#キューが空になるまで
  u = queue.popleft()
  for v in graph[u]:
    if not signposts[v]:
      signposts[v] = u
      queue.append(v)
 
if all(signposts[2:]):
  print("Yes")
  print("\n".join(map(str, signposts[2:])))
else:
  print("No")
### BUGGY CODE ###

import numpy as np
import bisect
N,M=map(int,input().split())
A=np.array(list(map(int,input().split())))
BC=[list(map(int,input().split())) for _ in range(M)]
A.sort()
for i in range(M):
    b,c=BC[i][0],BC[i][1]
    v=np.array([c]*b+[0]*(N-b))
    A=np.maximum(A,v)
    A.sort()

print(A.sum())

### FIXED CODE ###

from operator import itemgetter

N, M = list(map(int, input().split()))
A = [[1, a] for a in list(map(int, input().split()))]
BC = [list(map(int, input().split())) for i in range(M)]

q = sorted(A+BC, key=itemgetter(1), reverse=True)

ans = 0
i = 0

while N:
    n = min(q[i][0], N)
    ans += q[i][1] * n
    N -= n
    i += 1
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 10**9 + 7

for i in range(N):
    for j in range(i+1, N):
        ans += (A[i] * A[j])

print(ans % mod)

### FIXED CODE ###

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

ans = 0
mod = 10 ** 9 + 7
num = sum(A)

for a in A:
    num -= a
    ans += a * num

print(ans % mod)
### BUGGY CODE ###

a, b, n = map(int, input().split())
fx = [int(a*x/b) - a * int(x/b) for x in range(1, n+1)]
print(max(fx))

### FIXED CODE ###

a, b, n = map(int, input().split())
y = 0
if n >= b:
    y = b - 1
else:
    y = n
print(int(a*y/b))
### BUGGY CODE ###

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

def main():
    N, Q = map(int, input().split())
    link = [[] for _ in range(N)]
    a = [None] * (N-1)
    b = [None] * (N-1)
    for i in range(N-1):
        a[i], b[i] = map(int, input().split())

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

    for i in range(N-1):
        link[a[i]-1].append([b[i]-1, cost[i]])
        link[b[i]-1].append([a[i]-1, cost[i]])

    def dfs(v, c, p):
        for nv in link[v]:
            if nv[0] == p:
                continue
            cost[nv[0]] = c + cost[nv[0]]
            dfs(nv[0], cost[nv[0]], v)
        return

    dfs(0, cost[0], -1)

    print(*cost)

if __name__ == '__main__':
    main()


### FIXED CODE ###

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

def dfs(v, p):
    for u in link[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

N, Q = map(int, input().split())
link = [[] for _ in range(N)]
for i in range(N-1):
    a, b = map(int, input().split())
    link[a-1].append(b-1)
    link[b-1].append(a-1)

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

dfs(0, -1)

print(*ans)
### BUGGY CODE ###

import math
N = int(input())
x = list(map(int,input().split()))

d = [0]*(N-1)
for i in range(N-1):
    d[i] = x[i+1]-x[i]
    d[i] %= 10**9+7


kaijou = 1
for i in range(1,N):
    kaijou *= i%(10**9+7)

ans=0
x=0
k=10**9+5

def pow_r(x, n):
    """
    O(log n)
    """
    x %= (k+2)
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r(x ** 2, n // 2)%(k+2)
    else:  # standard case ② n is odd
        return ((x%(k+2)) * ((pow_r(x ** 2, (n - 1) // 2))%(k+2)))%(k+2)

for i in range(N-1):
    #(i+1)**(10**9+5)を計算してyへ
    y = pow_r(i+1,k) 
    #x+= kaijou//(i+1))%(10**9+7)
    x += (kaijou*y)%(10**9+7)
    ans+= d[i]*x

print(ans%(10**9+7))

### FIXED CODE ###

import math
import sys 
input = sys.stdin.readline

N = int(input())
x = list(map(int,input().split()))
mod = 10**9+7

d = [0]*(N-1)

for i in range(N-1):
    d[i] = x[i+1]-x[i]
    d[i] %= mod


kaijou = 1
for i in range(1,N):
    kaijou *= i
    kaijou %= mod


ans=0
x=0

def pow_r(x, n):
    """
    O(log n)
    """
    x %= mod
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r(x ** 2, n // 2)%mod
    else:  # standard case ② n is odd
        return (x * (pow_r(x ** 2, (n - 1) // 2)))%mod

for i in range(N-1):
    #(i+1)%(mod-2)を計算してyへ
    y = pow_r(i+1,mod-2)
    #x+= kaijou//(i+1))%(10**9+7)
    x += kaijou*y
    ans += d[i]*x
    ans %= mod

print(ans)
### BUGGY CODE ###

import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda x: [ni() for _ in range(x)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

import numpy as np

n, k = na()
p = na()

ans = 0.0
for i in range(n - k + 1):
    s = 0.0
    for j in range(k):
        a = (p[i + j] * (p[i + j] + 1) // 2) * (1 / p[i + j])
        s += a
    ans = max(ans, s)

print(ans)

### FIXED CODE ###

import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda x: [ni() for _ in range(x)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

n, k = na()
p = na()
d = [0] * (n + 1)
for i in range(n):
    a = (p[i] * (p[i] + 1) // 2) * (1 / p[i])
    d[i + 1] = d[i] + a

ans = 0.0
for i in range(n - k + 1):
    a = d[i + k] - d[i]
    ans = max(ans, a)

print(ans)
### BUGGY CODE ###

import bisect
n=int(input()) 
L=list(map(int, input().split())) 
L.sort()

#m = bisect.bisect_left(l, a + b)
#count += (m - j - 1)
    
count = 0        
for i in range(n-1):
  a = L[i]
  for k in range(i+1,n-1):
    b = L[k]
    L_temp = L[k+1:]
    count += (bisect.bisect_left(L_temp, a + b)) 
print(count)

### FIXED CODE ###

import bisect
n=int(input()) 
L=list(map(int, input().split())) 
L.sort()

count = 0        
for i in range(n-2):
  a = L[i]
  for k in range(i+1,n-1):
    b = L[k]

    count += bisect.bisect_left(L, a + b) - k -1
print(count)
### BUGGY CODE ###

a,b,k=map(int,input().split())
for i in range(a,b+1):
  if i < a+k or i> b-k:
    print(i)

### FIXED CODE ###

a,b,k=map(int,input().split())
tmp=[]

if a+k<b+1:
  e = a+k
else:
  e = b+1
for i in range(a,e):
  tmp.append(i)

if a<b-k+1:
  f = b-k+1
else:
  f = a
for i in range(f,b+1):
  tmp.append(i)

ans = sorted(set(tmp))
for i in ans:
  print(i)
### BUGGY CODE ###

a, b, c = map(int, input().split())#赤midoriao
k = int(input())
#赤＜緑＜青
if a < b and b<c:
  print("Yes")
else:
  while k > 0:
    if a >= b:
      b = b*2
      k-=1
      if k==0:
        break
    if b >= c and k>0:
      c = c*2
      k -=1
  if a < b and b < c:
    print("Yes")
  else:
    print("No")
    

### FIXED CODE ###

a, b, c = map(int, input().split())#赤midoriao
k = int(input())
#赤＜緑＜青
if (a < b) and (b<c):
  print("Yes")
else:
  while (a>=b) and (k>0):
    b = b*2
    k-=1
  #print(b)
  #print(k)
  while (b>=c) and (k>0):
    c = c*2
    k-=1
  #print(c)
  #print(k)
#print(a,b,c,k)
  if (a < b) and (b<c) and (k>=0):
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

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

"""
1からのループだけを考えれば良い
"""

i = A[0]
ok = True
R = [1]
seen = [0] * N
seen[0] = 1


while ok:
    seen[i-1] += 1
    R.append(i)
    i = A[i-1]
    if seen[i-1] == 1:
        ind = R.index(i)
        loop = R[ind:]
        remain = R[:ind]
        ok = False

L = len(loop)

if K < len(remain):
    print(remain[K])
else:
    print(loop[(K - len(remain)) % L])

### FIXED CODE ###

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

"""
1からのループだけを考えれば良い
"""

i = A[0]
ok = True
R = [1]
seen = [0] * N
seen[0] = 1
count = 1

if A[0] == 1:
    print(1)
    exit()

while ok:
    count += 1
    seen[i-1] += count
    R.append(i)
    i = A[i-1]
    # 訪れたことがあれば
    if seen[i-1] != 0:
        k = seen[i-1]
        loop = R[k-1:]
        remain = R[:k-1]
        ok = False

L = len(loop)

if K < len(remain):
    print(remain[K])
else:
    print(loop[(K - len(remain)) % L])
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# 18:01 -> 18:36 (give up. TLE)
from collections import deque

dx = [0,1,0,-1]
dy = [1,0,-1,0]

H, W = map(int, input().split())

A = []
first_black = []

for i in range(H):
    A.append(list(input()))
    first_black.extend([(i,j) for j in range(W) if A[i][j] == '#'])

for x,y in first_black:
    A[x][y] = 0

black_deque = deque()
black_deque.extend(first_black)

while len(black_deque) != 0:
    x,y = black_deque.popleft()
    depth = A[x][y]
    for k in range(4):
        new_x = x+dx[k]
        new_y = y+dy[k]
        if 0 <= new_x < H and \
           0 <= new_y < W and \
           A[new_x][new_y] == '.':
            black_deque.append((new_x, new_y))
            A[new_x][new_y] = depth+1

print(depth)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 18:01 -> 18:36 (give up. TLE)
from collections import deque

dx = [0,1,0,-1]
dy = [1,0,-1,0]

H, W = map(int, input().split())

A = []
black_deque = deque()

for i in range(H):
    A.append(list(input()))
    black_deque.extend([(i,j) for j in range(W) if A[i][j] == '#'])

if len(black_deque) == H*W:
    print(0)
    exit(0)

for x,y in black_deque:
    A[x][y] = 0

while len(black_deque) != 0:
    x,y = black_deque.popleft()
    depth = A[x][y]
    for k in range(4):
        new_x = x+dx[k]
        new_y = y+dy[k]
        if 0 <= new_x < H and \
           0 <= new_y < W and \
           A[new_x][new_y] == '.':
            black_deque.append((new_x, new_y))
            A[new_x][new_y] = depth+1

print(depth)
### BUGGY CODE ###

def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
import sys
sys.setrecursionlimit(10**6)
n=i1()
s=i2()
import heapq
import bisect
s.sort()
heapq.heapify(s)
x=[s[-1]]
s.pop(-1)
a="Yes"
for i in range(n):
 y=[]
 for j in range(1<<i):
   z=bisect.bisect_left(s,x[j])-1
   if z<0:
     a="No"
   y.append(s[z])
   s.pop(z)
 x+=y
 x.sort(reverse=True)
print(a)

### FIXED CODE ###

def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
s=i2()
m=10**9+1
s.sort(reverse=True)
x=[s[0]]
s[0]=m
a="Yes"
for i in range(n):
 y=[]
 k=0
 for j in range(len(s)):
   if k>=len(x):
      break
   if s[j]<x[k]:
     y.append(s[j])
     s[j]=m
     k+=1
 x+=y
 x.sort(reverse=True)
if k==(1<<(n-1)):
   print("Yes")
else:
   print("No")
### BUGGY CODE ###

from heapq import heapify, heappop, heappush

def dijkstra(start,node,edge):
    d = [2*10**5] * node
    m = [0]*node
    d[start] = 0
    q = [0]
    heapify(q)
    
    while(len(q) != 0):
      i = heappop(q)
      for j in edge[i]:
        if(d[j] > d[i] + 1):
          d[j] = d[i] + 1
          heappush(q, j)
          m[j] = i
    return d, m

def main():
    N,M = map(int, input().split())
    
    E = [[] for _ in [0]*N]
    
    for i in range(M):
      a,b = (int(x) for x in input().split())
      E[a-1].append(b-1)
      E[b-1].append(a-1)

    d, m = dijkstra(0, N, E)
    # print(d, m)
    print("Yes")
    for i in range(1,N):
      print(m[i]+1)

if __name__ == '__main__':
    main()


### FIXED CODE ###

from heapq import heapify, heappop, heappush

def dijkstra(start,node,edge):
    d = [2*10**5] * node
    m = [0]*node
    d[start] = 0
    q = [(0,0)]
    heapify(q)
    
    while(len(q) != 0):
      ci, i = heappop(q)
      di = d[i]
      for j in edge[i]:
        if(d[j] > di+1):
          d[j] = di + 1
          heappush(q, (di+1,j))
          m[j] = i+1
    return m

def main():
    N,M = map(int, input().split())
    
    E = [[] for _ in [0]*N]
    for i in range(M):
      a,b = (int(x) for x in input().split())
      E[a-1].append(b-1)
      E[b-1].append(a-1)

    m = dijkstra(0, N, E)
    print("Yes")
    print("\n".join(map(str, m[1:])))

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
ans = 0
for i in range(1, n + 1):
    now = 0
    for c in str(i):
        now += int(c)
    ans = max(ans, now)
print(ans)

### FIXED CODE ###

n = list(input())
ans = 0
if len(n[1:]) == n[1:].count('9'):
    ans = sum(list(map(int, n)))
else:
    ans = int(n[0]) - 1 + 9 * (len(n) - 1)
print(ans)
### BUGGY CODE ###

import math

def make_prime_list_2(num):
    if num < 2:
        return []

    # 0のものは素数じゃないとする
    prime_list = [i for i in range(num + 1)]
    prime_list[1] = 0 # 1は素数ではない
    num_sqrt = math.sqrt(num)

    for prime in prime_list:
        if prime == 0:
            continue
        if prime > num_sqrt:
            break

        for non_prime in range(2 * prime, num, prime):
            prime_list[non_prime] = 0

    return [prime for prime in prime_list if prime != 0]

def search_divisor_num_1(num):
    if num < 0:
        return None
    elif num == 1:
        return 1
    else:
        num_sqrt = math.floor(math.sqrt(num))

        divisor_num = 1
        for prime in prime_list:
            count = 1
            while num % prime == 0:
                num //= prime
                count += 1
            divisor_num *= count

        if num != 1:
            divisor_num *= 2

        return divisor_num

N = int(input())

prime_list = make_prime_list_2(N+1)
print(sum(k*search_divisor_num_1(k) for  k in range(1,N+1)) )

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
    for j in range(i, N+1, i):
        ans += j
print(ans)
### BUGGY CODE ###

import math

S = input().strip()
Q = int(input().strip())

for i in range(Q):
  q = input().strip().split()
  #print(q)
  if q[0] == '1':
    # 反転
    S = S[::-1]    
  else:
    F = q[1]
    if F == '1':
      # 先頭にCを追加
      S = q[2] + S     
    else:
      # 末尾にCを追加
      S = S + q[2]
    
print(S)

### FIXED CODE ###

import math

S = input().strip()
Q = int(input().strip())
order = 1
tmp = 'T'

for i in range(Q):
  q = input().strip().split()
  #print(q)
  if q[0] == '1':
    # 反転
    # S = S[::-1]
    order *= -1
  else:
    F = q[1]
    if F == '1':
      if order == 1:
        # 先頭にCを追加
        # S = q[2] + S
        tmp = q[2] + tmp
      else:
        # 末尾にCを追加
        # S = S + q[2]
        tmp = tmp + q[2]
    else:
      if order == 1:
        # 末尾にCを追加
        # S = S + q[2]        
        tmp = tmp + q[2]
      else:
        # 先頭にCを追加
        # S = q[2] + S
        tmp = q[2] + tmp

S = tmp.replace('T', S)        
print(S[::order])
### BUGGY CODE ###

N, A, B, K = [int(_) for _ in input().split()]

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a

L = 300000+1
M = 998244353

Fm = {}
inverseFm = {}
x = 1
for i in range(L):
    Fm[i] = x
    x = x * (i + 1) % M

def inverseFm(x, cache={}):
    if x in cache:
        return cache[x]
    result = pow(Fm[x], M - 2, M)
    cache[x] = result
    return result

def C(n, r):
    result = Fm[n] * inverseFm(r) * inverseFm(n - r) % M
    return result

def solve(N, A, B, K):
    g = gcd(gcd(A, B), K)
    A, B, K = A//g, B//g, K//g
    if A > B:
        A, B = B, A
    l = A * B // gcd(A, B)
    x = K
    for i in range(min(N + 1, l)):
        if x % B == 0:
            break
        x -= A
    else:
        return 0
    result = 0
    for a in range(i, N + 1, B):
        b = (K - A * a) // B
        for x in range(max(0, a-b), min(N-b+1, a+1)):
            y = a - x
            z = b - y
            d = Fm[N] * inverseFm(x) * inverseFm(y) * inverseFm(z) * inverseFm(N - x - y - z) % M
  #          print("s", x, y, z)
            result = (result + d) % M
    return result 

def solve0(N, A, B, K):
    result = 0
    for x in range(0, N + 1):
        for y in range(0, N + 1 - x):
            for z in range(0, N + 1 - x - y):
                if A * x + (A + B) * y + B * z == K:
 #                   print("s0", x, y, z)
                    d = Fm[N] * inverseFm(x) * inverseFm(y) * inverseFm(z) * inverseFm(N - x - y - z) % M
                    result = (result + d) % M
    return result                   


def check():
    import random
    for i in range(100):
        N = random.randint(1, 20)
        A = random.randint(1, 20)
        B = random.randint(1, 20)
        K = random.randint(1, 20)
        r = solve(N, A, B, K)
        r0 = solve0(N, A, B, K)
        if r != r0:
            print(N, A, B, K, r, r0)

#check()
print(solve(N, A, B, K))
#print(solve0(N, A, B, K))


### FIXED CODE ###

N, A, B, K = [int(_) for _ in input().split()]

L = 300000+1
M = 998244353

Fm = {}
inverseFm = {}
x = 1
for i in range(L):
    Fm[i] = x
    x = x * (i + 1) % M

def inverseFm(x, cache={}):
    if x in cache:
        return cache[x]
    result = pow(Fm[x], M - 2, M)
    cache[x] = result
    return result

def C(n, r):
    result = Fm[n] * inverseFm(r) * inverseFm(n - r) % M
    return result

def solve(N, A, B, K):
    result = 0
    for a in range(0, N+1):
        b, m = divmod(K - A * a, B)
        if m == 0 and 0 <= b <= N:
            result += C(N, a) * C(N, b) % M
    return result % M

print(solve(N, A, B, K))
### BUGGY CODE ###

# Python3 (3.4.3)
import sys

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
S = input()
T = input()

chars1 = set()
for t in T:
    chars1.add(t)
chars2 = set()
for s in S:
    chars2.add(s)

for c in chars1:
    if c not in chars2:
        print(-1)
        sys.exit()

idx = S.index(T[0])
ans = idx+1
for i in range(1,len(T)):
    S = S[idx+1:] + S[:idx+1]
    idx = S.index(T[i])
    ans += idx+1

print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
#ABC138 E

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
n = len(s)
m = len(t)
f = [False]*26
f2 = [False]*26
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n):
    f[alpha.index(s[i])] = True
for i in range(m):
    f2[alpha.index(t[i])] = True
for i in range(26):
    if not f[i] and f2[i]:
        print(-1)
        quit()
ans = 0
inde = s.index(t[0])
ans += inde+1
for i in range(1,m):
    s = s[inde+1:] + s[:inde+1]
    inde = s.index(t[i])
    ans += inde+1
print(ans)
### BUGGY CODE ###

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

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

count = 0

for x in range(0, k+1):
    for y in range(0, k+1):
        for z in range(0, k+1):
            if x+y+z == s:
                count += 1

print(count)


### FIXED CODE ###

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

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

count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - (x+y)
        if (z>= 0) and (z <= k):
           count += 1
print(count)
### BUGGY CODE ###

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

def dice_expctations(num:int)->float:
    return (num+1) / 2

E = list(map(dice_expctations, P))

back = 0
head = k-1
ans = 0
while head <= n-1:
    tmp = 0
    for i in range(back, head+1):
        tmp += E[i]
    if tmp > ans:
        ans = tmp
    else:
        pass
    back += 1
    head += 1

print(ans)




### FIXED CODE ###

N,K=map(int,input().split())
p=list(map(int,input().split()))
pE=list(map(lambda i :(1+i)/2,p))
pA=[sum(pE[0:K])]
inter=sum(pE[0:K])
for i in range(0,N-K):
    inter=inter+pE[K+i]-pE[i]
    pA.append(inter)

ans=max(pA)
print(ans)
### BUGGY CODE ###

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

Magic = [list(map(int, input().split())) for i in range(N)]
MAX_COST = max(Magic)[1]

# dp[damage] := モンスターに damage を与えるために必要な最小コスト
dp = [float("inf")] * (H + 1)
dp[0] = 0
for h in range(H):
    for damage, cost in Magic:
        next_index = min(h + damage, H)
        dp[next_index] = min(dp[next_index], dp[h] + cost)

print(dp[-1])


### FIXED CODE ###

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

a = [0] * n
b = [0] * n

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

magic = [float("inf")] * (h + 1)
magic[0] = 0

for i in range(n):
    for j in range(0, h + 1):
        if j + a[i] <= h:
            magic[j + a[i]] = min(magic[j + a[i]], magic[j] + b[i])
        else:
            magic[h] = min(magic[h], magic[j] + b[i])

print(magic[h])
### BUGGY CODE ###

n,q = map(int,input().split())
S = input()
ac_list = []
question_list = []
for i in range(len(S)+1):
    ac_list.append(S[:i].count("AC"))
for _ in range(q):
    l, r = map(int,input().split())
    question_list.append([l,r])
for l,r in question_list:
    print(ac_list[r]-ac_list[l])

### FIXED CODE ###

n,q = map(int,input().split())
S = input()
ac_list = [0,0]
question_list = []
for i in range(len(S)-1):
    if S[i:i+2] == "AC":
        ac_sum = ac_list[i+1] + 1
        ac_list.append(ac_sum)
    else:
        ac_list.append(ac_list[-1])
for _ in range(q):
    l, r = map(int,input().split())
    question_list.append([l,r])
for l,r in question_list:
    print(ac_list[r]-ac_list[l])
### BUGGY CODE ###

import itertools

iCnt = int(input())
v = list(input())

vAns = []
vProduct = []
iOnIndex = 0
while iOnIndex + 1 < len(v):
    iLen = len(v[-len(v) + iOnIndex + 1:])
    vProduct = list(itertools.product([0, 1], repeat=iLen))
    for p in vProduct:
        sChk = v[iOnIndex]
        for i in range(len(p)):
            if p[i] == 1:
                if v[iOnIndex + i + 1] not in sChk:
                    sChk += v[iOnIndex + i + 1]
                else:
                    sChk = "NG"
                    break
        if "NG" not in sChk: vAns.append(sChk)
    iOnIndex += 1
vAns.append(v[len(v) - 1])
print(len(vAns) % (10 ** 9 + 7))

### FIXED CODE ###

from collections import defaultdict

iCnt = int(input())
S = input()
M = 10**9 + 7

vCntDct = defaultdict(int)

for s in S:
    vCntDct[s] += 1

ans = 1
for v in vCntDct.values():
    ans *= (v + 1)
    ans %= M

print(ans - 1)
### BUGGY CODE ###


def create_count_dic(text):
    count_dic = {}
    for t in text:
        if t in count_dic:
            count_dic[t] += 1
        else:
            count_dic[t] = 1
    return count_dic

N = int(input())
S = [create_count_dic(input()) for x in range(N)]
ans = 0

for i in range(N):
    for j in range(i+1, N):
        if S[i] == S[j]:
            ans += 1

print(ans)


### FIXED CODE ###

from collections import defaultdict
counter = defaultdict(int)
N = int(input())
for i in range(N):
    counter[tuple(sorted(list(input())))] += 1
ans = 0
for n in counter.values():
    ans += n * (n - 1) // 2
print(ans)