peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
s_list = list(input())
e_sum = [0]
su = 0
for s in s_list[:-1]:
    if s == "W":
        su += 1
    e_sum.append(su)
w_sum = [0]
su = 0
for s in s_list[::-1][:-1]:
    if s == "E":
        su += 1
    w_sum.append(su)
w_sum = w_sum[::-1]
ans = 10 ** 10
for i in range(n):
    ans = min(ans, e_sum[i] + w_sum[i])
print(ans)
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int,input().split()))
a = collections.Counter(A)
for i in range(1,N+1):
  print(a[i])
# Judge status: Wrong Answer
# C - GCD on Blackboard

n = int(input())
a = list(int(x) for x in input().split())
a.sort()

def gcd(x, y):
    if x==0:
        return y
    else:
        return gcd(y%x, x)

if n==2:
    print(max(a))
else:
    ans = max(gcd(a[0],a[1]), gcd(a[1],a[2]), gcd(a[2],a[0]))
    for i in range(3, n):
        ans = gcd(a[i], ans)
    print(ans)
# Judge status: Wrong Answer

l = ["a","b","c","d","e"]
c = input()

if c in l:
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
n =int(input())

a=[int(x) for x in input().split()]

a.sort()

c=b=0

for i in range(n-1):
  if(a[-i-1]==a[-i-2]):
    a[-i-2]=0
    if b==0:
      b=a[-i-1]
    else:
      c=a[-i-1]
      break
      
print(b*c)
# Judge status: Accepted
N=int(input())
D=list(map(int,input().split()))
M=998244353

P=max(D)
L=[0]*(P+1)
for d in D:
    L[d]+=1

if not(L[0]==1 and D[0]==0):
    print(0)
    exit()

K=1
for i in range(P):
    K*=pow(L[i],L[i+1],M)
    K%=M
print(K)
# Judge status: Accepted
from numpy import array
from numpy.linalg import norm
n,d=map(int,input().split())
X = [list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    if norm(array(X[i])-array(X[j])).is_integer():
      ans += 1
print(ans)
# Judge status: Wrong Answer
n = int(input())
t,a = map(float,input().split())
h = list(map(float,input().split()))
best = 10 ** 5
ans = -1
for i in range(n):
    tt = t - h[i] * 0.006
    best = min(abs(best - a),abs(a - tt))
    if abs(a - tt) == best:
        ans = i
print(ans+1)
# Judge status: Wrong Answer
N,M,K=map(int,input().split())
a=0
for i in range(1,N+1):
    for j in range(1,M+1):
        if i*M+j*N-i*j==K:
            print(i,j)
            a=1
print(["No","Yes"][a])
# Judge status: Accepted
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: map(str, sys.stdin.buffer.readline().split())
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
a = rl()
a.sort()
i = n//2
print(a[i] - a[i-1])
# Judge status: Accepted
h, n = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(n)]
A = [a for a, b in AB]
B = [b for a, b in AB]
inf = 10**10
# DP[i][j]=i個以内で体力j以上削るための消費魔力の最小値
DP = [[inf for j in range(h+1)] for i in range(n+1)]
DP[0][0] = 0
for i in range(1, n+1):
    for j in range(h+1):
        DP[i][j] = min(DP[i-1][j], DP[i][max(0, j-A[i-1])]+B[i-1])
print(DP[n][h])
# Judge status: Wrong Answer
import math
f = True
N = int(input())
for i in range(N):
    if math.floor(i*1.08) == N:
        print(i)
        f = False
if f:
    print(":(")
# Judge status: Accepted
s = input()
t = input()
s_len = len(s)
for i in range(s_len):
    if s == t:
        print("Yes")
        exit()
    s = s[s_len-1] + s[0:s_len-1]
print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline

n, a, b = [int(x) for x in input().split()]

def nCk(n, k, mod=10 ** 9 + 7):
    if n < k:
        return 0
    k = min(k, n - k)
    numer = 1
    for x in range(n - k + 1, n + 1):
        numer = (numer * x) % mod
    denom = 1
    for x in range(1, k + 1):
        denom = (denom * x) % mod
    return numer * pow(denom, mod - 2, mod) % mod

ans = 0
total = 0
total = 2 ** n - 1
total %= 7 + 10 ** 9

total -= nCk(n, a) + nCk(n, b)
total %= 7 + 10 ** 9

print(total)
# Judge status: Accepted
import sys

def resolve():
    N = int(input())
    S = input()
    res = 0
    for i in range(1, N-1):
        cnt = 0
        left = S[:i]
        right = S[i:]
        counted = []
        for s in left:
            if s in right and s not in counted:
                counted.append(s)
                cnt += 1

        res = max(cnt, res)
    print(res)

if '__main__' == __name__:
    resolve()
# Judge status: Accepted
s = list(input())
t = s[0]
for i in range(1, 4):
    if t == s[i]:
        print('Bad')
        exit()
    t = s[i]

print('Good')
# Judge status: Accepted
N, M = map(int,input().split())
DP = [0 for i in range(N+1)]
DP[0]=1
for i in range(M):
    DP[int(input())] = None
for i in range(N):
    if 0<i and DP[i+1]!=None and DP[i-1]!=None:
        DP[i+1]+=DP[i-1]
    if DP[i+1]!=None and DP[i]!=None:
        DP[i+1]+=DP[i]
print(DP[N]%1000000007)
# Judge status: Accepted
H = int(input())

n = H.bit_length()
print(pow(2,n)-1)
# Judge status: Accepted
a,b,c=sorted(map(int, input().split()))

print(10*c+b+a)
# Judge status: Accepted
k = int(input())
s = input()
s_len = len(s)
if s_len <= k:
    print(s)
else:
    print(s[:k]+'...')
# Judge status: Wrong Answer
N = int(input())
print(N * (N-1) / 2)
# Judge status: Accepted
x, a, b = [int(s) for s in input().split()]
print("delicious" if b <= a else ("safe" if b <= a + x else "dangerous"))
# Judge status: Wrong Answer
s=input()
t=input()
if s in t:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, k = map(int, input().split())

data = [0] * n

for i in range(k):
    d = int(input())
    people = list(map(int, input().split()))

    for j, val in enumerate(people):
        tar = val - 1
        data[tar] += 1

ans = 0

for i in data:
    if (i == 0):
        ans += 1
print(ans)
# Judge status: Wrong Answer
n,x=map(int,input().split())

kuro=[]
for i in range(x-n+1,x):
    kuro.append(i)
for i in range(x,n+x):
    kuro.append(i)
print(kuro)
# Judge status: Accepted
N, K = map(int, input().split())
S = input()

ans = 0
for i in range(N):
    if S[i] == 'L':
        if i - 1 < 0:
            continue
        if S[i - 1] == 'L':
            ans += 1
    else:
        if i + 1 >= N:
            continue
        if S[i + 1] == 'R':
            ans += 1


X = (len([s for s in S.split('L') if s != '']) + len([s for s in S.split('R') if s != '']))
ans += min(X, K) * 2
print(min(ans, N - 1))
# Judge status: Accepted
x=int(input())
y=int(input())
l=[1,2,3]
l.remove(x)
l.remove(y)
print(l[0])
# Judge status: Accepted
Q, H ,S, D = map(int, input().split())
N = int(input())

tmp = [Q*4, H*2, S]
m = min(tmp)

if N == 1:
    print(m)
else:
    print(min(m*2, D) * (N//2) + m*(N%2))
# Judge status: Accepted
N = int(input())
A, B = [], []
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    
A.reverse()
B.reverse()
count = 0
for i in range(N):
    now = A[i] + count
    if now % B[i] == 0:
        pass
    elif now < B[i]:
        count += B[i] - now
    else:
        count += B[i] - (now % B[i])

print(count)
# Judge status: Wrong Answer
n,k = list(map(int,(input().split())))

if n<k :
  print(n)
elif n>=k:
  x = n//k
  ans = n-(x*k)
  ans_x = abs(n-(k*(x+1)))
  if ans >= ans_x:
    print(ans_x)
  else:
    print(ans)

#print(ans_x,ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
if 4*a*b<(c-a-b)**2 and c-a-b>=0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N=int(input())
A=[int(x) for x in input().rstrip().split()]
B=[int(x) for x in input().rstrip().split()]
ans=0
now=A[0]
for i in range(N):
  if B[i]<=A[i]:
    ans+=B[i]
  else:
    if A[i]+A[i+1]<=B[i]:
      ans+=A[i]+A[i+1]
      A[i+1]=0
    else:
      ans+=B[i]
      A[i+1]=A[i+1]-(B[i]-A[i])
print(ans)
# Judge status: Accepted
N = int(input())
if N % 2:
    print(0)
else:
    N //= 2
    ans = 0
    while N:
        N //= 5
        ans += N
    print(ans)
# Judge status: Accepted
N = int(input())
S = list(input())
cnt = []
for i in range(0,N):
    s1 = set(S[0:i])
    s2 = set(S[i:])
    cnt.append(len(list(s1 & s2)))
print(max(cnt))
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
y=0
if n!=1:
    for i in range(1,n+1):
        x=0
        for j in range(n):
            for k in range(1,a[j][0]+1):
                if str(i) in str(a[j][k]):
                    x+=1
        if x==n:
            y+=1
    print(y)

else:
    print(a[0][0])
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import deque

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

while True:
  if c-b<=0:
    print("Yes")
    exit()
  elif a-d<=0:
    print("No")
    exit()
  c=c-b
  a=a-d
# Judge status: Wrong Answer
N=int(input())
L=list(map(int,input().split()))
avg = sum(L)/len(L)
import math
avg_u = math.ceil(avg)
avg_d = math.floor(avg)
ans_u = []
ans_d = []
for i in L:
  ans_u.append(i - avg_u)
  ans_d.append(i - avg_d)

ans = 0
if sum(ans_u) <= sum(ans_d):
  for i in ans_u:
    ans += i ** 2
else:
  for i in ans_d:
    ans += i ** 2
print(ans)
# Judge status: Accepted
N, x = map(int,input().split())
a = list(map(int,input().split()))

ans = 0
for k in range(1,N):
    if a[k-1] + a[k] > x:
        t = (a[k-1] + a[k]) - x
        ans += t
        if a[k] >= t:
            a[k] -= t
        else:
            a[k-1] -= t-a[k]
            a[k] = 0
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

Plus = True
ans = 1
last = a[0]
count = 1
for i in range(n):
    if last > a[i] and Plus:
        if count > 1:
            ans += 1
            count = 0
        Plus = False
    if last < a[i] and Plus == False:
        if count > 1:
            ans += 1
            count = 0
        Plus = True
    #print(Plus)
    last = a[i]
    count += 1

print(ans)
# Judge status: Accepted
N = int(input())
A = [0] + list(map(int, input().split()))

ans = [0] * (N+1)
for i in range(N, 0, -1):
    if sum(ans[i+i:N+1:i])%2 != A[i]: ans[i] = 1


print(sum(ans))
f = 0
for i in range(N+1):
    if ans[i] == 0: continue
    if f: print(' ')
    print(i, end ='')
    f = 1
if f:print()
# Judge status: Wrong Answer
N = int(input())
n = [int(list(str(N))[i]) for i in range(len(list(str(N))))]
L = len(list(str(N)))-1
a = (N-10**L+1)//(10**L+1)
print(max(L*9+a,sum(n)))
# Judge status: Accepted

if __name__ == "__main__":
    x = int(input())
    ret = 0
    if x == 1:
        ret = 0
    else:
        ret = 1
    print(ret)
# Judge status: Accepted
S = input()
cnt = 0
ch = S[0]
for i in range(1,len(S)):
	if S[i] == ch:
		cnt+=1
		if ch == "0":
			ch = "1"
		else:
			ch = "0"
	else:
		ch = S[i]
print(cnt)
# Judge status: Wrong Answer
n, a, b, c, d = map(int, input().split())
s = input()
flag1, flag2 = False, False
if d > c:
    print("OK1")
    flag = "##" not in s[b: d - 1] and "##" not in s[a: c - 1]
else:
    print("OK2")
    flag = "..." in s[b: d - 1]

print("Yes" if flag else "No")
# Judge status: Accepted
import math

X = int(input())
N = int(math.sqrt(2 * X)) + 1

def gauss(n):
    ans = int(n * (n + 1)/ 2)
    return(ans)

A = [gauss(i) for i in range(N + 1)]

ans = 0
for i in range(1, N + 1):
    if X == A[i]:
        ans = i
        break
    elif X > A[i - 1] and X < A[i]:
        ans = i
        break

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.buffer.readline
n,m,x=map(int,input().split())
c=[]
a=[]
for _ in range(n):
	s,*t=map(int,input().split())
	c.append(s)
	a.append(t)
ans=float("inf")
for i in range(2**n):
	l=[[0]*m]
	need=0
	for j in range(n):
		if i&(1<<j):
			l.append(a[j])
			need+=c[j]
	if all(sum(t)>=x for t in zip(*l)):
		ans=min(ans,need)
print(ans if ans!=float("inf") else -1)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if (a*b)%2==0:
    print("偶数")
else:
    print("奇数")
# Judge status: Accepted
import numpy as np
N = int(input())
A = list(map(int, input().split()))
A.sort()
A = np.array(A)
B = list(map(int, input().split()))
B.sort()
B = np.array(B)
C = list(map(int, input().split()))
C.sort()
C = np.array(C)

ans = 0
for i in range(N):
	b = B[i]
	a_ind = np.searchsorted(A,b,side='left')
	c_ind = np.searchsorted(C,b,side='right')
	ans += a_ind * (N-c_ind)

print(ans)
# Judge status: Accepted
l,r,d=map(int,input().split())

count=0
for i in range(l,r+1):
  if i%d==0:
    count+=1
print(count)
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline

N, M, *A = map(int, read().split())
s = sum(A) / (4 * M)
a = [i for i in A if i >= s]
if len(a) >= M:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
Str = ""
while n != 0:
    r = n % 2
    if r < 0:
        r += 2
    n = (n-r) // (-2)
    Str += str(r)
tmp = list(reversed(list(Str)))
ans = "".join(tmp)
if Str == "":
    print(0)
    exit()
print(ans)
# Judge status: Accepted
N = int(input())
if N % 2 == 0:
  ans = N//2
else:
  ans = N//2 + 1
print(ans)
# Judge status: Accepted
n = int(input())
d_inputs = sorted([int(i) for i in input().split()])

abc = d_inputs[0:n//2]
arc = d_inputs[n//2:n]

print(len([i for i in range(abc[-1]+1,arc[0]+1)]))
# Judge status: Accepted
x=int(input())
if x in [3,5,7]:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
a, b, c = map(int, input().split())
print(int(a * b / 2))
# Judge status: Wrong Answer
k = int(input())
a, b = map(int,input().split())
if k <= b-a+1:
  print('OK')
else:
  print('NG')
# Judge status: Accepted
H,N=map(int,input().split())
A=list(map(int,input().split()))
print("Yes" if sum(A)>=H else "No")
# Judge status: Accepted
from math import ceil, log

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

ans = 0
for i in range(1, N+1):
    val = i
    # val * 2^n > K
    # 2^n > K / val
    # n > log(K/val) / log2
    count = ceil(log(K/val) / log(2))
    count = 0 if count < 0 else count
    ans += 1 / (pow(2, count) * N)

print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
a = [int(input()) for _ in range(m)]
dp=[0 for _ in range(n+1)]
dp[0]=1
for i in range(1,n+1):
    if i in a:
        continue
    else:
        if i==1:
            dp[1]=1
        else:
            dp[i] = (dp[i-1]+dp[i-2]%1000000007)
print(dp[n])
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

drop_zero = a[1:]
drop_one = [a[0]] + a[2:]

ans_drop_zero = drop_zero[0]
for v in drop_zero:
    ans_drop_zero = gcd(ans_drop_zero, v)

ans_drop_one = drop_one[0]
for v in drop_one:
    ans_drop_one = gcd(ans_drop_one, v)

print(max(ans_drop_zero, ans_drop_one))
# Judge status: Wrong Answer
import math

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

ans = math.ceil(n/k)

print(ans)
# Judge status: Accepted
N, M, K = map(int, input().split())

def solve():    
    for i in range(N+1):
        for j in range(M+1):
            if i*M+j*N-i*j*2 == K:
                return 'Yes'
    
    return 'No'
            
print(solve())
# Judge status: Accepted
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


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


def _main():
    n, k = input().split()
    x = set(input())

    n_s = set(n)

    n_i = int(n)
    while True:
        if x & n_s:
            n_i += 1
            n_s = set(str(n_i))
        else:
            print(n_i)
            break


if __name__ == "__main__":
    _main()
# Judge status: Accepted
l = list(map(int, input().split()))
i = l.index(max(l))
print(l.pop(i) * 10 + sum(l))
# Judge status: Accepted
n = int(input())

print((n * (n - 1))// 2)
# Judge status: Accepted
from itertools import accumulate

def calc(n,A):
    Imos=[0]*(n+1)
    for i,a in enumerate(A):
        Imos[max(0,i-a)]+=1
        Imos[min(n,i+a+1)]-=1
    Ret=list(accumulate(Imos))
    return Ret[:n]

def main():
    n,k=map(int,input().split())
    A=tuple(map(int,input().split()))
    if k>=42:
        A=[n]*n
    else:
        for _ in range(k):
            A=calc(n,A)
    print(*A)
    
if __name__=='__main__':
    main()
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))
n, x, t = read()
print(n//x * t)
# Judge status: Accepted
N=int(input())
if N%2==1:
    print(0)
else:
    a=0
    for i in range(1,26):
        a+=(N)//(2*5**i)
    print(a)
# Judge status: Accepted
N = int(input())

cnt = 0
ans = 'No'

for _ in range(N):
    D = input().split()
    cnt = (cnt + 1)*(D[0] == D[1])
    if cnt == 3:
        ans = 'Yes'

print(ans)
# Judge status: Wrong Answer
X = int(input())
if X < 100:
  print('0')
  exit()


rest = int(str(X)[-2:])
big = X - rest
cnt = 0

cnt += rest // 5
rest = rest - (rest // 5) * 5
cnt += rest // 4
rest = rest - (rest // 5) * 5
cnt += rest // 3
rest = rest - (rest // 5) * 5
cnt += rest // 2
rest = rest - (rest // 5) * 5
cnt += rest

big -= cnt * 100
print('1' if big >= 100 and big % 100 == 0 else '0')
# Judge status: Wrong Answer
s = input()
t = input()

s=sorted(s)
t=sorted(t)

if s<t:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a = int(input())
b = input()
x = a - int(a / 2)
y = a - x
z = 0
X = b[0:x]
Y = b[x:a]
X = list(set(X))
Y = list(set(Y))
X.sort()
Y.sort()
if len(X) >= len(Y):
    for i in range(len(X) - len(Y)):
        Y.append("")
else:
    for i in range(len(Y) - len(X)):
        X.append("")

for i in range(len(X)):
    if X[i] in Y:
        z = z + 1
print(z)
# Judge status: Accepted
N = int(input())
A = [[int(i) for i in input().split()] for j in range(2)]
dp = [[0]*(N+1) for i in range(3)]
for i in range(1,3):
    for j in range(1,N+1):
        dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + A[i-1][j-1]
print(dp[-1][-1])
# Judge status: Wrong Answer
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for i in range(N)]
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(1,N+1):
    for w in range(W+1):
        if w-wv[i-1][0]>=0:
            dp[i][w] = max(dp[i-1][w-wv[i-1][0]]+wv[i-1][1],dp[i][w])
        else:
            dp[i][w] = dp[i-1][w]
print(dp[N][W])
# Judge status: Accepted
import math
import numpy
K = int(input())

total = tmp = 0
for a in range(1,K+1) :
  for b in range(1,K+1) :
   tmp=math.gcd(a,b)
   for c in range(1,K+1) :
      total += math.gcd(tmp,c)

print(total)
# Judge status: Wrong Answer
N = int(input())
p = list(map(int,input().split()))

ans = 0
for j in range(len(p)):
    agc = [i for i in p if i>j]
    if len(agc) == len(p)-len(agc):
        ans += 1

print(ans)
# Judge status: Wrong Answer
#! env/bin/local python3
# -*- coding: utf-8 -*-

from itertools import combinations


def is_tri(_a, _b, _c):
    if (_a + _b > _c) and (_b + _c > _a) and (_c + _a > _b):
        return True
    else:
        return False


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

h = combinations(sticks, 3)

counter = 0
for a, b, c in h:
    if is_tri(a, b, c):
        # a, b, c = sorted([a, b, c])
        if (a is not b) and (b is not c) and (c is not a):
            counter += 1

print(counter)
# Judge status: Accepted
N=int(input())
a=0
for i in range(1, N+1):
  if i % 15 == 0:
    continue
  if i % 3 == 0:
    continue
  if i % 5 == 0:
    continue
  a += i
print(a)
# Judge status: Wrong Answer
N = int(input())
L = list(map(int,input().split()))
if max(L) <= sum(L)-max(L):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b,c,=map(int,input().split())
if a+b+c<22:
    print("win")
else:
    print("bust")
# Judge status: Wrong Answer
H, N = input().split()
H = int(H)
N = int(N)
a = []
b = []
con = 1
while con <= N:
    A, B = map(int, input().split())
    a.append(A)
    b.append(B)
    con += 1
# Judge status: Accepted
import math
s = int(input())
a = math.ceil(math.sqrt(s))
b = a**2-s
print(0,0,a,1,b,a)
# Judge status: Wrong Answer
K,N = map(int,input().split())
A = list(map(int,input().split()))
X = 0
Y = 0
for i in range(N):
    if A[i] == 0:
        A[i] = K
A.sort()
b = A.copy()
for i in range(N-1):
    #時計回り
    X +=  b[i+1]-b[i]
c = A.copy()
c.reverse()
for j in range(N-1):
    Y += A[i+1]-A[i]
print(min(X,Y))
# Judge status: Accepted
n = int(input())
s = input()
t = input()
max_ans = 0
if n==1:
    if s != t:
        print(2)
    else:
        print(1)
else:
    for i in range(n):
        if s[i:n] == t[0:n-i]:
            max_ans = max(n-i,max_ans)
    print(max_ans+(n-max_ans)*2)
# Judge status: Accepted
a, b = map(int, input().split())

k = b - a
print(k*(k+1) // 2 - b)
# Judge status: Wrong Answer
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,copy
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
a = [abs(x) for x in a]
a.sort()
a[0] = -a[0]
print(sum(a))
# Judge status: Wrong Answer
n = int(input())
ws = list(map(int, input().split()))
mn = 10**4
for i in range(n):
  t = i+1
  a,b = [],[] 
  if ws[i] > t:
    a.append(ws[i])
  else:
    b.append(ws[i])
  mn = min(mn, abs(sum(a)-sum(b)))
print(mn)
# Judge status: Accepted
s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')
# Judge status: Accepted
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


n = int(input())
digi = len(str(n))
ans = 0
if not bool(n&1):
    for i in range(1,50):
        ans += n//(5**i)//2

print(ans)
# Judge status: Accepted
n, x = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# k = int(input())
L = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
#ab = [list(map(int, input().split())) for i in range(n)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
d = 0
count = 1
for l in L:
    if d+l > x:
        break
    else:
        d = d+l
        count += 1

print(count)
# Judge status: Accepted
n, d = map(int,input().split())
point = []
ans = 0
for i in range(n):
    point.append(list(map(int,input().split())))
for i in range(n+1):
    for j in range(i+1, n):
        dist = 0
        for k in range(d):
            dist += (point[i][k] - point[j][k])**2
        ans_dist = dist ** 0.5
        int_ans_dist = int(ans_dist)
        if ans_dist == int_ans_dist:
            ans += 1
print(ans)
# Judge status: Accepted
k, a, b = map(int, input().split())
print(max(k+1, (k-a+1)//2*(b-a)+a+(k-a+1)%2))
# Judge status: Wrong Answer
def resolve():
    D, N = [int(i) for i in input().split()]
    if D == 0:
        print(N + (N) // 100)
        return
    print(100**D * N)


resolve()
# Judge status: Accepted
n=int(input())
a=[int(input()) for i in range(n)]
cnt=0
button=0
flag=False
#ボタン1が最初光っている(インデックスは0)
for i in range(n):
    #ボタンを押す
    cnt+=1
    button=a[button]-1
    if button==1:
        flag=True
        break
if flag:
    print(cnt)
else:
    print(-1)
# Judge status: Accepted
a,b = map(int,input().split())
print(a-1 if b<a else a)
# Judge status: Accepted
import math
X = int(input())

sq = int(math.sqrt(X))

candidates = [1]
for b in range(2, sq+1):
    p = 2
    tmp = b ** p
    while tmp <= X:
        candidates.append(tmp)
        p += 1
        tmp = b ** p

print(sorted(candidates)[-1])
# Judge status: Wrong Answer
import bisect
H,N = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
dp = [[10**18]*10**4 for _ in range(N+1)]
for i in range(N+1):
  dp[i][0]=0
mi=10**9
for i in range(N):
  for w in range(10**4):
    dp[i+1][w]=min(dp[i+1][w],dp[i][w])
    if w-AB[i][0]>=0:
      dp[i+1][w]=min(dp[i+1][w],dp[i + 1][w - AB[i][0]] + AB[i][1])
for i in range(H,10**4):
  mi = min(mi,dp[N][i])
print(mi)