peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
K = int(input())
S = input()
print(S if len(S) <= K else (S[:K] + '...'))
# Judge status: Wrong Answer
S = int(input())
print(0,0,10**9,S%(10**9),1,S//(10**9))
# Judge status: Accepted
x, y = map(int, input().split())
if y > 0:
  if x < - y:
    ans = - y - x + 1
  elif -y <= x < 0:
    ans = y + x + 1
  elif 0 <= x <= y:
    ans = y - x
  else:
    ans = x - y + 2
elif y < 0:
  if x < y:
    ans = y - x
  elif y <= x < 0:
    ans = - y + x + 2
  elif 0 <= x <= - y:
    ans = - y - x + 1
  else:
    ans = y + x + 1
else:
  if x <= 0:
    ans = abs(x)
  else:
    ans = x + 1

print(ans)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
ans=[]
x=0
for i in range(n):
    x+=l[i]
    ans.append(abs(x-(sum(l)-x)))
print(min(ans))
# Judge status: Accepted
A,B,C = map(int,input().split())
print("Yes" if A+B >= C else "No")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
from bisect import bisect_right

N, M = mapint()

from heapq import heappop, heappush
days = [[] for _ in range(M)]
for _ in range(N):
    a, b = mapint()
    if a>M:
        continue
    days[a-1].append(-b)

queue = []

ans = 0
for i in range(M):
    lis = days[i]
    for b in lis:
        heappush(queue, b)
    if queue:
        ans += heappop(queue)

print(-ans)
# Judge status: Accepted
from collections import Counter
S = tuple(input())
c = Counter(S)
if not c['a']:
  c['a'] = 0
if not c['b']:
  c['b'] = 0
if not c['c']:
  c['c'] = 0
if max(c.values()) - min(c.values()) < 2:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = sum(B)
for i in range(N-1):
  if A[i]+1 == A[i+1]:
    D = A[i]
    ans += C[D-1]
print(ans)
# Judge status: Wrong Answer
S = input()

for i in range(1, len(S)):
  s = S[:-i]
  print(s)
  M = set(s)
  f = True
  for m in M:
    print(s.count(m)%2)
    if s.count(m)%2 != 0:
      f = False
      break
  if f:
    print(len(S) - i)
    exit()
# Judge status: Accepted
n,a,b = map(int,input().split())

if (a-b)%2 == 0:
    print(abs(a-b)//2)
else:
    print(min(a-1, n-b) + (abs(a-b)+1)//2)
# Judge status: Wrong Answer
n, k, x, y = [int(input()) for i in range(4)]
print(x*k + y*(n-k))
# Judge status: Accepted
n=int(input())
dp=[float("INF")]*(n+1)
dp[0]=0
temp=6
cnt=0
while temp<=n:
  cnt+=1
  dp[temp]=1
  temp*=6
l=[0,0]
l[0]=cnt
temp=9
cnt=0
while temp<=n:
  cnt+=1
  dp[temp]=1
  temp*=9
l[1]=cnt
for j,v in zip(l,[6,9]):
  for i in range(j+1):
    h=pow(v,i)
    for d in range(h,n+1):
      dp[d]=min(dp[d],dp[d-h]+1)
print(dp[-1])
# Judge status: Wrong Answer
a = int(input())
b = a % 1000
print(1000 - b)
# Judge status: Wrong Answer
n = int(input())

t = 0
    
while t*111 <= n  and n >= (t+1)*111:
    t += 1
    
print((t+1)*111)
# Judge status: Accepted
# https://atcoder.jp/contests/abc065/tasks/abc065_b

N = int(input())
a_list = []

for i in range(N):
    a = int(input())
    a_list.append(a)


current = 0
count = 0
for _ in range(N):
    current = a_list[current] - 1
    count += 1

    if current == 1:
        print(count)
        exit()

print(-1)
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))
a = h[0]
cnt = 0
ans = -float('inf')
for i in range(1, n):
    if h[i] <= a:
        cnt += 1
        a = h[i]
    else:
        ans = max(ans, cnt)
        cnt = 0
        a = h[i]
print(cnt)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
n, x = map(int, input().split())
#s = input()
#s,t = input().split()
#
readline = sys.stdin.readline
l = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

ans = 1
height = 0
for i in range(n):
    height += l[i]
    if height <= x:
        ans += 1
    else:
        break
print(ans)
# Judge status: Accepted
N = int(input())
for n4 in range(N//4+1):
  if (N-n4*4)%7 == 0:
    print("Yes")
    exit()
print("No")
# Judge status: Accepted
a,b,c = map(int, input().split())
k = int(input())
ans = a+b+c+max(a,b,c)*(2**k-1)
print(ans)
# Judge status: Wrong Answer

N = int(input())

list_moji = []
n = int(N/26)
m = N%26
list_moji.append(m)
while n != 0:
    tmp = n
    n = int(tmp/26)
    m = tmp%26
    
    if n == 1:
        list_moji.append(0)
        list_moji = [0]*len(list_moji)
        break
    else:
        list_moji.append(m)

string = ""
for i in reversed(list_moji):
    if i != 0:
        string += chr(96 + i)
    else:
        string += chr(96 + 26)


print(string)
# Judge status: Accepted
import math
N, D = map(int, input().split())
D *= 2
print((N+D)//(D+1))
# Judge status: Accepted
from collections import Counter

n,k,q = map(int,input().split())
a = [int(input()) for _ in range(q)]
p = [k]*n

ac = Counter(a)

for i in range(n):
    p[i] -= 1*(q-ac[i+1])

[print("Yes" if j >= 1 else "No") for j in p]
# Judge status: Accepted
r=int(input())
print(2*r*3.14)
# Judge status: Wrong Answer
value = int(input())
text = input()
if value < len(text):
    print(text[0]+'...')
else:
    print(text)
# Judge status: Wrong Answer
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = int(input())

d = abs(b[0] - a[0])
suma = a[0]
sumb = b[0]

for i in range(t):
    suma = suma + a[1]
    sumb = sumb + b[1]

    if suma == sumb:
        print('YES')
        exit()

print('NO')
# Judge status: Accepted
a,b,c=map(int,input().split())
if a<c<b or b<c<a:print("Yes")
else:print("No")
# Judge status: Accepted
l = list(map(int, input().split()))
s = ''
s += 'U'*(l[3]-l[1])
s += 'R'*(l[2]-l[0])
s += 'D'*(l[3]-l[1])
s += 'L'*(l[2]-l[0])
s += 'L'
s += 'U'*(l[3]-l[1]+1)
s += 'R'*(l[2]-l[0]+1)
s += 'D'
s += 'R'
s += 'D'*(l[3]-l[1]+1)
s += 'L'*(l[2]-l[0]+1)
s += 'U'
print(s)
# Judge status: Accepted
a,b=map(str, input().split())
n = int(a+b)
if n**0.5%1==0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A,B,C,K = map(int,input().split())

if K%2==0:
  print(A-B)
  
else:
  print(-A+B)
# Judge status: Accepted
n = int(input())
s = input()
a = 0
ans = 0
for i in range(n):
    if s[i]=='I':
        a+=1
    else:
        a-=1
    ans = max(ans,a)
print(ans)
# Judge status: Accepted
cin = open(0).read().strip().split('\n')
n, m, q = map(int, cin[0].split(' '))
abcd = [tuple(map(int, a.split(' '))) for a in cin[1:]]

ret = 0
import itertools
for case in itertools.combinations_with_replacement(list(range(1,m+1)), n):
    tmp = 0
    for c in abcd:
        if case[c[1]-1] - case[c[0]-1] == c[2]:
            tmp += c[3]
    ret = max(ret, tmp)
print(ret)
# Judge status: Accepted
s=input()
alp="abcdefghijklmnopqrstuvwxyz"
ans="None"
for i in alp:
  exist=False
  if i in s:
    exist=True
  if not exist:
    ans=i
    break
print(ans)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x = int(readline())
print('YES' if x in [3, 5, 7] else 'NO')
# Judge status: Accepted
def checkDoublet(arr):
    count = 0
    for d in arr:
        if d[0] == d[1]:
            count += 1
            if count >= 3:
                return 'Yes'
        else:
            count = 0
    return 'No'

n = int(input())
arr = []
for i in range(n):
    arr.append(list(map(int, input().rstrip().split())))
print(checkDoublet(arr))
# Judge status: Accepted
n=int(input())
a=map(int,input().split())

temp=1
res=[]
for x in a:
  if x == temp:
    temp+=1

if temp==1:
  print(-1)
else:
  print(n+1-temp)
# Judge status: Accepted
N, M = map(int, input().split())

ans = 1

import math

l = []
for i in range(1, int(math.sqrt(M)) + 1):
    if M % i == 0 and i * N <= M:
        l.append(i)
        if M // i * N <= M:
            l.append(M // i)

print(max(l))
# Judge status: Accepted
x,n=map(int,input().split())
r=[i-x for i in map(int,input().split())]
for i in range(n+1):
  if not -(i) in r:
    print(x-i)
    break
  elif not i in r:
    print(x+i)
    break
# Judge status: Wrong Answer
S = input()
l=len(S)
print(l)
for i in range(l//2):
    S=S.replace("10", "")
    S=S.replace("01", "")
print(l-len(S))
# Judge status: Wrong Answer
S = input()
min = 100000000
i = 0
for i in range(len(S)-2):
  if min > abs(int(S[i]*100) + int(S[i+1]*10) + int(S[i])-753):
    min = abs(int(S[i]*100) + int(S[i+1]*10) + int(S[i])-753)
    
print(min)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))

for i in range(n):
    x[i] = (x[i], i)

x.sort()

answers = [x[n//2 - 1][0]] * n

ans = x[n//2][0]
for i in range(n//2):
    answers[x[i][1]] = ans

for i in answers:
    print(i)
# Judge status: Accepted
from itertools import*;input();s=input();print(min(map(sum,zip(*[list(accumulate([0]+list(map(int,s.translate(str.maketrans("#.","10"[::p]))))[::p]))[::p]for p in[1,-1]]))))
# Judge status: Accepted
import sys
from fractions import gcd
A, B, K = map(int,input().split())
num = gcd(A,B)
cnt = 0
for n in range(num,0,-1):
  if num%n ==0:cnt += 1
  if cnt ==K:
    print(n)
    sys.exit()
# Judge status: Accepted
N,K = map(int,input().split())
x = list(map(int,input().split()))
ans = float("inf")
for i in range(N-K+1):
    l,r = x[i],x[i+K-1]
    if l*r>=0:
        ans = min(ans,max(abs(l),abs(r)))
    else:
        ans = min(ans,min(abs(l)*2+r,abs(l)+r*2))
print(ans)
# Judge status: Accepted
N = int(input())
history = [input()]
for i in range(N-1):
  w = input()
  if w in history or history[-1][-1] != w[0]:
    print('No')
    exit()
  history.append(w)
print('Yes')
# Judge status: Wrong Answer
l = [list(map(int,input().split())) for i in range(3)]
ans = 0
for i in l:
  ans += sum(i)
print("Yes" if ans//3==(l[0][0]+l[1][1]+l[2][2]) else "No")
# Judge status: Accepted
n = int(input())
l = [int(input()) for i in range(n)]
wa = sum(l)
cnt = 0
for i in l:
    if i % 10 == 0:
        cnt += 1
        
if cnt == n:
    print(0)
    exit()
    
if wa % 10 != 0:
    print(wa)
else:
    l.sort()
    for i in l:
        if i % 10 != 0:
            print(wa - i)
            break
# Judge status: Accepted
input()
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
pts = 0
prev = 0
for i in range(len(A)):
    try:
        pts += B[A[i] - 1]
    except:
        pass
    try:
        if prev+1 == A[i]:
            pts += C[A[i-1]-1]
    except:
        pass
    prev = A[i]
print(pts)
# Judge status: Accepted


A, B, M =  map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

xyc = [list(map(int,input().split())) for _ in range(M)]

min_a = min(a)
min_b = min(b)

min_cost = min_a + min_b

for i in range(M):
    kari = a[xyc[i][0]-1] + b[xyc[i][1]-1] -xyc[i][2]
    if kari < min_cost:
        min_cost = kari
        
print(min_cost)
# Judge status: Accepted
def resolve():
    import math
    x = int(input())

    def lcm(a, b):
        return (a * b) // math.gcd(a, b)

    if 360 % x == 0:
        print(360 // x)
    else:
        print(lcm(360, x) // x)


if 'unittest' not in globals():
    resolve()
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	N = INT()
	total = N
	cnt = 0
	for i in range(1, N+1):
		if i%2: cnt += 1
	
	print(cnt/total)

if __name__ == '__main__':
	main()
# Judge status: Accepted
N = int(input())
print((N/3)**3)
# Judge status: Wrong Answer
N = int(input())
alpha = [chr(ord('a') + i) for i in range(26)]

def dfs(s, max_i):
  if len(s) == N:
    print(s)
  else:
    for i in range(97,max_i+1):
      dfs(s+chr(i), i+1)

dfs('', 97)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = [int(i) for i in input().split()]
total = sum(A)

ans = sum([1 for a in A if a>=total/(4*M)])
print('Yes' if total >=M else 'No')
# Judge status: Wrong Answer
S,K=input(),int(input())
for i in list(S):
    if i!='1':print(i);break
# Judge status: Accepted
a,b,c=map(int,input().split())
print("YES" if a+b+c==17 and a*b*c==175 else "NO")
# Judge status: Accepted
n =int(input())
a=int(n/4)+1
b=int(n/7)+1

total=0
count=0
for i in range(a):
    for j in range(b):
            total=4*i+7*j
            if total==n:
                count+=1
                
if count>=1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import math
import collections
import fractions
import itertools
import functools
import  operator

def solve():
    n, m = map(int, input().split())
    ball, can = [0]*n, [True]*n
    ball[0], can[0] = 1, True
    for _ in range(m):
        x, y = map(int, input().split())
        if can[x-1] == True:
            can[y-1] = True
        ball[x-1] -= 1
        ball[y-1] += 1
        if ball[x-1] == 0:
            can[x-1] = False
    print(can.count(True))
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
s = int(input())

y1 = int(1e9)
x2 = s//y1 + (0 if s == int(1e18) else 1)

x1 = 1
y2 = x2*y1-s

ans = [0, 0, x1, y1, x2, y2]

print(" ".join(map(str, ans)))
# Judge status: Accepted
import fractions

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

left = [0]*(N+1)
for i in range(1,N+1):
    left[i] = fractions.gcd(left[i-1],A[i-1])

right = [0]*(N+1)
right[N-1] = A[N-1]
for i in range(N-2,-1,-1):
    right[i] = fractions.gcd(right[i+1],A[i])

ans = 0
for i in range(N):
    ans = max(ans,fractions.gcd(left[i],right[i+1]))
print(ans)
# Judge status: Accepted
x=int(input())
a=[]
for i in range(1,33):
    for j in range(2,11):
        a.append(i**j)
for i in range(x):
    if x-i in a:
        print(x-i)
        exit()
# Judge status: Accepted
# solution

nim, mike = map(int, input().split())
array = [int(input()) for _ in range(nim)]

array.sort()
m = sum(array)

for i in range(nim - mike + 1):
    m = min(array[i + mike - 1] - array[i], m)
print(m)
# Judge status: Wrong Answer
N = int(input())
lst = [0] * 100000
a = 0
for x in map(int, input().split()):
    a = max(a, x)
    lst[x - 1] += 1

ret = 0
for x in range(100000):
    ret = max(sum(lst[x : x + 3]), ret)
print(ret)
# Judge status: Accepted
a=input();print('NYoe s'[len(set(a[:3]))==1or len(set(a[1:]))==1::2])
# Judge status: Accepted
s = input()
t = input()

counter = 0
for i in range(len(s)):
	if s[i] != t[i]:
		counter += 1

print(counter)
# Judge status: Accepted
N = int(input())
d = ('AC', 'WA', 'TLE', 'RE')
S = {k: 0 for k in d}

for _ in range(N):
    S[input()] += 1

for k in d:
    print(f"{k} x {S[k]}")
# Judge status: Wrong Answer
h = int(input())

count = 0
tmp = h

if h == 1:
    print(1)
    exit()

while True:
    tmp = tmp // 2
    count = count + 1
    if tmp == 1:
        break
ans = 0
for i in range(count):
    ans = ans + 2**i
ans = ans + h
print(ans)
# Judge status: Accepted
a=int(input())
s=input()
if a>3199:
  print(s)
else:
  print("red")
# Judge status: Accepted
x = int(input())
ans = (x//11)*2
num = x%11
if 0 < num < 7:
    print(ans+1)
elif 6 < num < 11:
    print(ans+2)
else:
    print(ans)
# Judge status: Accepted
s=[s for s in input()]
k=int(input())
for i,j in enumerate(s):
  if j=='a':continue
  if ord('z')-ord(j)+1<=k:
    s[i]='a'
    k-=ord('z')-ord(j)+1
  if k==0:break
if k>0:s[-1]=chr(k%26+ord(s[-1]))
print(''.join(s))
# Judge status: Wrong Answer
N = int(input())
p = input().split()
p = [int(num) for num in p]
if p == sorted(p):
  print("Yes")
else:
  t = 0
  for i in range(N-1):
    if p[i+1] == p[i] + 1:
      t += 1
    else:
      continue
  if t == 2:
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
h, w = list(map(int, input().split()))

masu = h * w
if h * w % 2 == 0:
    print(int(masu / 2))
else:
    print(int(masu / 2) + 1)
# Judge status: Accepted
n, l = map(int, input().split())
s = [''] * n
for i in range(n):
    s[i] = input()
s.sort()
ans = ""
for i in s:
    ans += i
print(ans)
# Judge status: Wrong Answer
s,t = input(), input()

S = list(s)
T = list(t)

N = len(s) - 1
i = 0

while N != i:
    if S[i] != T[i]:
        S[i] = T[i]
    i += 1

print(i + 1)
# Judge status: Accepted
n=int(input())
L=list(map(int,input().split()))
L.sort(reverse=True)


import collections
d=collections.Counter(L)
M=0
m=[0,0]
for v in d:
	if d[v]>=4:
		M=max(M,v)
	elif d[v]>=2:
		m.append(v)
m.sort(reverse=True)

print(max(M**2,m[0]*m[1],M*m[0]))
# Judge status: Accepted
a = int(input())
s = input()

print('red' if a < 3200 else s)
# Judge status: Wrong Answer
A,B=input().split()
A=int(A)
B=int(100*float(B)+0.5)
print(int(A*B))
# Judge status: Accepted
N, = map(int, input().split())
if N%10 in {2 , 4 , 5 , 7 , 9 }:
    print("hon")
elif N%10 in {0, 1, 6, 8}:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
date = input()
date = date.replace("2017", "2018")
print(date)
# Judge status: Accepted
k=int(input())
s=input()
if len(s)<=k:
    print(s)
else:
    for i in range(k):
        print(s[i],end="")
    print("...",end="")
# Judge status: Accepted
A, B, K = map(int, input().split())
if A > K:
    print(A - K, B)
elif A + B > K:
    print(0, B - (K - A))
else:
    print(0, 0)
# Judge status: Accepted
a = [int(i) for i in input().split()]

a.sort()

if a[0]+a[1] == a[2]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
c = [list(map(int, input().split())) for _ in range(3)]
ans = "Yes"
for i in range(1,3):
    if c[i][0]-c[0][0] != c[i][1]-c[0][1] or c[i][1]-c[0][1] != c[i][2]-c[0][2]:
        ans = "No"
print(ans)
# Judge status: Wrong Answer
N,M=map(int,input().split())
INF=float("inf")
num=[INF]*N
ans=""
for i in range(M):
    s,c=map(int,input().split())
    if s==1 and c==0:
        print(-1);exit()
    if num[s-1]==INF or num[s-1]==c:
        num[s-1]=c
    else:
        print(-1);exit()
for k in range(1,N):
    if num[k]==INF:
        num[k]=0
if num[0]==INF:
    num[0]=1
for k in range(N):
    ans+=str(num[k])
print(ans)
# Judge status: Accepted
N = int(input())
s = 0
for i in range(1,N+1):
    if i % 2 == 1:
        s += 1
print(s/N)
# Judge status: Accepted
# a, b = map(int, input().split())
print('Christmas' + ' Eve'*(25 - int(input())))
# Judge status: Accepted
n = int(input())
ans = 1
mod = 10 ** 9 + 7
for i in range(1, n + 1):
    ans = (ans * i % mod) % mod
print(ans)
# Judge status: Accepted
def main():
    X=int(input())
    flag=0
    for i in range(1,1001):
        if 100*i<=X<=105*i:
            flag=1
    print(flag)

main()
# Judge status: Accepted
from functools import reduce
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
x=reduce(gcd,a)

ans=0
while x%2==0:
    ans+=1
    x//=2
print(ans)
# Judge status: Accepted
N=int(input())
lineup=sorted([int(x) for x in input().split()])
duplicate={}
for i in lineup:
	if i in duplicate:
		duplicate[i]+=1
	else:
		duplicate[i]=1
b=max(lineup)+1
sieve=[1]*(b)
counter=0
for i in range(N):
	for j in range(lineup[i]*2,b,lineup[i]):
		sieve[j]=0
	if duplicate[lineup[i]]==1 and sieve[lineup[i]]==1:
		counter+=1
print(counter)
# Judge status: Accepted
L=float(input())
print((L/3)**3)
# Judge status: Accepted
n = int(input())
s = input()
cnt = 0

for i in range(1, n):
    c = 0
    s1 = s[i:]
    s2 = s[:i]
    S = set(s1)

    for j in S:
        if j in s2:
            c += 1
    cnt = max(cnt, c)

print(cnt)
# Judge status: Accepted
p,r=input,range
A=sum([list(map(int,p().split()))for _ in r(3)],[])
N=int(p())
b=[int(p())for _ in r(N)]
print('Yes'if[v for v in[7,56,73,84,146,273,292,448]if sum(1<<i for i in r(9)if A[i]in b)&v==v]else'No')
# Judge status: Accepted
from math import pi
print(int(input())*2*pi)
# Judge status: Accepted
N,C,K = map(int, input().split())
L = []
for a in range(N):
  L.append(int(input()))
L.sort()
L.append(10**10)
x = 0
y = 0
z = L[0]
for i in range (N+1):
  if y < C and z+K >= L[i]:
    y += 1
  else:
    x += 1
    y = 1
    z = L[i]    
print(x)
# Judge status: Accepted
def rotation(string):
    result = string[-1]
    for i in range(len(string)-1):
        result += string[i]
    return result

S = input()
T = input()

flag = False
for i in range(len(S)):
    S = rotation(S)
    if T == S:
        flag = True
        break

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
print(N * (N-1) // 2)
# Judge status: Wrong Answer
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
ans = []

for n in range(N):
  ame = 0
  for i in range(n+1):
    ame += A1[i]
  for j in range(n, N):
    ame += A2[j]
  ans.append(ame)
  
print(ans)
# Judge status: Accepted


def solve(N,Y):
    for x in range(N+1):
        for y in range(N-x+1):
            z = N-(x+y)
            if(10*x + 5*y + z == Y):
                print("{} {} {}".format(x,y,z))
                return 0

    print("-1 -1 -1")
    
N,Y = map(int, input().split())
Y //= 1000

solve(N,Y)
# Judge status: Accepted
n,k,*a=map(int,open(0).read().split())
ans=10**9
for i in range(n-k+1):
    b,c=a[i],a[i+k-1]
    ans=min(ans,min(abs(b),abs(c))+abs(b-c))
print(ans)
# Judge status: Accepted
S=input()
N=len(S)+1
L=[0]*N
R=[0]*N
ans=[0]*N
for i in range(1,N):
    if S[i-1]=='<':
        L[i]=L[i-1]+1
    if S[N-i-1]=='>':
        R[N-i-1]=R[N-i]+1
for i in range(N):
    ans[i]=max(L[i], R[i])
print(sum(ans))
# Judge status: Accepted
S=input()
a=int(S[0]+S[1])
b=int(S[2]+S[3])
if 0<a<13 and 0<b<13:
    print('AMBIGUOUS')
elif 0<a<13:
    print('MMYY')
elif 0<b<13:
    print('YYMM')
else:
    print('NA')
# Judge status: Wrong Answer
from collections import defaultdict

N, K = map(int, input().split())
ans = 0
a, b = [0] * N, [0] * N
sum = 0
array = defaultdict(int)
for i in range(N):
    a[i], b[i] = map(int, input().split())

for i in range(N):
    array[a[i]] += b[i]

array = dict(sorted(array.items()))
for k, v in array.items():
    sum += v
    ans = k
    if sum >= K:
        break
print(ans)
# Judge status: Wrong Answer
s=str(sorted(input()))
t=str(sorted(input(),reverse=True))
print('YNeos'[s>=t::2])
# Judge status: Accepted
n = input()
s=n[-1]
if s in ['2','4','5','7','9']:
    print('hon')
elif s in ['0','1','6','8']:
    print('pon')
else:
    print('bon')
# Judge status: Wrong Answer
n, m = map(int, input().split())

s = [0] * n
s[0] = 1
b = [1] * n
for i in range(m):
    x, y = map(int, input().split())
    b[x-1] -= 1
    b[y-1] += 1

    s[y-1] = int(s[x-1] == 1)
    s[x-1] = int(b[x-1] != 0)

ans = 0
for i in range(n):
    if s[i] and b[i]:
        ans += 1

print(ans)
# Judge status: Wrong Answer

SN = input()
N = [int(i) for i in SN]

mine = 0
k = True
f = True 

for i in range(len(N)-1, 0, -1):
    if N[i] <= 5:
        mine+=int(N[i])*10**(len(N)-i-1)
        k=True
    else :
        N[i-1]+=1
if N[0] <= 5:
    mine+=int(N[0])*10**(len(N)-1)
else :
    mine+=10**(len(N))

staff = mine - int(SN)
M=[int(i) for i in str(mine)]
S=[int(i) for i in str(staff)]
print(sum(M)+sum(S))
# Judge status: Wrong Answer
n=str(input())
x=len(n)
if n[x-1]=='2' or '4' or '5' or '7' or '9':
  print('hon')
elif n[x-1]=='0' or '1' or '6' or '8':
  print('pon')
else:
  print('bon')
# Judge status: Wrong Answer
def main():
	K,S = map(int,input().split())
	ans = 0
	ListK = [i for i in range(K)]
	for x in ListK:
		for y in ListK:
			for z in ListK:
				if x + y + z == S:
					ans += 1
	print(ans)

if __name__ == '__main__':
	main()
# Judge status: Accepted
n, m = [int(i) for i in input().split()]
data = [0] * n
cnt = [1] * n
data[0] = 1
for i in range(m):
    x, y = [int(i) for i in input().split()]
    if data[x-1] == 1: data[y-1] = 1
    if cnt[x-1] == 1: data[x-1] = 0
    cnt[x-1] -= 1
    cnt[y-1] += 1
print(data.count(1))
# Judge status: Wrong Answer
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=deque()
if n%2==0:
  for x in range(n):
    if x%2==0:
      b.append(a[x])
    else:
      b.appendleft(a[x])
if n%2==1:
  for y in range(n):
    if y%2==0:
      b.appendleft(a[y])
    else:
      b.append(a[y])
print(b)
# Judge status: Wrong Answer
d=int(input())
if d==25:
    print('Christmas')
elif d==24:
    print('Christmas Eve')
elif d==23:
    print('Christams Eve Eve')
else:
    print('Christams Eve Eve Eve')