peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a,b,c=[int(_) for _ in input().split()]
if c-a-b<=0:
    print("No")
else:
    k=2*(a*b + b*c + c*a) - a**2 - b**2 - c**2
    print("Yes" if k<0 else "No")
# Judge status: Accepted
s = input()
print("Yes" if len(set(s)) == 3 else "No")
# Judge status: Accepted
def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split())) #横並びの場合
n = int(input())
a = intList()

#MAX_NUM = 1000000 * 1000000 * 1000000
MAX_NUM = 10**18

for i in range(n):
    if a[i] == 0:
        print(0)
        exit()

ans = 1
for i in range(n):
    ans *= a[i]
    if ans > MAX_NUM:
        print(-1)
        exit()

print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
x,y=[],[]

for i in range(n):
  x.append(input())

for i in range(m):
  y.append(input())

for i in range(n-m+1):
  for j in range(n-m+1):
    if x[i][j]==y[0][0]:
      if m==1:
        print('Yes')
        exit()
      ans='Yes'
      for k in range(m):
        if x[i+k][j:j+n-m+1]!=y[k]:
          ans='No'

      if ans=='Yes':   
        print('Yes')
        exit()
        
print('No')
# Judge status: Wrong Answer
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


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


if __name__ == '__main__':
    n =int(input())
    ans =1
    for i in range(1,n):
        ans = ans *i
        ans = ans % (10**9 +7)
    print(ans)
# Judge status: Accepted
s = list(input())
t = input()
for i in range(len(s)):
    rotate_s = s.pop()
    s.insert(0, rotate_s)
    if "".join(s) == t:
        print("Yes")
        exit()
print("No")
# Judge status: Wrong Answer
H,N=map(int,input().split())
A=[int(i) for i in input().split()]
print('Yes' if H<sum(A) else "No")
# Judge status: Wrong Answer
x, k, d = (int(x) for x in input().split())

if x < k*d:
    print(x % d)
else:
    print(x - k * d)
# Judge status: Accepted
a = int(input())
input()
input()
input()
e = int(input())
k = int(input())
print("Yay!" if e - a <= k else ":(")
# Judge status: Accepted
a, b, c, d = map(int, input().split())

while(1):
    c = c - b
    if c <= 0:
        print("Yes")
        break

    a = a - d
    if a <= 0:
        print("No")
        break
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
# Judge status: Accepted
n = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[n//2]-d[n//2-1])
# Judge status: Accepted
N=int(input())
M=10**9+7
ans=1
m=1
for i in range(N):ans=(ans*10)%M
for i in range(N):m=(m*9)%M
ans-=(m*2)%M
m=1
for i in range(N):m=(m*8)%M
print((ans+m)%M)
# Judge status: Wrong Answer
n,T = map(int,input().split())
ans = 2000
for i in range(n):
  c,t = map(int,input().split())
  if t <= T:
    ans = min(ans, t)
if ans == 2000:
  print('TLE')
else:
  print(ans)
# Judge status: Accepted
if __name__ == '__main__':
  s = input()
  a= [int(elem) for elem in s.rstrip().split(' ')]
  print(len(set(a)))
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a<b:
  print(a-1)
else:
  print(a)
# Judge status: Accepted
a,b = map(int,input().split())
if b >= a:
    print(a)
else:
    print(a-1)
# Judge status: Wrong Answer
n=int(input())
cnt=0
B1=list(map(int,input().split()))
print(-1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
x = [0] * max(a)
for i in a:
    x[i - 1] += 1
all = 0


def nc2(n):
    return int(n * (n - 1) / 2)


for j in x:
    if j >= 2:
        all += nc2(j)

for i in range(n):
    if x[a[i]-1] >= 2:
        print(all-x[a[i]-1]+1)
    else:
        print(all)
# Judge status: Accepted
from collections import Counter
n = int(input())
a = []
for i in range(n):
    a.append(Counter(input()))
for i in range(97, 97+26):
    m = 100
    for j in range(n):
        m = min(a[j][chr(i)], m)
    print(chr(i)*m, end='')
print()
# Judge status: Accepted
n,k = list(map(int, input().split()))

if n%k == 0 :
  print("0")
else:
  print("1")
# Judge status: Accepted
n,k = map(int,input().split())
ab = []
for _ in range(n):
    a=int(input())
    ab.append(a)
ab.sort()
#print(ab)
ans = 1000000000000000000000

for i in range(k-1, n):
    ans = min(ans,ab[i]-ab[i-k+1])
print(ans)
# Judge status: Accepted
n,c,k = map(int, input().split())
T = []
for i in range(n):
    T.append(int(input()))
T.sort()
ans = 1
last_t = T[0]
passengers = 0
for t in T:
    if last_t +k >= t and passengers < c:
        passengers += 1
    else:
        last_t = t
        passengers = 1
        ans += 1

print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
for i in range(1,b+1):
    if i*a%b==c:
        print("YES")
        exit()
print("NO")
# Judge status: Accepted
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
q.sort()
pp=p[-x:]
qq=q[-y:]

eat=[]
eat.extend(pp)
eat.extend(qq)
eat.extend(r)
eat.sort()
e=eat[(-x-y):]
print(sum(e))
# Judge status: Accepted
def expectation(li):
  total = 0
  for i in li:
    total += (i+1)/2
  return total

n,k = map(int,input().split())
p = list(map(int,input().split()))
ex = expectation(p[0:k])
li = [ex]
for i in range(1,n-k+1):
  ex = ex - (p[i-1]+1)/2 + (p[i+k-1]+1)/2
  li.append(ex)
print(max(li))
# Judge status: Wrong Answer
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n = int(input())
#  = map(int, input().split())
a  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()


ans = 1
state = lambda n1, n2: 0 if n1 == n2 else (1 if n2 > n1 else -1)
diff = [state(a1, a2) for a1, a2 in zip(a[:-1], a[1:])]

p = 1
while p < len(diff):
    if abs(diff[p] - diff[p-1]) == 2:
        ans += 1
        p += 1

    p += 1

print(ans)
# Judge status: Accepted
print(['NO','YES'][int(''.join(input().split()))%4==0])
# Judge status: Wrong Answer
n=int(input())
p=list(map(int,input().split()))
cnt=0
p2=[]
for i,x in enumerate(p):
    if (i+1)==p[i]:
        p2.append(False)
    else:
        p2.append(True)

for i in range(n-1):
    if p2[i]==False and p2[i+1]==True:
        p2[i]=True
        cnt+=1
    if p2[i]==False and p2[i+1]==False:
        p2[i]=True
        p2[i+1]=True
        cnt+=1
print(cnt)
# Judge status: Accepted
n = int(input())
hl = list(map(int, input().split()))

ans = 0
cnt = 0
prev_h = 0
for h in hl:
    if h > prev_h:
        ans = max(ans,cnt)
        cnt = 0
    else:
        cnt += 1
    prev_h = h

ans = max(ans,cnt)
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    n = int(input())

    for i in range(10**4):
        if n <= i * (i + 1) / 2:
            tmp = i
            break
    tmpsum = tmp * (tmp + 1) / 2
    if n == tmpsum:
        for i in range(1, tmp + 1):
            print(i)
    else:
        for i in range(1, tmp + 1):
            if i == tmpsum - n:
                continue
            print(i)


if __name__ == "__main__":
    main()
# Judge status: Accepted
import fileinput

s = list(input())

if s[0] != "A" or s[1].isupper() or s[len(s) - 1].isupper():
    print("WA")
    exit()

cc = False
for i in range(2, len(s) - 1):
    if s[i] == "C" and not cc:
        cc = True
        continue
    if s[i] == "C" and cc:
        print("WA")
        exit()
    if s[i].isupper() and s[i] != "C":
        print("WA")
        exit()

if cc:
    print("AC")
else:
    print("WA")
# Judge status: Accepted
import sys


def main():
    input = sys.stdin.buffer.readline
    N, M = map(int, input().split())
    skip = (N // 2) // 2 + 1 if N % 2 == 0 else None
    count = 0
    left, right = 0, N + 1
    while count < M:
        left += 1
        if left == skip:
            continue
        right -= 1
        print(left, right)
        count += 1


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
r=input("r:")
PI=3.14
s1=(r**2)*PI
print(s1/PI)
# Judge status: Accepted
X = input()

ans = "1"
if int(X) < 100:
	ans = "0"
elif not int(X[:-2])*5 >= int(X[-2:]):
	ans = "0"

print(ans)
# Judge status: Wrong Answer

def main():
    
    a = int(input())
    b = int(input())

    if a == 1 and b == 2:
        print(3)
    elif a == 2 and b == 3:
        print(1)
    else:
        print(2)
        
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,x,t = map(int,input().split())
print((n*t)//x + 1)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    AtoE = [int(input()) for _ in range(5)]
    k = int(input())

    for i in AtoE:
        for j in AtoE:
            if abs(i - j) > k:
                print(':(')
                exit()
    else:
        print('Yay!')

if __name__ == '__main__':
    main()
# Judge status: Accepted
n, k, s = map(int, input().split())
if s == 10 ** 9:
    l = [s] * k + [1] * (n - k)
else:
    l = [s] * k + [s + 1] * (n - k)
print(*l)
# Judge status: Accepted
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())
    a.sort(reverse=True)
    alice = sum(a[::2])
    bob = sum(a[1::2])
    print(alice - bob)


if __name__ == '__main__':
    main()
# Judge status: Accepted
#!/usr/bin/env python3
*a, = map(int, open(0).read().split())
ans = 0
m = 10
for i in a:
    if i % 10 != 0:
        m = min(m, i % 10)
        ans += i//10*10 + 10
    else:
        ans += i//10*10
print(ans-10+m)
# Judge status: Accepted
from itertools import accumulate
N, Q = map(int, input().split())
S = input()
counts = [[0] * N for _ in range(2)]
for i, c in enumerate(zip(S[:-1], S[1:])):
    counts[i & 1][i] = int(c == ("A", "C"))
for i in range(2):
    counts[i] = list(accumulate(reversed(counts[i])))[::-1]
for _ in range(Q):
    l, r = map(lambda n: int(n) - 1, input().split())
    print(counts[0][l] - counts[0][r] + counts[1][l] - counts[1][r])
# Judge status: Accepted
import numpy as np


def main():
    a, b, n = map(int, input().split())

    if b <= n:
        n = b - 1
    ans = int(np.floor(a*n/b)) - int(a*np.floor(n/b))
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n, m = map(int, input().split())
l = [0] * n
f = [True] * n
for _ in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'WA':
        if f[p]:
            l[p] += 1
    else:
        f[p] = False
ans = 0
for i in range(n):
    if not f[i]:
        ans += l[i]
print(f.count(False), ans)
# Judge status: Wrong Answer
import math
K=int(input())

answer=0
for i in range(K):
  for j in range(K):
    gcd_ij=math.gcd(i,j)    
    for k in range(K):
      gcd_ijk=math.gcd(gcd_ij,k)
      answer+=gcd_ijk

print(answer)
# Judge status: Accepted
c = []
for i in range(3):
    c.append(list(map(int, input().split())))

for i in range(2):
    for j in range(2):
        if c[j][i+1] - c[j][i] != c[j+1][i+1] - c[j+1][i]:
            print('No')
            exit()
print('Yes')
# Judge status: Wrong Answer
import math

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

m = sum(li) / N

new = sorted(li)

for i in range(N):
  if i <= (N / 2) - 1:
    print(new[math.floor(N/2)])
  else:
    print(new[math.floor(N/2) - 1])
# Judge status: Accepted
from math import*
A,B,X = map(int,input().split())
V = A*A*B

if V/2<X:
  print(degrees(atan(2*(V-X)/A**3)))
else:
  print(degrees(atan(A*B*B/2/X)))
# Judge status: Accepted
from fractions import gcd
n,x=map(int,input().split())
X=list(map(int,input().split()))
res=abs(X[0]-x)
 
for y in X:
	res=gcd(res,abs(y-x))
	
print(res)
# Judge status: Wrong Answer
A,B,C= map(int, input().split())
print(B*C/2)
# Judge status: Accepted
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
for i in range(n-m+1):
  for l in range(n-m+1):
    ok=True
    for j in range(m):
      for k in range(m):
        if b[j][k]!=a[i+j][l+k]:
          ok=False
    if ok:
      print('Yes')
      exit()
print('No')
# Judge status: Accepted
S = input()
D = ['SUN','MON','TUE','WED','THU','FRI','SAT']
for i in range(7):
  if S == D[i]:
    print(7-i)
# Judge status: Wrong Answer
import re
def checkkeyence(s):
    patternlist = [".*keyence", "k.*eyence","ke.*yence","key.*ence","keye.*nce","keyen.*ce","keyenc.*e","keyence.*"]
    for p in patternlist:
        if re.match(p,s) != None:
            return 'YES'
    return 'NO'
        
s=input();print(checkkeyence(s))
# Judge status: Accepted
A,V = map(int,input().split())
B,W = map(int,input().split())
T = int(input())
s = 'YES'
if abs((B-A))<=(V-W)*T:
	print('YES')
else:
	print('NO')
# Judge status: Accepted
s = list(input())
l = len(s)//2
cnt = 0
for i in range(l):
    j = len(s) - i - 1
    if s[i] != s[j]:
        cnt += 1
print(cnt)
# Judge status: Accepted
import math
A,B,N = map(int,input().split())


x=min(B-1,N)
print(math.floor(A*x/B)-A*math.floor(x/B))
# Judge status: Accepted
N, K = map(int, input().split())

tree = []
for _ in range(N):
    tree.append(int(input()))

tree.sort()
ans = 10**9
for i in range(N-K+1):
    ans = min(ans, tree[i+K-1]-tree[i])
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
if N==M:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
miss = 0
for i in range(n):
    if i+1 != p[i]:
        miss += 1

if miss > 2:
    print('NO')
else:
    print('YES')
# Judge status: Wrong Answer
import re

s = input()
t = input()
cnt = -1
for i in range(len(t) + 1):
    cnt += 1
    f = "\S{" + str(i) +"}" + t[(i):len(t)]
    b = t[0:len(t) - i] + "\S{" + str(i) + "}"
    if re.search(f, s):
        print("in")
        break
    elif re.search(b, s):
        print("in")
        break

print(cnt)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N = int(input())
S = list(input().rstrip())
ans = []
x = 0
for i in S:
    if i == "I":
        x += 1
    else:
        x -= 1
    ans.append(x)
print(max(ans))
# Judge status: Accepted
icase=0
if icase==0:
    s=input()
    yyyy=int(s[0:4])
    mm=int(s[5:7])
    dd=int(s[8:])
    if yyyy<2019:
        print("Heisei")
    elif yyyy==2019 and mm<4:
        print("Heisei")
    elif yyyy==2019 and mm==4 and dd<=30:
        print("Heisei")
    else:
        print("TBD")
# Judge status: Accepted
def main():
    n = int(input())
    s = input()

    l, r = 0, 0

    for i in s:
        if i == ")":
            if l:
                l -= 1
            else:
                r += 1
        else:
            l += 1

    print(r * "(" + s + ")" * l)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())
print(max(a, b, c) * (2 ** k) + a + b + c - max(a, b, c))
# Judge status: Accepted
n = int(input())
ans = "No"
for i in range(26):
    for j in range(20):
        if 4*i+7*j==n:
            ans = "Yes"
            break
print(ans)
# Judge status: Wrong Answer
#ABC126 B

S = list(map(int,input()))
if S[0]*10 + S[1] <= 12 and S[2]*10 + S[3] <= 12:
    print("AMBIGUOUS")
elif S[0]*10 + S[1] <= 12 and S[2]*10 + S[3] > 12:
    print("MMYY")
elif S[0]*10 + S[1] > 12 and S[2]*10 + S[3] <= 12:
    print("YYMM")
elif S[0]*10 + S[1] > 12 and S[2]*10 + S[3] > 12:
    print("NA")
# Judge status: Wrong Answer
N,D=map(int,input().split())
res = 0
for i in range(D,N+1,2*D):
  res += 1
print(res)
# Judge status: Wrong Answer
a=int(input())
b=int(input())
h=int(input())
print((a+b)*h/2)
# Judge status: Accepted
"""
author : halo2halo
date : 16, Jan, 2020
"""

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

YMD = readline().decode('utf8').rstrip().split('/')
# print(YMD)
MD=int(''.join(YMD[1:]))
print('Heisei' if MD <=430 else 'TBD')
# Judge status: Wrong Answer
print('Yes' if 'abc' in input() else 'No')
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
count=0
d={}
def diff(a,b):
    if a>b:
        return(a-b)
    else:
        return(b-a)
for i in range(0,len(l)):
    if l[i]>2*10**5:
        pass
    else:
        d[i+1]=l[i]

l=list(d.keys())
for i in range(0,len(l)):
    for j in range(i+1,len(l)):
        if diff(i,j)==d[l[j]]+d[l[i]]:
            count+=1
print(count)
# Judge status: Accepted
a, b = input().split()
n = int(a + b)
for i in range(1, n):
    if i**2 == n:
        print('Yes')
        exit()
print('No')
# Judge status: Accepted
from sys import exit

N = int(input())

for i in range(1, 10):
    for j in range(1, 10):
        if N == i * j:
            print('Yes')
            exit()
print('No')
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
ans = 0
for itr, b in enumerate(B):
  rem = b
  for i in range(2):
    dam = min(rem, A[itr + i])
    ans += dam
    rem -= dam
print(ans)
# Judge status: Accepted
N = int(input())

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

ans = int(1e9)
for i in range(N):
    cnt = 0
    while(A[i]%2 != 1):
        A[i] = A[i] // 2
        cnt = cnt + 1
    ans = min(ans, cnt)
    
print(ans)
# Judge status: Accepted
s=int(input())
data=[0]*(10**6+100)
data[s]=1
cnt=1
while True:
    if s%2==0:
        s//=2
    else:
        s=3*s+1
    cnt+=1
    if data[s]==1:
        break
    data[s]=1
print(cnt)
# Judge status: Accepted
A,B,M = map(int,input().split())

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

mi = min(a) + min(b)

for i in range(M):
    x,y,c = map(int,input().split())
    x -= 1
    y -= 1
    mi = min(mi,a[x] + b[y] - c)

print(mi)
# Judge status: Accepted
l =int(input())
s =input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
A = r * g * b
B = 0
gapmax = (l - 3) // 2
for _ in range(gapmax+1):
  for i in range(l-2-2*_):
    c1, c2, c3 = s[i], s[i+1+_],s[i+2+2*_]
    if not (c1 == c2) and not (c1 == c3) and not (c2 ==c3):
      B += 1
      
print(A-B)
# Judge status: Wrong Answer
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [input() for _ in range(n)]

n = int(input())
w = [input() for _ in range(n)]

if (len(w) != len(set(w))):
    print("No")
    exit()

for i in range(1,n-1):
    if w[i][0] != w[i-1][-1]:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
r,g,b=map(str,input().split())
c_l = r+g+b
if(int(c_l)%4==0):
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
# -*- coding:utf-8 -*-
n = int(input())
a = int(input())

if (a % 500) < n:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
W, a, b = map(int, input().split())
L = [b - (a + W), a - (b + W), 0]
print(max(L))
# Judge status: Accepted
import collections
N=int(input())
A=list(map(int,input().split()))
s=sum(A)
Q=int(input())
d=collections.Counter(A)
for i in range(Q):
  B,C=map(int,input().split())
  s += d[B]*C - d[B]*B
  print(s)
  if C in d:
    d[C]+=d[B]
  else:
    d[C]=d[B]
  d[B]=0
# Judge status: Accepted
Sp = input()
Sp_list = list(Sp)
N = len(Sp)
T = input()
n = len(T)

def check(s, t):
  for si, ti in zip(s, t):
    if si == '?':
      continue
    if si != ti:
      return False
  return True

ans = []
for i in range(N-n+1):
  if check(Sp[i:i+n], T):
    ans.append(''.join(Sp_list[:i] + list(T) + Sp_list[i+n:]).replace('?', 'a'))
    
if ans:
  ans.sort()
  print(ans[0])
else:
  print('UNRESTORABLE')
# Judge status: Accepted
_,s=open(0)
print(s[:s.count('R')].count('W'))
# Judge status: Accepted
big_int = 10 ** 9

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

L = [0 for i in range(N)]
for i in range(N):
  L[i] = tuple(map(int, input().split()))

def foo(i):
  t = i
  T = [0 for j in range(M+1)]
  for j in range(N):
    for k in range(M+1):
      T[k] += L[j][k] * (t%2)
    t //= 2
  for k in range(1,M+1):
    if T[k] < X:
      return big_int
  return T[0]
  
ans = big_int

for i in range(2**N):
  ans = min(ans, foo(i))
  
if ans == big_int:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
N=int(input())
alphabets = [chr(ord('a') + x) for x in range(26)]
def dfs(n,s,maxc):
    if len(s)==N:
        print(''.join(s))
        return True
    for i in range(maxc+1):
        if i==maxc:
            maxc+=1
        dfs(n+1,s+[alphabets[i]],maxc)
s=[]
dfs(0,s,0)
# Judge status: Accepted
a, b, c = map(int, input().split())
print(c,'',a,'',b)
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())

mx=max(A)
mn=min(A)

ans=float('inf')
for i in range(mn,mx+1):
    ans=min(ans, sum([(k-i)**2 for k in A]))
print(ans)
# Judge status: Accepted
N = int(input())
num = [1]*(N+1)
num[0] = 0
for a in range(3,len(num),3):
    num[a] = 0
for b in range(5,len(num),5):
    num[b] = 0
t = 0
for a in range(len(num)):
    if num[a] == 1:
        t += a
print(t)
# Judge status: Accepted
#他の数字はそのままで，任意の2数の符号を同時に反転させることが可能．マイナスの数の偶奇で場合分け
n = int(input())
a = list(map(int,input().split()))
aabs = [i if i>=0 else i*(-1) for i in a]
MIN = min(aabs)
ans = 0
mcount = 0

for i in range(n):
  if a[i] < 0:
    mcount += 1
    
if mcount%2 == 0:
  for i in a:
    ans += abs(i)
  print(ans)
else:
  for i in a:
    ans += abs(i)
  print(ans - 2*MIN)
# Judge status: Wrong Answer
n,k=map(int, input().split())
l=[]

x = n - k * int(n/k)
if(x != 0):
  l.append(abs(x-k))
  l.append(abs(l[0]-k))
  print(min(l))
else:
  print(n)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
print(C-(A-B))
# Judge status: Accepted
a, b, c, x, y=map(int,input().split())
 
cnt = 10**9
for m in range(max(x,y)+1):
    price = (2*m*c) + max(0,(x-m))*a + max(0,y-m)*b
    cnt = min(cnt, price)

print(cnt)
# Judge status: Accepted
S = input()
Sa = S.replace("?", "a")
T = input()
nt = len(T)
ans = list()
for i in range(len(S) - nt + 1):
    X = S[i: i + nt]
    for x, t in zip(X, T):
        if x == "?":
            continue
        if x != t:
            break
    else:
        ans.append(Sa[:i] + T + Sa[i + nt:])
ans.sort()
print(ans[0] if ans else "UNRESTORABLE")
# Judge status: Accepted
#conding utf-8
a,b,T=map(int,input().split())
print(int(T/a)*b)
# Judge status: Accepted
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()

from collections import defaultdict
d = defaultdict(int)
ans = 0

for i in range(n):
    ans += d[i-a[i]]
    d[a[i]+i] += 1

print(ans)
# Judge status: Accepted
a,b = map(int, input().split())

if (a*b)%2== 0:
    print("Even")
else:
    print("Odd")
# Judge status: Accepted
N = int(input())
arr = list(map(int, input().split()))
four = 0
two = 0
for i in arr:
    if i % 4 == 0:
        four += 1
    elif i % 2 == 0:
        two += 1
if 2*four+1 == N:
    print('Yes')
    exit()
N -= four * 2
if N <= two:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n,k = map(int,input().split())
h = [int(input()) for i in range(n)]
h.sort()
ans = 10 ** 10

for i in range(n-k+1):
    ans = min(h[i+k-1] - h[i],ans)

print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3

s = str(int(input()))
k = int(input())

if len(s) == 1:
    print(s)
    exit()


if s[0] == "1":
    print(s[1])
else:
    print(s[0])
# 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
input = sys.stdin.readline

X = int(input())

dp = [False] * (X+1)
dp[0]=True

c = [100,101,102,103,104,105]

for i in range(len(c)):
	for j in range(c[i],X+1):
		if(dp[j-c[i]]):
			dp[j]=True
if(dp[X]):print(1)
else:print(0)
# Judge status: Wrong Answer
n,k = map(int,input().split())
a = list(map(int,input().split()))

ni = a.index(1)

ans = ni//(k-1) +(n-ni+1 + ni%(k-1))//(k-1)
print(ans)
# Judge status: Accepted
X, Y = map(int, input().split())

print(X + Y // 2)