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

N,Y = map(int,input().split())
for i in range(N+1):
  for j in range(N-i+1):
    for j in range(N-i-j+1):
      if 10000*i + 5000*j + 1000*(N-i-j) == Y:
        print(i,j,N-i-j)
        exit()
      elif i == N:
        print("-1 -1 -1")

### FIXED CODE ###

N,Y = map(int,input().split())
for i in range(N+1):
  for j in range(N-i+1):
      if 10000*i + 5000*j + 1000*(N-i-j) == Y:
        print(i,j,N-i-j)
        exit()
      elif i == N:
        print("-1 -1 -1")
### BUGGY CODE ###

import sys
inputs = sys.stdin.readlines()

N = int(inputs[0])

s = 0
for i in range(1, N+1):
    s += i
print(s-N)

### FIXED CODE ###

import sys
inputs = sys.stdin.readlines()

N = int(inputs[0])

print((N-1)*N // 2)
### BUGGY CODE ###

N,K = map(int, input().split())
S = []
for i in range(K):
    L,R = map(int, input().split())
    S += [ j for j in range(L,R+1)]
S = set(S)

step = [0]*(N+1)
step[1] = 1

S_min = min(S)
for j in range(1,N-S_min+1):
    for s in S:
        if j + s > N or step[j] == 0:
            continue
        step[j+s] += (step[j]%998244353)
        step[j+s] %= 998244353
print(step[N])

### FIXED CODE ###

mod = 998244353
n, k = map(int, input().split())
lr = [list(map(int, input().split())) for i in range(k)]
for i in range(k):
    lr[i][1] += 1

dp = [0]*n
dp[0] = 1
for i in range(1,n):
    dp[i] = dp[i-1]
    if i == 1:
        dp[1] = 0
    for l,r in lr:
        if i - l >= 0:
            dp[i] += dp[i-l]
        if i - r >= 0:
            dp[i] -= dp[i-r]
        dp[i] %= mod
print(dp[n-1])
### BUGGY CODE ###

from functools import reduce
import math
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
def modinv(a, m):
    g, x, y = xgcd(a, m)
    return x % m
def modmul(a,b):
    return a * b % 998244353
def comb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(modmul, range(n, n - r, -1))
    under = reduce(modmul, range(1,r + 1))
    return over * modinv(under, 998244353)
def mempow(a,b):
    temp = 1
    yield temp
    for i in range(b):
        temp = temp * a % 998244353
        yield temp

N,M,K = (int(x) for x in input().split())
mem = []
mappend = mem.append
for x in mempow(M-1,N-1):
    mappend(x)
ans = 0
if M == 1:
    if K + 1 < N:
        print('0')
    else:
        print('1')
else:
    for i in range(K+1):
        ans = (ans + (comb(N-1,i)*M*pow(M-1,N-i-1,998244353))) % 998244353
    print(ans)

### FIXED CODE ###

from functools import reduce
import math
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
def modinv(a, m):
    g, x, y = xgcd(a, m)
    return x % m
def modmul(a,b):
    return a * b % 998244353
def comb(n,r,m):
    if r == 0: return 1
    return memf[n]*pow(memf[r],m-2,m)*pow(memf[n-r],m-2,m)
def mempow(a,b):
    temp = 1
    yield temp
    for i in range(b):
        temp = temp * a % 998244353
        yield temp
def memfact(a):
    temp = 1
    yield temp
    for i in range(1,a+1):
        temp = temp * i % 998244353
        yield temp

N,M,K = (int(x) for x in input().split())
memp = []
memf = []
mpappend = memp.append
mfappend = memf.append
for x in mempow(M-1,N-1):
    mpappend(x)
for x in memfact(N-1):
    mfappend(x)
ans = 0
if M == 1:
    if K + 1 < N:
        print('0')
    else:
        print('1')
else:
    i = 0
    for i in range(K+1):
        ans = (ans + (comb(N-1,i,998244353)*M*memp[N-i-1])) % 998244353
    print(ans)
### BUGGY CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

sys.setrecursionlimit(50000000)

class check():
    def __init__(self):
        readline=sys.stdin.readline
        n,q=map(int, readline().rstrip().split())
        self.tree=[[] for i in range(n)]
        self.ans=[0]*n
        for i in range(n-1):
            a,b=map(int, readline().rstrip().split())
            a-=1
            b-=1
            self.tree[a].append(b)
            self.tree[b].append(a)
        for i in range(q):
            p,x=map(int, readline().rstrip().split())
            p-=1
            self.ans[p]+=x
    def do(self,root,next):
        if root >= 0:
            self.ans[next]+=self.ans[root]
        for a in self.tree[next]:
            if a==root:
                continue
            self.do(next,a)
    def answer(self):
        print(" ".join(map(str,self.ans)))

def resolve():
    readline=sys.stdin.readline

    dfs=check()
    dfs.do(-1,0)
    dfs.answer()

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

### FIXED CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

sys.setrecursionlimit(50000000)

class check():
    def __init__(self,n,q):
        readline=sys.stdin.readline
        self.tree=[[] for i in range(n)]
        self.ans=[0]*n
        for i in range(n-1):
            a,b=map(int, readline().rstrip().split())
            a-=1
            b-=1
            self.tree[a].append(b)
            self.tree[b].append(a)
        for i in range(q):
            p,x=map(int, readline().rstrip().split())
            p-=1
            self.ans[p]+=x
    def do(self,root,next):
        if root >= 0:
            self.ans[next]+=self.ans[root]
        for a in self.tree[next]:
            if a==root:
                continue
            self.do(next,a)
    def answer(self):
        print(" ".join(map(str,self.ans)))






def resolve():
    readline=sys.stdin.readline

    n,q=map(int, readline().rstrip().split())
    c=check(n,q)
    c.do(-1,0)
    c.answer()

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
### BUGGY CODE ###

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


def main():
    n = int(input())
    p = list(map(float, input().split()))
    dp = [[0 for _ in range(n + 3)] for _ in range(n + 3)]

    # 初期化
    dp[0][0] = 1.0

    # KeyInsight
    # dp[i][j] := 最初の i 枚のコインを投げたときに、表が j 枚となる確率
    # ・状態：確率
    # ・すべての候補，条件に一致する候補をdpで管理
    # See:
    # https://qiita.com/drken/items/03c7db44ccd27820ea0d#i-%E5%95%8F%E9%A1%8C---coins
    for i in range(n):
        for j in range(i + 1):
            # 表
            dp[i + 1][j + 1] += dp[i][j] * p[i]
            # 裏
            dp[i + 1][j] += dp[i][j] * (1 - p[i])

    ans = 0

    # 表が多い場合のみ計算
    for j in range((n + 1) // 2, n + 1):
        ans += dp[n][j]

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

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


def main():
    n = int(input())
    p = list(map(float, input().split()))
    dp = [[0 for _ in range(n + 100)] for _ in range(n + 100)]

    # 初期化
    dp[0][0] = 1.0

    # KeyInsight
    # dp[i][j] := 最初の i 枚のコインを投げたときに、表が j 枚となる確率
    # ・状態：確率
    # ・すべての候補，条件に一致する候補をdpで管理
    # See:
    # https://qiita.com/drken/items/03c7db44ccd27820ea0d#i-%E5%95%8F%E9%A1%8C---coins
    for i in range(n):
        for j in range(i + 1):
            # 表
            dp[i + 1][j + 1] += dp[i][j] * p[i]
            # 裏
            dp[i + 1][j] += dp[i][j] * (1 - p[i])

    ans = 0

    # 表が多い場合のみ計算
    for j in range((n + 1) // 2, n + 1):
        ans += dp[n][j]

    print(ans)


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

N = int(input())
a = input().split()
list_i = [int(b) for b in a]

#print(N)
#print(list_i)

for i in range(N):
  print(list_i.count(i+1))
  

### FIXED CODE ###

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

C = collections.Counter(A)
#print(C)

for i in range(N):
  #print(A.count(i+1))
  print(C[i+1])
### BUGGY CODE ###

import bisect
N = int(input())
A = list(map(int, input().split()))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
l_c = len(C)
ans = 0
for a in A:
    i = bisect.bisect_right(B, a)
    for b in B[i:]:
        j = bisect.bisect_right(C, b)
        ans += l_c - j
print(ans)


### FIXED CODE ###

import bisect
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
l_c = len(C)
ans = 0
for b in B:
    n_a = bisect.bisect_left(A, b)
    n_c = l_c - bisect.bisect_right(C, b)
    ans += n_a*n_c
print(ans)
### BUGGY CODE ###

n, b, r = map(int, input().split())
ans = 0

while n > 0:
    ans += min(n, b)
    n -= b + r

print(ans)


### FIXED CODE ###

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

ans = n // (b + r) * b
n = n % (b + r)

ans += min(n, b)

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

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

for i in range(K):
    if A > 0:
        A -= 1
    elif B > 0:
        B -= 1
    else:
        break

print(A, B)

### FIXED CODE ###

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

if K <= A:
    A -= K
else:
    A, B = 0, max(0, B-K+A)

print(A, B)
### BUGGY CODE ###

N = int(input())
import heapq as h
A = list(map(int, input().split()))


# use 0 based index
sum_red, sum_blue = [], []

head = A[:N]
tail = [-x for x in A[-N:]]
h.heapify(head)
h.heapify(tail)
sum_red.append(sum(head))
sum_blue.append(-sum(tail))
for k in range(N, 2*N):
    h.heappushpop(head, A[k])
    sum_red.append(sum(head))
    h.heappushpop(tail, -A[-k-1])
    sum_blue.append(-sum(tail))


print(max([r-b for r, b in zip(sum_red, sum_blue[::-1])]))


### FIXED CODE ###

N = int(input())
import heapq as h
A = list(map(int, input().split()))


# use 0 based index
sum_red, sum_blue = [], []

head = A[:N]
tail = [-x for x in A[-N:]]
h.heapify(head)
h.heapify(tail)
sum_red.append(sum(head))
sum_blue.append(-sum(tail))
# keypoint: いちいちsumすると線形時間かかるのでsum_hoge[-1]でアクセスする
for k in range(N, 2*N):
    num_sub = h.heappushpop(head, A[k])
    sum_red.append(sum_red[-1]-num_sub+A[k])
    num_sub = -h.heappushpop(tail, -A[-k-1])
    sum_blue.append(sum_blue[-1]-num_sub+A[-k-1])


print(max([r-b for r, b in zip(sum_red, sum_blue[::-1])]))
### BUGGY CODE ###



N,K,Q = map(int, input().split())

point = [K] * N
for _ in range(Q):
    winnner = int(input())
    lose_point = [1] * N
    lose_point[winnner-1] = 0
    point = [x-y for (x,y) in zip(point,lose_point)]

for p in point:
    if(p>0):
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

N,K,Q = map(int, input().split())

point = [0] * N
for _ in range(Q):
    winnner = int(input())
    point[winnner-1] += 1

for p in point:
    if(p>Q-K):
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

import sys
sys.setrecursionlimit(200000)

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

Adj_dict = {}
for i in range(n):
    new = {i:[]}
    Adj_dict.update(new)
for _ in range(n-1):
    a,b = map(int, input().split())
    Adj_dict[a-1].append(b-1)
    Adj_dict[b-1].append(a-1)

PX_dict = {}
for _ in range(q):
    p,x = map(int, input().split())
    if p-1 in PX_dict.keys():
        PX_dict[p-1] += x
    else:
        new = {p-1:x}
        PX_dict.update(new)

Visited = [False for _ in range(n)]
Ans = [0 for _ in range(n)]

def tree_counter(Adj=Adj_dict, PX=PX_dict, start=0, counter=0, Visited=Visited, Ans=Ans):
    
    # 終端処理
    if Visited[start] == True:
        return
    
    # Visit処理
    Visited[start] = True
    if start in PX.keys():
        counter += PX[start]
    Ans[start] = str(counter)

    for node in Adj[start]:
        if Visited[node] == False:
            tree_counter(Adj_dict, PX_dict, node, counter, Visited, Ans)
    
    return

tree_counter()
print(' '.join(Ans))

### FIXED CODE ###

from collections import deque

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

P, X = [], []
Counter = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split())
    Counter[p-1] += x

visited = set()
visited.add(0)

dq = deque()
dq.append(0)

while dq:
    x = dq.popleft()
    for j in Adj[x]:
        if j not in visited:
            visited.add(j)
            dq.append(j)
            Counter[j] += Counter[x]
ans = ''
for i in range(n-1):
    ans += str(Counter[i]) + ' '
ans += str(Counter[n-1])
print(ans)
### BUGGY CODE ###

#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2)
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
#input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

#enumerate input

def main():
    h,w=map(int,input().split())
    stack=deque()
    grid=[["#"]*(w+2)]
    for i in range(h):
        tmp=[]
        for k,v in enumerate(input()):
            if v=="#":
                tmp.append("#")
                stack.appendleft((i+1,k+1))
            else:
                tmp.append(v)
        grid.append(["#"]+tmp+["#"])
    grid.append(["#"]*(w+2))
#    for i in grid:
#        print(*i)
    for i in range(h*w):
        tmp=deque()
        while stack:
            y,x=stack.pop()
            for my,mx in ((0,1),(1,0),(-1,0),(0,-1)):
                if grid[y+my][x+mx]==".":
                    grid[y+my][x+mx]="#"
                    tmp.appendleft((y+my,x+mx))
        stack=tmp
        if not len(stack):
            print(i)
            exit()
if __name__ == '__main__':
    main()

### FIXED CODE ###

from heapq import*
h,w=map(int,input().split())
grid=[["#"]*(w+2)]+[list("#"+input()+"#")for x in range(h)]+[["#"]*(w+2)]

stack=[]
for y in range(1,h+1):
    for x in range(1,w+1):
        if grid[y][x]=="#":
            grid[y][x]=0
            stack.append((y,x))

for i in range(h*w):
    tmp=[]
    for my,mx in stack:
        for y,x in ([0,1],[1,0],[-1,0],[0,-1]):
            if grid[my+y][mx+x]==".":
                grid[my+y][mx+x]=i+1
                tmp.append([my+y,mx+x])
    stack=tmp
    if len(tmp)==0:
        print(i)
        break
### BUGGY CODE ###

import sys
pin=sys.stdin.readline

S=pin()[:-1]
Q=int(pin())
now=1

for i in range(Q):
  D=pin().split()
  T=0
  F=0
  C=""
  if len(D)==1:
    T=int(D[0])
  else:
    T=int(D[0])
    F=int(D[1])
    C=D[2]
  if T==1:
    now*=-1
  else:
    if F==1:
      if now==1:
        S=C+S
      else:
        S=S+C
    else:
      if now==1:
        S=S+C
      else:
        S=C+S
if now==1:
  print(S)
else:
  print(S[::-1])

### FIXED CODE ###

import sys
pin=sys.stdin.readline

S=pin()[:-1]
Q=int(pin())
now=1
ans1=""
ans2=""
for i in range(Q):
  D=pin().split()
  T=0
  F=0
  C=""
  if len(D)==1:
    T=int(D[0])
  else:
    T=int(D[0])
    F=int(D[1])
    C=D[2]
  if T==1:
    now*=-1
  else:
    if F==1:
      if now==1:
        ans1=C+ans1
      else:
        ans2=ans2+C
    else:
      if now==1:
        ans2=ans2+C
      else:
        ans1=C+ans1
if now==1:
  print(ans1+S+ans2)
else:
  print(ans2[::-1]+S[::-1]+ans1[::-1])
### BUGGY CODE ###

import fractions
from functools import reduce


def gcd(numbers):
    return reduce(fractions.gcd, numbers)


def solve():
    N, *A = map(int, open(0).read().split())
    
    ans = 0
    for i in range(N):
        ans = max(ans, gcd(A[:i]+A[i+1:]))
    print(ans)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

from fractions import gcd


def solve():
    N, *A = map(int, open(0).read().split())
    
    ans = 0
    left = [0 for _ in range(N+1)]
    right = [0 for _ in range(N+1)]
    for i in range(N):
        left[i+1] = gcd(left[i], A[i])
    for i in range(N-1, -1, -1):
        right[i] = gcd(right[i+1], A[i])
    for i in range(N):
        ans = max(ans, gcd(left[i], right[i+1]))
    print(ans)


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

s = input()
l = len(s)

if l < 4:
    print(0)
    exit()

ans = 0
for i in range(0,l-3):
    for j in range(i+1,l+1):
        temp = int(s[i:j])
        if temp%2019 == 0:
            ans += 1

print(ans)

### FIXED CODE ###

s = input()[::-1]
n = len(s)
amari = [0]*2019
amari[0] = 1

temp = 0
d = 1
for char in s:
    temp += int(char)*d
    temp %= 2019
    d *= 10
    d %= 2019  
    amari[temp] += 1

ans = 0
for i in amari:
    ans += i*(i-1)/2

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

def sq(a, b, mod):  # aのb乗を剰余,kは初期値#20191116-D-Knight
    if b == 0:
        return 1
    elif b % 2 == 0:
        return sq(a, b // 2, mod)**2 % mod
    else:
        return sq(a, b - 1, mod) * a % mod


def nCk(n, k, mod=10 ** 9 + 7):
    x = max(k, n - k)
    y = min(k, n - k)
    kkai = 1
    for i in range(2, y + 1):
        kkai = (kkai * i) % mod
    nkkai = 1
    for i in range(x + 1, n + 1):
        nkkai = (nkkai * i) % mod
    answer = sq(kkai, mod - 2, mod) * nkkai % mod
    return answer

n = int(input())
alist = list(map(int, input().split()))
m = max(alist)
ans = 0
ans_ = (0, 0)
sbn = 10**10
for a in alist:
    if a == m:
        continue
    sbn_ = abs(m//2-a)
    if sbn_ < sbn :
        sbn = sbn_
        nck = nCk(m, a)
        # print(nck)
        ans = nck
        ans_ = (m, a)
print(ans_[0], ans_[1])


### FIXED CODE ###

n = map(int, input().split())
alist = list(map(int, input().split()))
m = max(alist)
sbn = 10**10
for a in alist:
    if abs(m/2 - a) < sbn and a != m:
        ans = a
        sbn = abs(m/2 - a)
print(m, ans)
### BUGGY CODE ###

import collections
n=int(input())
s=input()
ans=0
d=collections.defaultdict(int)
for i in range(n):
  t=s[i]
  if d[t]==0:
    d[t]=i
  else:
    ans=max(ans,1)
  for j in range(i+1,n):
    t+=s[j]
    if d[t]==0:
      d[t]=j
    else:
      if d[t]<i:
        ans=max(ans,j-i+1)
print(ans)

### FIXED CODE ###

import collections
mod=10**9+7
base=257
n=int(input())
S=list(ord(s)-96 for s in input())
B=[0]*(n+1)
B[0]=1
for i in range(n):
  B[i+1]=(B[i]*base)%mod

def chk(x):
  ret=False
  h=0
  bx=B[x]
  d=collections.defaultdict(int)
  for i in range(x):
    h=(h*base+S[i])%mod
  d[h]=x
  for i in range(x,n):
    h=(h*base+S[i]-S[i-x]*bx)%mod
    if d[h]==0:
      d[h]=i+1
    elif d[h]<=i-x+1:
      ret=True
  return ret

l,r=0,n//2
while r-l>1:
  m=(l+r)//2
  if chk(m):
    l=m
  else:
    r=m
print(r if chk(r) else l)
### BUGGY CODE ###

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

k = []
for i in range(1,min(a,b)+1):
	if a % i == 0 and b % i == 0:
		k.append(i)

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

l = []
l.append(k[0])
ans = 1

for i in range(1,len(k)):
	flag = True
	for j in range(len(l)):
		if not gcd(k[i],l[j]):
			flag = False
			break
	if flag:
		l.append(k[i])
		ans += 1

print(ans)


### FIXED CODE ###

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

def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	# divisors.sort()
	return divisors

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

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

#factorization(24)
## [[2, 3], [3, 1]]
##  24 = 2^3 * 3^1

g = gcd(a,b)
#gcd_list = make_divisors(g)
bunkai = factorization(g)

if len(bunkai) == 1 and bunkai[0][0] == 1:
	print(1)
else:
	print(len(bunkai) + 1 )
### BUGGY CODE ###

N = int(input())
S = input()

def judge(S,A): #A:3桁ｎ数字
    dig,pt = 0,0
    while dig < 3 and pt < N:
        if S[pt] == A[dig]:
            dig += 1
            pt += 1
        else:
            pt += 1
        if dig == 3:
            break

    if dig == 3:
        return True
    else:
        return False

count = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            if judge(S,[str(a),str(b),str(c)]):
                count += 1

print(count)


### FIXED CODE ###

N = int(input())
S = input()

def judge(S,A): #A:3桁ｎ数字
    dig,pt = 0,0
    while dig < 3 and pt < N:
        if S[pt] == A[dig]:
            dig += 1
            pt += 1
        else:
            pt += 1
        if dig == 3:
            break

    if dig == 3:
        return True
    else:
        return False

count = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            if judge(S,[str(a),str(b),str(c)]):
                count += 1

print(count)
### BUGGY CODE ###

N, K = map(int,input().split())
P = list(map(int,input().split()))
MAX = 0
for i in range(N-K+1):
    tmp = sum(P[i:i+K])
    if MAX < tmp:
        MAX = tmp
print((MAX+K)/2)

### FIXED CODE ###

N, K = map(int,input().split())
P = list(map(int,input().split()))
LIST = [0]
for i in range(N):
    LIST.append(LIST[i]+P[i])
MAX = 0
for i in range(N-K+1):
    tmp = LIST[i+K]-LIST[i]
    if MAX < tmp:
        MAX = tmp
print((MAX+K)/2)
### BUGGY CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import gcd, ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
c = 0
K = INT()
ans = 0
 
for i in range(1, K + 1):
    for j in range(1, K + 1):
        a = gcd(i, j)
        for k in range(1, K + 1):
            b = gcd(a, k)
            ans += b
print(ans)            
 

### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import gcd, ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
# from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        for k in range(1, K + 1):
            ans += gcd(gcd(i, j), k)
print(ans)


exit()
q = [[str(i)] for i in range(1, K+1)]
# print(q)
s = []
ans = 0
while q:
    a = q.pop()
    # print(q)@
    if len(a) == 3:
        # s.append(a)
        ans += int(a[-1])
        # print(a)
    else:
        for i in range(1, K+1):
            b = deepcopy(a)
            if int(b[-1]) <= i:
                b.append(b[-1])
            # b += str(gcd(i, int(b[-1])))
            else:
                b.append(str(i))
            q.append(b)
print(ans)
# print(s)
# print(s)
# ans = 0
# for d in s:
#     print(sorted(list(d))[0])

# print(ans)