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

import numpy as np

def e(dice):
    return sum([r / dice for r in range(1, dice+1)])

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

p_cum = [0] + list(np.cumsum(p))

ma = 0
ind = 0
for i in range(k, n+1):
    if ma < p_cum[i] - p_cum[i-k]:
        ma = p_cum[i] - p_cum[i-k]
        ind = i


x = p[ind-k:ind]

print(sum(e(d) for d in x))

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    from itertools import accumulate

    def e(dice):
        ans = 0
        for r in range(1, dice+1):
            ans += r /dice
        return ans

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

    p_cum = [0] + list(accumulate(p))

    ma = 0
    ind = 0
    for i in range(k, n+1):
        temp = p_cum[i] - p_cum[i-k]
        if ma < temp:
            ma = temp
            ind = i

    x = p[ind-k:ind]

    print(sum(e(d) for d in x))

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

def main():    
    n = int(input())
    l = list(int(x) for x in input().split())
    ans = 0

    for i in range(n-2):
        for j in range(i+1, n):
            for k in range(j+1, n):
                if (l[i] < l[j]+l[k]) and (l[j] < l[k]+l[i]) and (l[k] < l[i]+l[j]):
                    ans += 1
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import bisect

def main():    
    n = int(input())
    L = list(int(x) for x in input().split())
    ans = 0
    c = 0

    L.sort()

    for i in range(n-2):
        for j in range(i+1, n):
            c = L[i]+L[j]
            l = j
            r = bisect.bisect_left(L, c, lo=l) -1
            ans += (r-l)
    print(ans)

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

n = int(input())
li = list(map(int, input().split()))
li.sort(reverse=True)
count = 0

for i in range(n-2):
    for j in range(i+1, n-1):
        right = n - 1
        rightFlag = 1
        while rightFlag == 1 and right - j >= 1:
            if li[i] - li[j] >= li[right]:
                right -= 1
            else:
                rightFlag = 0
        if rightFlag == 0:
            count += right - j

print(count)


### FIXED CODE ###

n = int(input())
li = list(map(int, input().split()))
li.sort(reverse=True)
count = 0

for i in range(n-2):
    for j in range(i+1, n-1):
        left = j
        right = n

        while right - left > 1:
            mid = (left + right)//2
            if li[i]-li[j] < li[mid]:
                left = mid
            else:
                right = mid
        count += left - j

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

K = int(input())
cal = 0
for i in range(50000):
    cal += 7*(10**i)
    if cal % K == 0:
        print(len(str(cal)))
        exit()
print("-1")

### FIXED CODE ###

k = int(input())

mod = 7%k
path = [mod]
ans = '-1'

for i in range(1,k+1):
    if mod == 0:
        ans = i
        break
    mod = (mod*10 + 7)%k
    path.append(mod)
    if mod == path[0]:
        ans = '-1'
        break

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

# Using BFS
import queue
from collections import defaultdict
import sys


def input():
    return sys.stdin.readline()


def push(v, d, dist, q, INF=1e10):
    if dist[v] != INF:
        return
    dist[v] = d
    q.put(v)


def main():
    n, x, y = map(int, input().split())
    # modify the values of x, y so that they start from zero
    x, y = x - 1, y - 1
    INF = 1e10
    ans = defaultdict(int)
    for i in range(n):
        # dist[idx]: distance between i and idx.
        dist = [INF] * n
        q = queue.Queue()
        push(i, 0, dist, q)
        while not q.empty():
            v = q.get()
            d = dist[v]
            if v - 1 >= 0:
                push(v-1, d+1, dist, q)
            if v + 1 < n:
                push(v+1, d+1, dist, q)
            if v == x:
                push(y, d+1, dist, q)
            if v == y:
                push(x, d+1, dist, q)

            ans[dist[v]] += 1

    for i in range(n):
        if i != 0:
            print(ans[i] // 2)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# Using BFS
from collections import defaultdict, deque
import sys


def input():
    return sys.stdin.readline()


def push(v, d, dist, q, INF=1e10):
    if dist[v] != INF:
        return
    dist[v] = d
    q.append(v)


def main():
    n, x, y = map(int, input().split())
    # modify the values of x, y so that they start from zero
    x, y = x - 1, y - 1
    INF = 1e10
    ans = defaultdict(int)
    for i in range(n):
        # dist[idx]: distance between i and idx.
        dist = [INF] * n
        q = deque()
        push(i, 0, dist, q)
        while len(q) != 0:
            v = q.popleft()
            d = dist[v]
            if v - 1 >= 0:
                push(v-1, d+1, dist, q)
            if v + 1 < n:
                push(v+1, d+1, dist, q)
            if v == x:
                push(y, d+1, dist, q)
            if v == y:
                push(x, d+1, dist, q)

            ans[dist[v]] += 1

    for i in range(n):
        if i != 0:
            print(ans[i] // 2)


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

s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n):
        x = int(s[i: j+1])
        if x % 2019 == 0:
            ans += 1

print(ans)

### FIXED CODE ###

s = list(map(int, input()))
#print(s)
n = len(s)

l_sum = [0]
for i in range(n):
    x = (l_sum[-1] + int(s[n-i-1]) * (pow(10, i, 2019))) % 2019
    l_sum.append(x)

#print(l_sum)
l_sum.sort()
ans = 0
tmp = 0
cnt = 1
for i in range(1, len(l_sum)):
    if l_sum[i] == tmp:
        cnt += 1
    else:
        ans += cnt * (cnt - 1) // 2
        cnt = 1
        tmp = l_sum[i]

ans += cnt * (cnt - 1) // 2
print(ans)
### BUGGY CODE ###

N, A = map(int, input().split())
X = list(map(int, input().split()))
X.insert(0, 0)
dp = [[[0 for _ in range(N+1)] for _ in range(N+1)] for _ in range(sum(X)+1)]

dp[0][0][0] = 1
for i in range(sum(X) + 1):
    for j in range(1, N + 1):
        for k in range(N + 1):
            if i - X[j] >= 0 and k >= 1:
                dp[i][j][k] = dp[i][j - 1][k] + dp[i - X[j]][j - 1][k - 1]
            else:
                dp[i][j][k] = dp[i][j - 1][k]
                
res = 0

for k in range(1, N + 1):
    if A * k <= sum(X):
        res += dp[A*k][N][k]
                
print(res)

### FIXED CODE ###

N, A = map(int, input().split())
X = list(map(int, input().split()))
X.insert(0, 0)
dp = [[[0 for _ in range(N+1)] for _ in range(N+1)] for _ in range(sum(X)+1)]

dp[0][0][0] = 1
for i in range(sum(X) + 1):
    for j in range(1, N + 1):
        for k in range(N + 1):
            if i - X[j] >= 0 and k >= 1:
                dp[i][j][k] = dp[i][j - 1][k] + dp[i - X[j]][j - 1][k - 1]
            else:
                dp[i][j][k] = dp[i][j - 1][k]
                
res = 0

for k in range(1, N + 1):
    if A * k <= sum(X):
        res += dp[A*k][N][k]
                
print(res)
### BUGGY CODE ###

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

#dp[j][k][s] = (x0...xj からk枚選んでxiの合計をsにするような選び方の総数)
dp = [[[0] * (A * N + 1) for k in range(N + 1)] for j in range(N)]

dp[0][0][0] = 1
if x[0] <= A * N:
    dp[0][1][x[0]] = 1

for j in range(N - 1):
    for k in range(N + 1):
        for s in range(A * N + 1):
            if k == 0 and s == 0:
                dp[j + 1][k][s] = 1
            elif k > j + 2:
                dp[j + 1][k][s] = 0
            elif s >= x[j + 1] and k >= 1:
                dp[j + 1][k][s] = dp[j][k][s] + dp[j][k - 1][s - x[j + 1]]
            else:
                dp[j + 1][k][s] = dp[j][k][s]

res = 0
for i in range(1, N + 1):
    res += dp[N - 1][i][A * i]

print(res)

### FIXED CODE ###

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

#dp[j][k][s] = (x0...xj からk枚選んでxiの合計をsにするような選び方の総数)
dp = [[[0] * (A * N + 1) for k in range(N + 1)] for j in range(N)]

dp[0][0][0] = 1
if x[0] <= A * N:
    dp[0][1][x[0]] = 1

for j in range(N - 1):
    for k in range(N + 1):
        for s in range(A * N + 1):
            if k == 0 and s == 0:
                dp[j + 1][k][s] = 1
            elif k > j + 2:
                dp[j + 1][k][s] = 0
            elif s >= x[j + 1] and k >= 1:
                dp[j + 1][k][s] = dp[j][k][s] + dp[j][k - 1][s - x[j + 1]]
            else:
                dp[j + 1][k][s] = dp[j][k][s]

res = 0
for i in range(1, N + 1):
    res += dp[N - 1][i][A * i]

print(res)
### BUGGY CODE ###

import sys
N = int(input())
A = list(map(int, sys.stdin.readline().strip().split()))

for i in range(N):
    index = A.index(i + 1)
    print(index + 1, end='')
    if i != N - 1:
        print(' ', end='')

### FIXED CODE ###

import sys
N = int(input())
A = list(map(int, sys.stdin.readline().strip().split()))


school = [0] * N
j = 1
for i in A:
    school[i - 1] = j
    j += 1

print(' '.join(map(str, school)))
### BUGGY CODE ###

n = int(input())
list_a = list(map(int, input().split()))

list_a.sort()

appeared = list(set(list_a))
counts = []

for i in range(len(appeared)):
    counts.append(list_a.count(appeared[i]))

q = int(input())
ans = 0

for i in range(len(appeared)):
    ans += appeared[i] * counts[i]

for i in range(q):
    b, c = map(int, input().split())

    if b in appeared:
        b_idx = appeared.index(b)
        b_count = counts[b_idx]
        ans += b_count * (c - b)
        print(ans)

        if c in appeared:
            c_idx = appeared.index(c)
            counts[c_idx] += counts[b_idx]
            appeared.pop(b_idx)
            counts.pop(b_idx)
        else:
            appeared.append(c)
            counts.append(counts[b_idx])
            appeared.pop(b_idx)
            counts.pop(b_idx)
    else:
        print(ans)


### FIXED CODE ###

import numpy as np

n = int(input())
list_a = list(map(int, input().split()))

counts = np.zeros(100000, dtype=int)

ans = 0

for i in range(len(list_a)):
    counts[list_a[i]-1] += 1
    ans += list_a[i]

q = int(input())

for i in range(q):
    b, c = map(int, input().split())

    ans += counts[b-1] * (c - b)

    counts[c-1] += counts[b-1]
    counts[b-1] = 0

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

import sys


def reverse_search(n, parents):
    q = [n - 1]
    visited = set()
    while q:
        v = q.pop()
        if v in visited:
            continue
        visited.add(v)
        q.extend(u for u in parents[v] if u not in visited)
    return visited


n, m, p = list(map(int, input().split()))
INF = 10 ** 12
links = [set() for _ in range(n)]
parents = [set() for _ in range(n)]
for line in sys.stdin:
    a, b, c = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add((b, p - c))
    parents[b].add(a)
reachable = reverse_search(n, parents)

dist = [INF] * n
dist[0] = 0
for _ in range(len(reachable)):
    updated = False
    for v in reachable:
        d = dist[v]
        if d == INF:
            continue
        for u, c in links[v]:
            if dist[u] > d + c:
                dist[u] = d + c
                updated = True
    if not updated:
        break
else:
    print(-1)
    exit()

print(max(0, -dist[n - 1]))


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 5 + 5)


def omit(n, links, parents):
    q = [0]
    visited_f = [False] * n
    while q:
        v = q.pop()
        if visited_f[v]:
            continue
        visited_f[v] = True
        q.extend(u for u in links[v] if not visited_f[u])

    q = [n - 1]
    visited_b = [False] * n
    while q:
        v = q.pop()
        if visited_b[v]:
            continue
        visited_b[v] = True
        q.extend(u for u in parents[v] if not visited_b[u])

    remains = [i for i, (f, b) in enumerate(zip(visited_f, visited_b)) if f and b]
    sr = set(remains)
    for v in remains:
        links[v] &= sr

    return remains


n, m, p = list(map(int, input().split()))
INF = 10 ** 12
costs = [[INF] * n for _ in range(n)]
links = [set() for _ in range(n)]
parents = [set() for _ in range(n)]
for line in sys.stdin:
    a, b, c = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    parents[b].add(a)
    costs[a][b] = min(costs[a][b], p - c)
remains = omit(n, links, parents)

dist = [INF] * n
dist[0] = 0
for _ in range(n + 1):
    updated = False
    for v in remains:
        d = dist[v]
        if d == INF:
            continue
        cv = costs[v]
        for u in links[v]:
            if dist[u] > d + cv[u]:
                dist[u] = d + cv[u]
                updated = True
    # print(dist, updated)
    if not updated:
        break
else:
    print(-1)
    exit()

print(max(0, -dist[n - 1]))
### BUGGY CODE ###

import math 
mod=10**9+7
n,k=map(int,input().split())
l=sorted(list(map(int,input().split())))
ans=0

ll=1
ans+=ll*l[k-1]%mod
for i in range(k,n):
  ll=ll*i//(i-k+1)
  ans+=l[i]*ll%mod

j=math.factorial(k-1)
ml=math.factorial(n-1)//(math.factorial(n-k)*j)
ans-=ml*l[0]
ans%=mod
for i in range(1,n-k+1):
  ml=ml*(n-i-k+1)//(n-i)
  ans-=ml*l[i]
  ans%=mod

print(ans%mod)


### FIXED CODE ###

n,k=map(int,input().split())
l=sorted(list(map(int,input().split())))
mod=10**9+7
fact=[1]*(n+1)
inv=[1]*(n+1)
for i in range(2,n+1):
    fact[i]=i*fact[i-1]%mod
inv[-1]=pow(fact[-1],mod-2,mod)
for i in range(n,1,-1):
    inv[i-1]=inv[i]*i%mod
ans=0
for i in range(n):
    if i>=k-1:
        ans+=l[i]*fact[i]*inv[k-1]*inv[i-k+1]%mod
    if n-i-1>=k-1:
        ans-=l[i]*fact[n-i-1]*inv[k-1]*inv[n-i-1-k+1]%mod
    ans%=mod
print(ans)
### BUGGY CODE ###

import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))

a1 = np.roll(a, -1)

for i in range(1, (n - 1) // 2):
  a1 += np.roll(a, -1 - 2 * i)

ans_list = map(str, (np.sum(a) - a1 * 2).tolist())
print(" ".join(ans_list))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]
b[0] = sum(a) - sum(a[1::2]) * 2
b[1] = a[0] * 2
for i in range(2, n):
  b[i] = b[i-2] + a[i-1] * 2
c = [0 for i in range(n)]
c[0] = b[0]
for i in range(1, n):
  c[i] = b[i] - b[i-1]

ans = map(str, c)
print(" ".join(ans))
### BUGGY CODE ###


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


ans = 0

for i in range(61):

  one = 0
  for a in A:
    if (a >> i) & 1:
      one += 1
  
  zero = N - one
  ans += one * zero * (2 ** i)
  ans %= mod

print(ans)

### FIXED CODE ###


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


ans = 0

for i in range(61):

  one = 0
  for a in A:
    if (a >> i) & 1:
      one += 1
  
  zero = N - one
  ans += one * zero * (2 ** i)
  ans %= mod

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

import heapq
INF = 10**10
n = int(input())
a = [[int(item) for item in input().split()] for _ in range(n)]
b = [[INF for _ in range(n)] for _ in range(n)]

ans = sum(map(sum, a)) // 2
for k in range(n):
    for i in range(n):
        for j in range(i, n):
            b[i][j] = min(b[i][j], a[i][k] + a[k][j])
            b[j][i] = b[i][j]
            if a[i][j] == a[i][k] + a[k][j] and j != k and i != k:
                ans -= a[i][j]

if a == b:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

import heapq
INF = 10**10
n = int(input())
a = [[int(item) for item in input().split()] for _ in range(n)]
b = [[INF for _ in range(n)] for _ in range(n)]

ans = 0
for i in range(n):
    ans += sum(a[i])
    a[i][i] = INF
ans //= 2

for i in range(n):
    for j in range(i):
        bipas = min(map(sum, zip(a[i], a[j])))
        if a[i][j] > bipas:
            print(-1)
            exit()
        if a[i][j] == bipas:
            ans -= a[i][j]
print(ans)
### BUGGY CODE ###

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

dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(N-1, -1, -1):
    for j in range(N-1, -1, -1):
        if S[i] == S[j]:
            dp[i][j] = dp[i+1][j+1]+1

ans = 0
for i in range(N):
    for j in range(N):
        if i >= j:
            continue
        now = min(dp[i][j], j-i)
        ans = max(ans, now)
print(ans)


### FIXED CODE ###

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

ans = 0
len_s = 1
for i in range(N):
    tmp_s = S[i:i+len_s]
    while tmp_s in S[i+len_s:]:
        len_s += 1
        tmp_s = S[i:i+len_s]
        ans += 1
print(ans)
### BUGGY CODE ###

L = [int(_) for _ in input()[::-1]]
mod = 10**9 + 7
j = 0
ans = 0
for i in range(len(L) - 1, -1, -1):
    if L[i]:
        ans += 3**i * 2**j
        ans %= mod
        j += 1
ans += 2**j
ans %= mod
print(ans)


### FIXED CODE ###

L = [int(_) for _ in input()[::-1]]
mod = 10**9 + 7
j = 0
ans = 0
for i in range(len(L) - 1, -1, -1):
    if L[i]:
        ans += pow(3, i, mod) * pow(2, j, mod)
        ans %= mod
        j += 1
ans += pow(2, j, mod)
ans %= mod
print(ans)
### BUGGY CODE ###

MOD=10**9+7
N=int(input())
A=list(map(int,input().split()))
bit=[[0]*60 for i in range(N+1)]
for i in range(1,N+1):
    for j in range(60):
        if(A[i-1]>>j&1):
            bit[i][j]=bit[i-1][j]+1
        else:
            bit[i][j]=bit[i-1][j]
res=0
for i in range(N):
    for j in range(60):
        if not (A[i]>>j&1):
            res=(res+(2**j)*bit[i][j])%MOD
        else:
            res=(res+(2**j)*(i-bit[i][j]))%MOD
print(res)

### FIXED CODE ###

MOD=10**9+7
N=int(input())
A=list(map(int,input().split()))
ans=0
for j in range(60):
    k=2**j
    count=0
    for i in range(N):
        if(A[i]&k):
            ans=(ans+(2**j)*(i-count))%MOD
            count+=1
        else:
            ans=(ans+(2**j)*count)%MOD
print(ans)
### BUGGY CODE ###

from functools import reduce
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int , input().split()))
    result = reduce(lambda x, y: x * y, A)
    max_number = 10 ** 18
    if 0 in A:
        print(0)
        return
    if result > max_number:
        print(-1)
    else:
        print(result)

    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int , input().split()))
    max_number = 10 ** 18
    result = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        result = result * a
        if result > max_number:
            print(-1)
            return
    print(result)
    return


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

import queue
n,x,y=map(int,input().split())
edge=[[i-1,i+1] for i in range(n)]
edge[0],edge[-1]=[1],[n-2]
edge[x-1].append(y-1)
edge[y-1].append(x-1)
inf=10**6
ans=[0]*n
for i in range(n):
    q=queue.deque([i])
    dist=[inf]*n
    dist[i]=1
    while q:
        a=q.pop()
        for e in edge[a]:
            if dist[e]==inf:
                q.appendleft(e)
                dist[e]=dist[a]+1
    for v in dist:
        ans[v-1]+=1
for i in range(n-1):
    print(ans[i+1]//2)

### FIXED CODE ###

import queue
n,x,y=map(int,input().split())
edge=[[i-1,i+1] for i in range(n)]
edge[0],edge[-1]=[1],[n-2]
edge[x-1].append(y-1)
edge[y-1].append(x-1)
inf=10**6
ans=[0]*n
for i in range(n):
    q=queue.deque([i])
    dist=[inf]*n
    dist[i]=1
    while q:
        a=q.pop()
        for e in edge[a]:
            if dist[e]==inf:
                q.appendleft(e)
                dist[e]=dist[a]+1
    for v in dist:
        ans[v-1]+=1
for i in range(n-1):
    print(ans[i+1]//2)
### BUGGY CODE ###

K, N = map(int, input().split())
A = list(map(int, input().split()))
max_dis = 0
for i in range(N - 1):
    for j in range(i+1, N):
            tmp = A[j] - A[i]
            if tmp > K // 2:
                tmp -= K//2
            max_dis = max(max_dis, tmp)

print(K - max_dis)

### FIXED CODE ###

K, N = map(int, input().split())
A = list(map(int, input().split()))
ans = K - (A[-1] - A[0])
for i in range(N - 1):
    tmp = A[i + 1] - A[i]
    ans = max(tmp,ans)
print(K - ans)
### BUGGY CODE ###

from sys import stdin
import itertools
#from math import gcd
def gcd(a,b):
    x=max(a,b)
    y=min(a,b)
    if x%y==0:return y
    else:
        while(x%y!=0):
            z=x%y
            x=y
            y=z
        return z

# K = list(map(int, (stdin.readline().strip().split())))[0]
# i=[x for x in range(1,K+1)]
# j=[x for x in range(1,K+1)]
# k=[x for x in range(1,K+1)]
# num_list=set(map(tuple,(sorted(x) for x in (itertools.product(i,j,k)))))
#
# ans=0
# for i,j,k in num_list:
#     if i==j:
#         if j==k:
#             ans+=K
#         else:
#             ans+=gcd(i,gcd(j,k))*3
#     elif j==k:ans+=gcd(i,gcd(j,k))*3
#     else:ans+=gcd(i,gcd(j,k))*6
K = int(input())

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

### FIXED CODE ###

from sys import stdin
import itertools
from math import gcd
# def gcd(a,b):
#     x=max(a,b)
#     y=min(a,b)
#     if x%y==0:return y
#     else:
#         while(x%y!=0):
#             z=x%y
#             x=y
#             y=z
#         return z

# K = list(map(int, (stdin.readline().strip().split())))[0]
# i=[x for x in range(1,K+1)]
# j=[x for x in range(1,K+1)]
# k=[x for x in range(1,K+1)]
# num_list=set(map(tuple,(sorted(x) for x in (itertools.product(i,j,k)))))
#
# ans=0
# for i,j,k in num_list:
#     if i==j:
#         if j==k:
#             ans+=K
#         else:
#             ans+=gcd(i,gcd(j,k))*3
#     elif j==k:ans+=gcd(i,gcd(j,k))*3
#     else:ans+=gcd(i,gcd(j,k))*6
K = int(input())

ans = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        k = gcd(i, j)
        for l in range(1, K + 1):
            a = gcd(k, l)
            ans += a
print(ans)
### BUGGY CODE ###

n=int(input())
s=input()

ans=0
for i in range(1000):
    st="{:03}".format(i)

    cnt=0
    for nn in range(n):
        if s[nn]==st[cnt]:
            cnt+=1

        if cnt==3:
            ans+=1
            break
print(ans)

### FIXED CODE ###

n=int(input())
s=list(map(int,list(input())))
ans=0
for i in range(10):
    try:
        ss=s[s.index(i)+1:]
        for j in range(10):
            try:
                sss=ss[ss.index(j)+1:]
                for k in range(10):
                    if k in sss:ans+=1
            except:pass
    except:pass

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

s=input()
n=len(s)
d=[0]*2019
d[0]=1
j=1
ans=0
now=0
for i in s[::-1]:
  now=(now+int(i)*j)%2019
  ans+=d[now]
  d[now]+=1
  j*=10
print(ans)

### FIXED CODE ###

s=input()
n=len(s)
d=[0]*2019
d[0]=1
j=1
ans=0
now=0
for i in s[::-1]:
  now=(now+int(i)*j)%2019
  ans+=d[now]
  d[now]+=1
  j*=10
  j%=2019
print(ans)
### BUGGY CODE ###

import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
from collections import Counter

def flatten_2dim(array):
    return [item for sublist in array for item in sublist]

n,x,y = map(int,input().split())

# l = [[0,1,0,0,0],[1,0,1,1,0],[0,1,0,1,0],[0,1,1,0,1],[0,0,0,1,0]]

l = [[0]*n for i in range(n)]
for i in range(n-1):
    l[i][i+1] = 1
    l[i+1][i] = 1 
l[x-1][y-1] = 1
l[y-1][x-1] = 1
# l.append([x,y])

a = np.array(l)
ans = shortest_path(a)
ans_counter = Counter(flatten_2dim(ans))
# values = ans_counter.values()
# print(l)
# print(ans)
for i in range(1,n):
    print(int(ans_counter[i]/2))

### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
from collections import Counter

def flatten_2dim(array):
    return [item for sublist in array for item in sublist]

n,x,y = map(int,input().split())

# l = [[0,1,0,0,0],[1,0,1,1,0],[0,1,0,1,0],[0,1,1,0,1],[0,0,0,1,0]]

l = [[0]*n for i in range(n)]
for i in range(n-1):
    l[i][i+1] = 1
    l[i+1][i] = 1 
l[x-1][y-1] = 1
l[y-1][x-1] = 1
# l.append([x,y])

a = np.array(l)
ans = shortest_path(a,method ="D")
ans_counter = Counter(flatten_2dim(ans))
# values = ans_counter.values()
# print(l)
# print(ans)
for i in range(1,n):
    print(int(ans_counter[i]/2))

# print(ans_counter[1])
# print(values)
### BUGGY CODE ###

R,G,B,N = map(int,input().split(' '))
list = [R,G,B]
A,B,C = sorted(list)
num = 0
for i in range(int(N//C)+1):
  for j in range(int(N//B)+1):
    X = N-C*i-B*j
    if X >= 0  and X % A == 0:
      num += 1
print(num)

### FIXED CODE ###

R,G,B,N = map(int,input().split(' '))
A,B,C = sorted([R,G,B])
if A==1 and B==1 and C ==1:
  print(int((N+2)*(N+1)/2))
  exit()
num = 0
E = int(N//C+1)
F = int(N//B+1)
for i in range(E):
  for j in range(F):
    X = N-C*i-B*j
    if X >= 0  and X % A == 0:
      num += 1
print(num)