Harryxun/stf_run huggingface dataset:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())

def hurui(n):
    """n以下の素数のリストを返す
    """
    l = list(range(2,n))
    p = 2
    i = 0
    while True:
        l = [item for item in l if item==p or item%p!=0]
        i += 1
        p = l[i]
        if p*p>n:
            break
    return l
l = hurui(n)
nums = list(range(n+1))
t = [1]*(n+1)
for p in l:
    for k in range(1, n//p+1):
        v = 0
        while nums[k*p]%p==0:
            v += 1
            nums[k*p]//=p
        t[k*p] *= (v+1)
ans = sum(i*t[i] for i in range(1,n+1))
print(ans)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n = int(input())
ans = 0
for i in range(1, n+1):
    v = (n)//i
    ans += i*(v+1)*v//2
print(ans)
h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if i==0:
            if j==0 and s[0][0]=='.':
                l1=[s[0][1],s[1][0],s[1][1]]
                l1l=l1.count('#')
                s[0][0]=l1l
            elif j==w-1 and s[0][w-1]=='.':
                r1=[s[0][w-2],s[1][w-2],s[1][w-1]]
                r1r=r1.count('#')
                s[0][w-1]=r1r
            elif j!=0 and j!=w-1 and s[0][j]=='.':
                l1j=[s[0][j-1],s[0][j+1],[s[1][j-1],s[1][j],s[1][j+1]]
                l1jj=l1j.count('#')
                s[0][j]==l1jj
            else:pass
        elif i==h-1:
            if j==0 and s[h-1][0]=='.':
                lh=[s[h-1][1],s[h-2][0],s[h-2][1]]
                lhl=lh.count('#')
                s[h-1][0]=lhl
            elif j==w-1 and s[h-1][w-1]=='.':
                rh=[s[h-1][w-2],s[h-2][w-2],s[h-2][w-1]]
                rhr=rh.count('#')
                s[h-1][w-1]=rhr
            elif j!=0 and j!=w-1 and s[h-1][j]=='.':
                lhj=[s[h-1][j-1],s[h-1][j+1],[s[h-2][j-1],s[h-2][j],s[h-2][j+1]]
                lhjj=lhj.count('#')
                s[0][j]==lhjj
            else:pass
        else:
            if j==0 and s[i][0]=='.':
                li=[s[i-1][0],s[i-1][1],s[i][1],s[i+1][1],s[i+1][0]]
                lil=li.count('#')
                s[i][0]=lil
            elif j==w-1 and s[i][w-1]=='.':
                ri=[s[i-1][w-1],s[i-1][w-2],s[i][w-1],s[i+1][w-2],s[i+1][w-1]]
                rir=ri.count('#')
                s[i][w-1]=rir
            elif j!=0 and j!=w-1 and s[i][j]=='.':
                lij=[s[i-1][j-1],s[i-1][j],s[i-1][j+1],s[i][j-1],s[i][j+1],s[i+1][j-1],s[i+1][j],s[i+1][j+1]]
                lijj=lij.count('#')
                s[i][j]==lijj
            else:pass
    print("".join(s[i]))

### FIXED CODE ###

h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
l=[]
l.append(['*']*(w+1))
for i in range(h):
    l1=s[i]
    l1.insert(0,'*')
    l1.append('*')
    l.append(l1)
l.append(['*']*(w+1))

for i in range(1,h+1):
    for j in range(1,w+1):
        c=0
        if l[i][j]=='.':
            c+=l[i-1][j-1:j+2].count('#')
            c+=l[i][j-1:j+2].count('#')
            c+=l[i+1][j-1:j+2].count('#')
            l[i].pop(j)
            l[i].insert(j,str(c))
            
for i in range(1,h+1):
    print(''.join(l[i][1:w+1]))
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) = (-1, -1, -1):
        break
    if m+f >= 80:
        print("A")
    elif m+f >= 65 and m+f < 80:
        print("B")
    elif m+f >= 50 and m+f < 65:
        print("C")
    elif m+f >= 30 and m+f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

### FIXED CODE ###

while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m == -1 or f == -1:
        print("F")
    elif m+f >= 80:
        print("A")
    elif m+f >= 65 and m+f < 80:
        print("B")
    elif m+f >= 50 and m+f < 65:
        print("C")
    elif m+f >= 30 and m+f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")
S = input()
l = len(S)

S1 = S[0:(l-1)//2]
S2 = S[(l+3)//2]

def Kaibun(Str):
	if Str == Str[::-1]:
		return True
	else: return False

if Kaibun(S1) and Kaibun(S2):
	print("Yes")
else: print("No")

### FIXED CODE ###

def f(x):
  return x==x[::-1]
S=input()
n=(len(S)-1)//2
S1,S2=S[:n],S[n+1:]
if f(S) and f(S1) and f(S2):
  print('Yes')
else:
  print('No')
N=int(input())
S=input()

cnt=0

for i in range(N-1):
    if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
        cnt+=1
print(cnt)

### FIXED CODE ###

N = int(input())
S = input()
cnt = 0

for i in range(N):
    if S[i] == 'C' and S[i - 1] == 'B' and S[i - 2] == 'A':
        cnt += 1
print(cnt)
import os, sys, re, math

def oneidx(S):
    idx = -1
    for s in S:
        if s == '1':
            idx += 1
        else:
            break
    return idx

S = input()
N = int(input())
idx = oneidx(S)

if idx >= N:
    print(N)
else:
    print(S[idx+1])


### FIXED CODE ###

import os, sys, re, math

def oneidx(S):
    idx = -1
    for s in S:
        if s == '1':
            idx += 1
        else:
            break
    return idx

S = input()
N = int(input()) - 1
idx = oneidx(S)

if idx >= N:
    print('1')
else:
    print(S[idx+1])
n = int(input())
L = []
d = {}
for _ in range(n-1):
    a, b = map(int, input().split())
    L.append((a, b))
    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)
k = 0
for i in d.keys():
    tmp_k = len(d[i]) if i == 1 else len(d[i]) + 1
    k = max(k, tmp_k)
print(k)
dd = {1: 0}
ans = {}
for i, v in d.items():
    cnt = 1
    for j in v:
        if cnt != dd[i]:
            c = cnt
            cnt += 1
        else:
            c = cnt + 1
            cnt += 2
        ans[(i, j)] = c
        dd[j] = c
for a, b in L:
    print(ans[(a, b)])


### FIXED CODE ###

n = int(input())
L = []
d = {}
for _ in range(n-1):
    a, b = map(int, input().split())
    L.append((a, b))
    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)
k = 0
for i in d.keys():
    tmp_k = len(d[i]) if i == 1 else len(d[i]) + 1
    k = max(k, tmp_k)
print(k)
key = sorted(d.keys())
dd = {1: 0}
ans = {}
for i in key:
    v = d[i]
    cnt = 1
    for j in v:
        if cnt != dd[i]:
            c = cnt
            cnt += 1
        else:
            c = cnt + 1
            cnt += 2
        ans[(i, j)] = c
        dd[j] = c
for a, b in L:
    print(ans[(a, b)])
N,K=(int(x) for x in input().split())
S=input()
S[K-1]=S[K-1].lower()
print(S)

### FIXED CODE ###

N,K=(int(x) for x in input().split())
S=input()
Sa=S[:K-1]+str(S[K-1].lower())+S[K:]
print(Sa)
n=int(input())
for i in range(1,3501):
  for j in range(1,3501):
    if (n*i*j)%(4*i*j-n*i-n*j)==0:
      print(i,j,(n*i*j)//(4*i*j-n*i-n*j))
      exit()

### FIXED CODE ###

n=int(input())
for i in range(1,3501):
  for j in range(1,3501):
    if 4*i*j-n*i-n*j>0:
      if (n*i*j)%(4*i*j-n*i-n*j)==0:
        print(i,j,(n*i*j)//(4*i*j-n*i-n*j))
        exit()
n = int(input())
tree = [[] for _i in range(n)]
for _i in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
from collections import deque
c = deque(sorted(list(map(int, input().split())), reverse=True))
visit = [-1 for _i in range(n)]

def solve(p):
    for i in tree[p]:
        if visit[i] < 0:
            visit[i] = c.popleft()
            solve(i)
solve(0)
print(*visit)

### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(10**9)

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

c = deque(sorted(list(map(int, input().split())), reverse=True))
visit = [-1 for _i in range(n)]
visit[0] = c.popleft()

def solve(p):
    r = 0
    for i in tree[p]:
        if visit[i] < 0:
            visit[i] = c.popleft()
            r += visit[i]
            r += solve(i)
    return r
x = solve(0)
print(x)
print(*visit)
def index_bin(l, x):
    n = len(l)
    b = 0
    e = n
    while(b != e):
        if x > l[(b+e)//2]:
            b = (b+e)//2 + 1
        else:
            e = (b+e)//2
    return b


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

P = []
Y = []
PY = [[] for _ in range(M)]


for i in range(M):
    p, y = map(int, input().split())
    P.append(p)
    Y.append(y)
    PY[p-1].append(y)

for i in range(M):
    PY[i].sort()

for i in range(M):
    x = index_bin(PY[P[i]-1], Y[i]) + 1
    print("%06d%06d" % (P[i], x))

### FIXED CODE ###

from bisect import bisect_left

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

P = []
Y = []
PY = [[] for _ in range(N+1)]

for _ in range(M):
    p, y = map(int, input().split())
    P.append(p)
    Y.append(y)
    PY[p].append(y)

for i in range(N+1):
    PY[i].sort()

for i in range(M):
    x = bisect_left(PY[P[i]], Y[i]) + 1
    print("%06d%06d" % (P[i], x))
antennas = []
for _ in range(5):
  a = int(input())
  antennas.append(a)
k = int(input())
cannot_communicate_pair_exists = False
for i in range(len(antennas)):
  for q in range(len(antennas)):
    if i == q:
      continue
    if abs(antennas(i)-antennas(q)) > k:
      cannot_communicate_pair_exists = True
      break
  if cannot_communicate_pair_exists:
    break
if cannot_communicate_pair_exists:
  print(":(")
else:
  print("Yay!")

### FIXED CODE ###

antennas = []
for _ in range(5):
  a = int(input())
  antennas.append(a)
k = int(input())
cannot_communicate_pair_exists = False
for i in range(len(antennas)):
  for q in range(len(antennas)):
    if i == q:
      continue
    if abs(antennas[i]-antennas[q]) > k:
      cannot_communicate_pair_exists = True
      break
  if cannot_communicate_pair_exists:
    break
if cannot_communicate_pair_exists:
  print(":(")
else:
  print("Yay!")
import sys, os
import numpy as np

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b,c = input(), input(), input()
    if a[-1]== b[0] and b[-1] = c[0]:
        print('YES')
    else:
        print('NO')
    

solve()


### FIXED CODE ###

import sys, os
import numpy as np

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b,c = input().split()
    if a[-1]== b[0] and b[-1] == c[0]:
        print('YES')
    else:
        print('NO')
    

solve()
from math import gcd

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

X = list(map(int, input().split()))

tmp = abs(X[0] - K)
for i in range(1, N):
    tmp = gcd(tmp, abs(X[i] - K))

print(tmp)

### FIXED CODE ###

def gcd(a, b):
    while(b != 0):
        amari = a % b

        a = b
        b = amari
    return(a)


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

X = list(map(int, input().split()))

tmp = abs(X[0] - K)
for i in range(1, N):
    tmp = gcd(tmp, abs(X[i] - K))

print(tmp)
A,B,C,D = map(int,input().split())
while A > 0 and C > 0:
    C -= B
    if C <= 0:
        print("Yes")
    else:
        A -= D
        if A <= 0:
            print("No")

### FIXED CODE ###

S,W = map(int,input().split())
if S>W:
  print("safe")
else:
  print("unsafe")
import collections
N,K=map(int,input().split())
a=list(map(int,input().split()))
table=collections.defaultdict(int)
for i in range(N):
  table[a[i]]+=1
ana=0
table= list(table.items())
if len(table)<=K:
  print(0)
else:
  ans=0
  table.sort(key =lambda x:x[1])
  for i in range(N-K):
    ans+=table[i][1]
print(ans)

### FIXED CODE ###

import collections
N,K=map(int,input().split())
a=list(map(int,input().split()))
table=collections.defaultdict(int)
for i in range(N):
  table[a[i]]+=1
table= list(table.items())
if len(table)<=K:
  print(0)
else:
  ans=0
  table.sort(key =lambda x:x[1])
  for i in range(len(table)-K):
    ans+=table[i][1]
  print(ans)
from sys import stdin, setrecursionlimit
from bisect import bisect_right


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    if n == 1:
        print(abs(sum(a)))
        exit()

    idx = bisect_right(a, 0)

    if idx % 2 == 0:
        print(sum(a[idx:]) - sum(a[:idx]))
    else:
        print(sum(a[idx:]) - sum(a[:idx]) - 2 * min(-a[idx - 1], a[idx]))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


### FIXED CODE ###

from sys import stdin, setrecursionlimit
from bisect import bisect_right


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    idx = bisect_right(a, 0)

    if idx % 2 == 0:
        print(sum(a[idx:]) - sum(a[:idx]))
    elif idx == n:
        print(a[idx - 1] - sum(a[:idx - 1]))
    else:
        print(sum(a[idx:]) - sum(a[:idx]) - 2 * min(-a[idx - 1], a[idx]))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n
    x = [0]*n
    y = [0]*n
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(2,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

### FIXED CODE ###

# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*(n+1)
    x = [0]*(n+1)
    y = [0]*(n+1)
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()
n, r = input().split(" ")
if n<10:
    print((100*(10-n))+r)
else:
    print(r)

### FIXED CODE ###

n, r = input().split(" ")
n=int(n)
r=int(r)
if n<10:
    print((100*(10-n))+r)
else:
    print(r)
list = map(int, input().split(" "))
print(list)
list = map(str, list.sort())
print(list)
print(list[0] + " " + list[1] + " " + list[2])

### FIXED CODE ###

list1 = input().split(" ")
list2 = list(map(int, list1))
list3 = sorted(list2)
list4 = list(map(str, list3))
answer_string = " ".join(list4)

print(answer_string)
t = map(int, input().split())
  if t[0]＊t[1] % 2 == 0:
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

s, t = map(int, input().split())
if s * t % 2 == 0:
  print("No")
else:
  print("Yes")
S = int(input())
memo = [-1]*(S+1)
redis(s):
  if memo[s] != -1:
    return memo[s]
  else:
    if s < 3:
      memo[s] = 0
      return 0
    elif s < 6:
      memo[s] = 1
      return 1
    else:
      tmp = 0
      for num in range(s):
        tmp += redis(num)*redis(s-num)
      memo[s] = tmp
      return tmp
print(redis(S))
    

### FIXED CODE ###

S = int(input())
mod = 10**9+7
memo = [-1]*(S+1)
memo[0] = 1
def redis(s):
  if memo[s] != -1:
    return memo[s]
  else:
    if s < 3:
      memo[s] = 0
      return 0
    elif s < 6:
      memo[s] = 1
      return 1
    else:
      tmp = 0
      for num in range(s-2):
        tmp += redis(num)%mod
      memo[s] = tmp
      return tmp%mod
print(redis(S))
import itertools
N, T = map(int, input().split())
CT = list(map(lambda _ :list(map(int, input().split())), range(N)))
print(min(filter(lambda ct: ct[1]<=T, CT), key=(lambda ct: ct[0]))[0])


### FIXED CODE ###

import itertools
N, T = map(int, input().split())
CT = list(map(lambda _ :list(map(int, input().split())), range(N)))
if min(CT ,key = (lambda ct:ct[1]))[1] > T:
    print('TLE')
else:
    print(min(filter(lambda ct: ct[1]<=T, CT), key=(lambda ct: ct[0]))[0])
mai,yen=map(int,input().split())
for i in range(mai+1):
  for j in range(mai+1-j):
    if 10000*i+5000*j+1000*(mai-i-j)==yen:print(i,j,mai-i-j);exit()
else:pint(-1,-1,-1)

### FIXED CODE ###

mai,yen=map(int,input().split())
for i in range(mai+1):
  for j in range(mai+1-i):
    if 10000*i+5000*j+1000*(mai-i-j)==yen:print(i,j,mai-i-j);exit()
else:print(-1,-1,-1)
A, B, C = input().split()
 
answer = (B + C) % A
 
print(answer)

### FIXED CODE ###

A, B, C = map(int,input().split())
print(C - min(A-B,C))
a,b = map(int,input())
print(a*b)

### FIXED CODE ###

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

print(a*b)
n=int(input())-1
A=list(map(int,input().split()))
i=0
for j in range(n):
 if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1
A[i],A[n]=A[n],A[i]
print(" ".join(map(str,A[:k]))+" ["+str(A[i])+"] "+" ".join(map(str,A[k+1:])))


### FIXED CODE ###

def s():
 n=int(input())-1
 A=list(map(int,input().split()))
 i=0
 for j in range(n):
  if A[j]<=A[-1]:A[i],A[j]=A[j],A[i];i+=1
 A[i],A[n]=A[n],A[i]
 print(" ".join(map(str,A[:i]))+" ["+str(A[i])+"] "+" ".join(map(str,A[i+1:])))
if'__main__'==__name__:s()
#coding:utf-8

N = input()

p = []
max_val = -1
for i in range(N):
    p_i = input()
    p.append(p_i)
    max_val = max(max_val, p_i)

sum = 0
flag = 0
for p_i in p:
    if p_i == max_val and flag==0:
        sum += p_i * 0.5
        flag = 1
    else:
        sum += p_i
print(int(sum))

### FIXED CODE ###

#coding:utf-8

D = str(input())

if D == '22':
    print('Christmas Eve Eve Eve')
elif D == '23':
    print('Christmas Eve Eve')
elif D == '24':
    print('Christmas Eve')
elif D == '25':
    print('Christmas')
N, M, *XYZ = map(int, open(0).read().split())

P = tuple(product((1, -1), repeat=3))

A = [[] for _ in range(8)]
for x, y, z in zip(*[iter(XYZ)] * 3):
    A[0].append(sum((x, y, z)))
    A[1].append(sum((x, y, -z)))
    A[2].append(sum((x, -y, z)))
    A[3].append(sum((x, -y, -z)))
    A[4].append(sum((-x, y, z)))
    A[5].append(sum((-x, y, -z)))
    A[6].append(sum((-x, -y, z)))
    A[7].append(sum((-x, -y, -z)))

cand = []
for i in range(8):
    A[i].sort(reverse=True)
    cand.append(sum(A[i][:M]))

print(max(cand))


### FIXED CODE ###

# https://atcoder.jp/contests/abc100/tasks/abc100_d

from itertools import product

N, M, *XYZ = map(int, open(0).read().split())

P = tuple(product((1, -1), repeat=3))

A = [[] for _ in range(8)]
for x, y, z in zip(*[iter(XYZ)] * 3):
    for i, (a, b, c) in enumerate(P):
        A[i].append(a * x + b * y + c * z)

cand = []
for i in range(8):
    A[i].sort(reverse=True)
    cand.append(sum(A[i][:M]))

print(max(cand))
def calc_sum_digits(n):
    sumd = 0
    while(n > 1):
        sumd += int(n%10)
        n /= 10
        
    return sumd
 

 N = int(input())
sumd = 0
 
sumd = calc_sum_digits(N)
if(N%sumd == 0): print('yes')
else: print('No')

### FIXED CODE ###

def calc_sum_digits(n):
    sumd = 0
    while(int(n) > 0):
        sumd += int(n%10)
        n /= 10
    return sumd

N = int(input())
sumd = calc_sum_digits(N)
if(N%sumd == 0):
     print('Yes')
else:
     print('No')
n,m = map(int, input().split())
 
import math
 
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
if n == 1 and m == 1:
    print(0)
elif n == 1 and m != 1:
    print(comb(m,2))
elif n != 1 and m == 1:
    print(comb(n,2))
else:
    print(comb(n,2) + comb(m,2))

### FIXED CODE ###

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

import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if n == 0:
    base1 = 0
elif n == 1:
    base1 = 0
else:
    base1 = comb(n,2)

if m == 0:
    base2 = 0
elif m == 1:
    base2 = 0
else:
    base2 = comb(m,2)

print(base1 + base2)
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            break
print(-1, -1, -1)
N, Y = map(int, input().split())
 
#10000:a, 5000:b, 1000:c
for a in range(N+1):
    for b in range(N+1-a):
        c = N - a - b
        if 10000 * a + 5000 * b + 1000 * c == Y:
            print(a, b, c)
            exit()
print(-1, -1, -1)


### FIXED CODE ###

S = input()

print(S.replace('2017', '2018'))
import sys
input = sys.stdin.readline

N, W = [int(i) for i in input().split()]

def ans(N, W):
    d = [0] * (W+1)

    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        for w in range(W, wi - 1, -1):
            v_ = d[w - wi] + vi
            if v_ > d[w]:
                d[w] = v_
    return d[W]

print(ans(N, W))


### FIXED CODE ###

import sys
input = sys.stdin.readline

N, W = [int(i) for i in input().split()]

def ans(N, W):
    d = [float("inf")] * (N * 1000 + 1)
    d[0] = 0
    V = 0

    for i in range(N):
        wi, vi = [int(i) for i in input().split()]
        V = V + vi

        for v in range(V, vi-1, -1):
            w_ = d[v - vi] + wi
            if w_ < d[v]:
                d[v] = w_

    for v in range(V, -1, -1):
        if d[v] <= W:
            return v

print(ans(N, W))
import collections
num_list = [int(i) for i in input().split()]
height_list = [int(i) for i in input().split()]
way_list = list(list(map(int, input().split())) for i in range(num_list[1]))

tower_list = [i for i in range(1, num_list[0]+1)]
gd_dict = dict(zip(tower_list, ['good' for i in range(10**5)]))

def change_to_bad(target_list):
    if height_list[target_list[0]] > height_list[target_list[1]]:
        gd_dict[target_list[1]] = 'bad'
    elif height_list[target_list[0]] == height_list[target_list[1]]:
        gd_dict[target_list[0]] = 'bad'
        gd_dict[target_list[1]] = 'bad'
    else:
        gd_dict[target_list[0]] = 'bad'

for i in way_list:
    change_to_bad(i)

good_val = collections.Counter(gd_dict.values())['good']

good_val

### FIXED CODE ###

import collections
num_list = [int(i) for i in input().split()]
height_list = [int(i) for i in input().split()]
way_list = list(list(map(int, input().split())) for i in range(num_list[1]))

tower_list = [i for i in range(1, num_list[0]+1)]
gd_dict = dict(zip(tower_list, ['good' for i in range((len(tower_list)))]))

def change_to_bad(target_list):
    if height_list[target_list[0]-1] > height_list[target_list[1]-1]:
        gd_dict[target_list[1]] = 'bad'
    elif height_list[target_list[0]-1] == height_list[target_list[1]-1]:
        gd_dict[target_list[0]] = 'bad'
        gd_dict[target_list[1]] = 'bad'
    else:
        gd_dict[target_list[0]] = 'bad'

for i in way_list:
    change_to_bad(i)

good_val = collections.Counter(gd_dict.values())['good']

print(good_val)
import math


a, b, c, d = list(map(int, input().split()))

def lcm(x, y):
    return x * y // math.gcd(x, y)

def get_num(x):
    ans = x - x // c - x // d + x // lcm(c, d)
    return ans


print(get_num(b) - get_num(a -1))


### FIXED CODE ###

import fractions


a, b, c, d = list(map(int, input().split()))

def lcm(x, y):
    return x * y // fractions.gcd(x, y)

def get_num(x):
    ans = x - x // c - x // d + x // lcm(c, d)
    return ans


print(get_num(b) - get_num(a -1))
def is calc(N, K):
  count = 0
  for a in range(1, N):
    for b in range(1, N):
      c = N - a - b
      if c > 0:
        if a + b % N == 0 and b + c % N == 0 and a + c % N == 0:
          count += 1
  return count

if __name__ == '__main__':
  N, K = map(int, input().split())
  print(calc(N, K))

### FIXED CODE ###

N, K = map(int,input().split())
print(int(N/K)**3+[int((N+K/2)/K)**3,0][K%2])
N = 5
Dishes = [int(input()) for _ in range(N)]
Dishes_10 = []

for i in range(N):
    d = int(str(Dishes[i])[-1])
    if d!=0:
        Dishes_10.append(int(Dishes[i])+10-d)
    else:
        Dishes_10.append(int(Dishes[i]))

for i in range(N):
    Max=0
    if (Dishes_10[i]-Dishes[i])>Max:
        posi = i
        Max = Dishes_10[i]-Dishes[i]

Dishes_10[posi] = Dishes[posi]

print(sum(Dishes_10))

### FIXED CODE ###

N = 5
D = [int(input()) for _ in range(N)]

srv_t = 0
last_srv = 0

for d in D:
   if d%10!=0:
       t = 10 - d%10
   else:
       t = 0
    
   srv_t += (d+t)
    
   last_srv = max(last_srv,t)
    
print(srv_t-last_srv)