peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x, a, b = map(int, input().split())
print("delicious" if a - b >= 0 else "safe" if b - a <= x else "dangerous")
# Judge status: Accepted
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=input()
l=[0]*len(n)
l[0]=int(n[0])
for i in range(1,len(n)):
    l[i]=l[i-1]+int(n[i])
ans=l[-1]
for i in range(len(n)):
    ans=max(ans,l[i]-1+9*(len(n)-1-i))
print(ans)
# Judge status: Wrong Answer
import numpy as np
import itertools

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

ca = []
for _ in range(N):
  ca.append( list(map(int, input().split())))
ca = np.array(ca)
#print(ca)
ans = 1000000

b = [0,1]
for p in list(itertools.product(b, repeat=N)): 
  a = np.array(p)
  to = a@ca
  if min(to[1:]) >= X:
    ans = min(ans, to[0])
#
if ans == 1000000:
  print(-1)
else:
  print(ans)
#
# Judge status: Accepted
S = input()

ans = 0
for i in range(len(S)//2):
    if S[i] != S[-i-1]:
        ans += 1
print(ans)
# Judge status: Accepted
n = input()
print('Yes') if '7' in n else print('No')
# Judge status: Accepted
X = int(input())
import math

tmp = 360*X//math.gcd(360,X)
ans = tmp//X
print(ans)
# Judge status: Accepted
n = int(input())

alp = [chr(i) for i in range(97, 97+26)]

def dfs(i):
    if i == 1:
        return [("a", 1)]
    else:
        ret = []
        for i in dfs(i-1):
            nowstr, nowmax = i
            for j in range(nowmax+1):
                ret.append((nowstr+alp[j], max(j+1,nowmax)))
        return ret

ans = dfs(n)
#print(ans)
for i in range(len(ans)):
    print(ans[i][0])
# Judge status: Accepted
S=input()

print(S[0:3]+"8"+S[4:])
# Judge status: Accepted
n, m = map(int, input().split())

import itertools
print(abs(m*n - ((n-1)*2 + (m-1)*2)))
# Judge status: Accepted
n,k = map(int,input().split())
l = list(map(int,input().split()))
ans = 10**13
for i in range(n-k+1):
    left = l[i]
    right = l[k+i-1]
    if right <= 0:
        time = abs(left)
    elif 0 <= left:
        time = abs(right)
    else:
        time = min(abs(left),abs(right))*2 + max(abs(left),abs(right))
    ans = min(ans,time)
print(ans)
# Judge status: Accepted
import math
N,K=map(int,input().split())
A=list(map(int,input().split()))
ans=1
N-=K
K-=1
if K==0:
    print(ans)
    exit()
else:
    print(ans+math.ceil(N/K))
# Judge status: Wrong Answer
s = input()
if 'hi' not in s:
    print('No')
elif 'hii' in s:
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
n = int(input())
for i in range(2,10):
    if n <= 81 and n % i == 0:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
def main():
  N = int(input())
  A = list(map(int, input().split()))
  if 0 in A:
    print(0)
    return
  prd = 1
  for a in A:
    prd *= a
    if prd > 1000000000000000000:
      print(-1)
      return
  print(prd)

main()
# Judge status: Accepted
N, Y = map(int,input().split())
for i in range(N + 1):
  for j in range(N - i + 1):
    if Y == 1000*i + 5000*j + 10000*(N - j - i):
      print(N - j - i, j, i)
      exit(0)
print(-1,-1,-1)
# Judge status: Accepted
from collections import Counter
N = int(input())
D = Counter([int(a) for a in input().split()])

cnt = 0
for k, v in D.items():
    if k < v:
        cnt += v - k
    elif v < k:
        cnt += v
print(cnt)
# Judge status: Accepted
n = int(input())
B = list(map(int, input().split()))
A = [B[0]]
for i in range(0,len(B)-1):
  A.append(min(B[i],B[i+1]))
A.append(B[n-2])

print(sum(A))
# Judge status: Accepted
N = int(input())
L = sorted([int(x) for x in input().split()])
print('Yes' if sum(L[:-1]) > L[-1] else 'No')
# Judge status: Wrong Answer
def main(S):
    listdreamereraser = ['dreamer','eraser','dream','erase']
    while True:
        for i in listdreamereraser:
            if i == S[-len(i):]:
                S = S[:-len(i)]
                break
        else:
            return False
        if len(S) == 0:
            return True

S = input()
print('YES' if main(S) else 'NO')
# Judge status: Accepted
x,a,b=map(int,input().split())
print('AB'[(x+x>a+b)^(a>b)])
# Judge status: Accepted
n, m, x_capital, y_capital = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
ans = "War"

for i in range(100):
    if x_capital < i and i <= y_capital and max(x) < i and i <= min(y):
        ans = "No War"

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

d = []
A = []
for i in range(K):
    d_pre = int(input())
    A_pre = [int(x) for x in input().split()]
    d.append(d_pre)
    A.extend(A_pre)

A_unique = list(set(A))

ans = 0

for i in range(1, N):
    if i in A_unique:
        pass
    else:
        ans += 1

print(ans)
# Judge status: Wrong Answer
n,m,x,y = map(int,input().split())
xx = list(map(int,input().split()))
yy = list(map(int,input().split()))
if x < y and max(xx) < y and x < min(yy):
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if a >= 0:
  if c>=0 or d>=0:
    print(b*d)
  else:
    print(a*d)
elif b<=0:
  if d<=0:
    print(a*c)
  else:
    if a*c <= b*d:
      print(b*d)
    else:
      print(a*c)
# Judge status: Accepted
#abc120 c
s=input()
r=s.count("1")
b=s.count("0")
ans=min(r,b)*2
print(ans)
# Judge status: Accepted
n=int(input())
a=[int(input()) for _ in range(n)]
buf=1
count=0
if 2 not in a:
    print(-1)
else:
    while count<n:
        a_buf=a[buf-1]
        if a_buf==2:
            print(count+1)
            break
        buf=a_buf
        count+=1
    if count==n:
        print(-1)
# Judge status: Accepted
n, k = map(int, input().split())
H = sorted(list(map(int, input().split())), reverse=True)

print(sum(H[k:]))
# Judge status: Accepted
a, b, c, x, y = [int(i) for i in input().split()]

z = min(x, y)
money = 0
if a + b > c * 2:
  money += z * c * 2
  if x > y:
    if a > c * 2:
      money += (x - z) * c * 2
    else:
      money += (x - z) * a
  else:
    if b > c * 2:
      money += (y - z) * c * 2
    else:
      money += (y - z) * b
else:
  money += x * a + y * b
print(money)
# Judge status: Accepted
def solve():
    d = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for i in range(d)]
    for i in s:
        print(i.index(max(i))+1)
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
print(['No', 'Yes'][a<c<b])
# Judge status: Accepted
inp1 =input().split(" ")
HP,N= int(inp1[0]),int(inp1[1])

inp2 = input().split(" ")

ATK = 0
for x in range(N):
  ATK += int(inp2[x])
  
if HP <= ATK:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
X,Y = map(int,input().split())
ans = 1
Z = X
while Z <= Y//2:
    Z *= 2
    ans += 1
print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
N,M = map(int, input().split())

if N%2==1:
  for i in range(M):
    print(M-i,M+1+i)
else:
  for i in range(M):
    if 4*(i+1)>N:
      print(M-i,M+2+i)
    else:
      print(M-i,M+1+i)
# Judge status: Accepted
n = int(input())

print((int(n**0.5))**2)
# Judge status: Accepted
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

A, B = rl()

from fractions import gcd
from functools import reduce

def get_gcd(A):
    return reduce(gcd, A)

def get_lcm(A):
	def lcm_base(a, b):
		return a*b//gcd(a,b)
	return reduce(lcm_base, A, 1)

print(get_lcm([A, B]))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

MOD = 1000000007
ans = 0
powsum = 0
sumpow = 0
for i in range(N):
    powsum += A[i] 
    sumpow += (A[i]*A[i])

powsum = (powsum*powsum)
ans = (powsum-sumpow)/2.0
print(int(ans)%MOD)
# Judge status: Accepted
#coding:utf-8

N = int(input())

D = []

for i in range(N):
    d1,d2 = map(int,input().split())

    D.append(d1==d2)
    
for i in range(N-2):
    if D[i] and D[i+1] and D[i+2]:
        print("Yes")
        break

    if i == N-3:
        print("No")
# Judge status: Accepted
n=input()
if n[0]=="9" or n[1]=="9":
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import bisect
n = int(input())
colors = [-int(input())]
for _ in range(n-1):
    a = int(input())
    i = bisect.bisect_right(colors, -a)
    if i == len(colors):
        colors.append(-a)
    else:
        colors[i] = -a
print(len(colors))
# Judge status: Wrong Answer
def main():
    N , K = list(map(int,input().split()))
    A = list(map(int,input().split()))
    A.insert(0,0)
    local = 1
    tmp = []
    tmp.append(local)
    for k in range(N):
        local = A[local]
        if local in tmp:
            result = len(tmp) - tmp.index(local)
            break
        else:
            tmp.append(local)
    
    for k in range((K-tmp.index(local)) % result):
        local = A[local]
    print(local)

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
P = [int(s) for s in input().split()]
count = 1
minval = P[0]
for i in [idx+1 for idx in range(N-1)]:
  if minval > P[i]:
    count += 1
    minval = P[i]
print(count)
# Judge status: Wrong Answer
x,y = map(int,input().split())
ans = 0
if x*y < 0:
    ans += 1
elif y < x:
    ans += 2
ans += abs(abs(x)-abs(y))
print(ans)
# Judge status: Accepted
import heapq
import sys
input = sys.stdin.readline

def main():
  n = int(input())
  abs = [tuple(map(int, input().split())) for _ in range(n)]

  pq = []

  for ab in abs:
    a,b = ab[0],ab[1]
    heapq.heappush(pq, tuple([b,a]))

  dl = 0
  tc = 0

  ans = "Yes"

  for i in range(n):
    ba = heapq.heappop(pq)
    dl = ba[0]
    tc += ba[1]
    if dl < tc:
      ans = "No"
      break
  print(ans)
  
if __name__ == "__main__":
  main()
# Judge status: Wrong Answer
s=input()
ans=0
x=0
y=len(s)-1
for i in range(len(s)):
    if s[i]=='A':
        x=i
        break
for i in range(len(s)-1,0,-1):
    if s[-i]=='Z':
        y=i
        break

print(y-x+1)
# Judge status: Wrong Answer
from math import ceil

x = int(input())

n = (x//11)

x = x%10
r = 0
if 0 < x <= 6:
    r = 1
else:
    r = 2

print(2*n+r)
# Judge status: Accepted
n = [input() for _ in range(int(input()))]
m = [input() for _ in range(int(input()))]

l = list(set(n))

print(max(0,max(n.count(l[i]) - m.count(l[i]) for i in range(len(l)))))
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())
r = 'NG'
for x in range(A, B + 1):
    if x % K == 0:
        r = 'OK'
print(r)
# Judge status: Wrong Answer
N = int(input())
L = list(map(int, input().split()))
cnt = 0

for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):
            cnt += (L[k] < L[i] + L[j])
print(cnt)
# Judge status: Accepted
def solve():
    N, M = map(int, input().split())
    X = list(map(int, input().split()))
    X.sort()
    diff = []
    for i in range(M-1):
        diff.append(X[i+1] - X[i])
    
    diff.sort(reverse=True)
    print(X[-1] - X[0] - sum(diff[:min(N,M)-1]))

if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer

def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    # s = input().rstrip()
    a, b, c, k = [int(x) for x in input().rstrip().split(" ")]

    if abs(a - b) > 10^18:
        print("Unfair")
        return

    if k % 2 == 0:
        print(a - b)
    else:
        print(b - a)


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
D = (int(input()) - 25)*(-1)

ans = "Christmas"

for i in range(D):
    ans = ans + ' Eve'
print(ans)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
ret = 1
minp = p[0]
for i in range(1, n):
    if p[i] <= minp:
        ret += 1
    minp = min(minp, p[i])
print(ret)
# Judge status: Accepted
from bisect import bisect_left
N = int(input())
A = list(map(int,input().split()))
A.sort()
n = A.pop()
index = bisect_left(A, n//2)
if index == 0:
    r = A[0]
elif index == N-1:
    r = A[N-2]
else:
    if abs(n//2-A[index]) <= abs(n//2-A[index-1]):
        r = A[index]
    else:
        r = A[index - 1]
print(*[n,r])
# Judge status: Accepted
from collections import Counter, defaultdict
import numpy as np

N, P = map(int, input().split())
A = list(map(int, input().split()))
A = [i % 2 for i in A]

d = defaultdict(int)
d.update(Counter(A).items())

if d[1] == 0:
    if P == 0:
        print(2**N)
    else:
        print(0)
else:
    print(2**(N-1))
# Judge status: Accepted
a = input()
if(a[-1] == 's'):
  print(a+'es')
else:
  print(a+'s')
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))
marks = [0]*N
for i in range(N):
  if P[i]==i+1:
    marks[i]=1
b = 0
check = 0
for i in range(1, N):
  if marks[i-1]==1 and marks[i]==1:
    marks[i]=0
print(sum(marks))
# Judge status: Wrong Answer
from math import gcd
from functools import reduce

s = 0
n = int(input())
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            s = s + int(reduce(gcd, (i, j, k)))
print(s)
# Judge status: Wrong Answer
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    a,b,c = I2()
    print(0 if a%2 == 0 or b%2 == 0 or c%2 == 0 else min(a*b,b*c))
# Judge status: Accepted
n = int(input())
L = [0] * (n+1)
L[0] = 2
L[1] = 1
for i in range(2,n+1):
    L[i] = L[i-1] + L[i-2]

print(L[-1])
# Judge status: Accepted
l = list(map(int,input()))
#print(l)
if l[0] <l[1]:
  a= str(l[0]+1)
  print(a*3)
elif l[0]>l[1]:
  print(str(l[0])*3)
else:
  if l[1] >= l[2]:
    print(str(l[0])*3)
  else:
    b= str(l[0]+1)
    print(b*3)
# Judge status: Wrong Answer
N,A,B = map(int,input().split())

count = 0
for i in range(1,N+1):
    tot = 0
    num = i
    for j in range(4):
        tot = tot + num%10
        num = int(num/10)
    if tot >= A and tot <= B:
        count += i

print(count)
# Judge status: Accepted
s=input()
if s=="abc" or s=="acb" or s=="bac" or s=="bca" or s=="cab" or s=="cba":
    print("Yes")
else:
    print("No")
# Judge status: Accepted
if __name__=="__main__":
    s,t=input().split()
    print(t+s)
# Judge status: Accepted
import math
x = int(input())
print(360//math.gcd(x, 360))
# Judge status: Accepted
n, k = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(n)]
ab.sort()

for a, b in ab:
    k -= b
    if k <= 0:
        print(a)
        exit()
# Judge status: Accepted
N, C, K = map(int, input().split())
p = 0
bus = 0
time = 0
b = sorted([int(input()) for i in range(N)])
for i in range(N):
    a = b[i]
    if a - time > K or p == C:
        p = 0
    if p == 0:
        time = a
        bus += 1
    p += 1
print(bus)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==k:
    print(1)
    exit()
i=n-k
ans=1
while i>0:
    i=i-k+1
    ans+=1
print(ans)
# Judge status: Wrong Answer
from statistics import median

N=int(input())
X=list(map(int,input().split()))
Y=[0]*N
for i in range(N):
  Y[i]=X[i]
X.sort()
for i in range(N):
  if X.index(Y[i])<=N//2 :
    print(Y[N//2])
  else :
    print(Y[N//2-1])
# Judge status: Accepted
import sys
# import numpy as np

def IL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

N, W = IL()
v_list = [0] * N
w_list = [0] * N
v = 0
w_total = 0
for i in range(N):
	w_list[i], v_list[i] = IL()
# dp = np.zeros((N+1, W+1))
dp = [[0] * (W+1) for _ in range(N+1)]
for i in range(N):
	for j in range(W+1):
		if j >= w_list[i]:
			dp[i+1][j] = max(dp[i][j-w_list[i]] + v_list[i], dp[i][j])
		else:
			dp[i+1][j] = dp[i][j]

print(dp[N][W])
# Judge status: Accepted
import heapq
import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
a = list(map(int,input().split()))
cal = []
heapq.heapify(cal)
minus = 0
zero = False
for i in a:
    if i == 0:
        zero = True
    if i < 0:
        minus += 1
    heapq.heappush(cal,abs(i))

if minus % 2 == 0 or zero:
    print(sum(cal))
else:
    adjust = heapq.heappop(cal)
    print(sum(cal)-adjust)
# Judge status: Accepted
import heapq
def main():
    n,m=map(int, input().split()) 
    a = list(map(lambda x: int(x)*(-1), input().split())) 
    heapq.heapify(a)

    for i in range(m):
        tmp_min = heapq.heappop(a)
        heapq.heappush(a, -1*(-tmp_min//2))
    print(-sum(a))

if __name__ == '__main__':
    main()
# Judge status: Accepted
a=int(input())
print(a*800-200*(a//15))
# Judge status: Wrong Answer
x,y=map(int,input().split())
if x==y:
  print(-1)
else:
  for i in range(1,1000000):
    s=x*i
    if s>10**18:
      print(-1)
      exit()
    if s%y!=0:
      print(s)
      exit()
# Judge status: Wrong Answer
import heapq

n, m = map(int, input().split())
num = sorted([list(map(int, input().split())) for i in range(n)], key = lambda x: x[0])

s = []
heapq.heapify(s)

for i in range(1, m + 1):
  for j in num:
    if(j[0] <= i):
       heapq.heappush(s, j[1])
    else:
      break

print(sum(s))
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    N, A, B = map(int, input().split())
    tmp = B - A
    if tmp&1:
        ans = min(A - 1, N - B)
        ans += (tmp + 1) // 2
    else:
        ans = tmp // 2
    
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
S=input()
start=1
end=0
ans=[]
for _ in range(len(S)):
    for i in range(len(S))[end:]:
        if S[i] in {"A","C","G","T"}:
            start=i
            break
    for j in range(len(S))[start:len(S)]:
        end=len(S)
        if S[j] not in {"A","C","G","T"}:
            end=j
            break
    ans.append(end-start)
if max(ans)<0:print(1)
else:print(max(ans))
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, x = map(int, input().split())
    A = sorted(list(map(int, input().split())))

    res = 0
    for i in range(n):
        if i == n - 1 and A[i] < x:
            continue

        if A[i] <= x:
            x -= A[i]
            res += 1

    print(res)


if __name__ == '__main__':
    resolve()
# Judge status: Accepted
N = int(input())

ans = int(800*N - 200*int((N//15)))
print(ans)
# Judge status: Accepted

INF = 10e5
n = int(input())
h = list(map(int,input().split()))
dp = [INF for _ in range(n)]

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,n):
    cost1 = abs(h[i]-h[i-1])
    cost2 = abs(h[i]-h[i-2])
    dp[i] = min(dp[i-1] + cost1, dp[i-2] + cost2)

print(dp[n-1])
# Judge status: Accepted
N = int(input())

anslist=[]

for i in range(1,N):
    a = str(i)
    b = str(N-i)
    asum = sum(list(map(int,a)))
    bsum = sum(list(map(int,b)))
    SUM = asum + bsum
    anslist.append(SUM)

print(min(anslist))
# Judge status: Accepted
N = int(input())
S = input()
from collections import Counter
c = Counter(S)
p = 10**9 + 7
result = 1
for v in c.values():
    result *= (v+1)
    result %= p
print((result - 1) % p)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

N = int(input())
A  =  [int(i) for i in input().split()]
ans = 0
for i in range(1,N-1):
    k = 0
    while(k+i<N):
        #print(A[k], A[k+i],i)
        if(A[k]+A[k+i]) == i:
            ans += 1
        k+=1
print(ans)
# Judge status: Accepted
N = int(input())
 
ans = 0
f = 2
while True:
  if N%f==0:
    c = 0
    while N%f==0:
      N /= f
      c += 1
    n = 1
    while n*(n+1)//2<=c:
      n += 1
    ans += n-1
  if f*f>N:
    break
  f += 1
if N>1:
  ans += 1
print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input()

count = 0
for i in range(n-2):
	lis = []
	lis.append(s[i])
	for j in range(i+1,n-1):
		if not s[j] in lis :
			lis.append(s[j])
			for k in range(j+1,n):
				if not s[k] in lis :
					count += 1

print(count)
# Judge status: Wrong Answer
N=int(input())
A_list=list(map(int, input().split()))
A_list = sorted(A_list, reverse=True)
total = 0
for i in range((N+1)//2):
  total = total + A_list[i*2]
print(total)
# Judge status: Wrong Answer
s = list(map(int, input().split()))
t = [input() for i in range(s[0])]
for i in range(0, s[0] - 1):
    if t[i] > t[i + 1]:
        u = t[i]
        t[i] = t[i + 1]
        t[i + 1] = u
v = t[0]
for i in range(1, s[0]):
    v = v + t[i]
print(v)
# Judge status: Accepted
N, M = map(int, input().split())
y_if = {1}
num = [1] * N
for i in range(M):
    x, y = map(int, input().split())
    num[x - 1] -= 1
    num[y - 1] += 1
    if x in y_if:
        if num[x - 1] == 0:
            y_if.remove(x)
        y_if.add(y)
print(len(y_if))
# Judge status: Accepted
# coding: utf-8
N = int(input())

lst = [i+1 for i in range(N)]
i = 0

while (i < N):
    if lst[i] % 3 == 0 and lst[i] % 5 == 0:
        lst[i] = 0
    elif lst[i] % 3 == 0:
        lst[i] = 0
    elif lst[i] % 5 == 0:
        lst[i] = 0
    i = i + 1;

print(sum(lst))
# Judge status: Wrong Answer
import sys
from bisect import bisect_left,bisect_right,insort
input = sys.stdin.readline

def main():
    n=int(input())
    x=[int(input()) for _ in range(5)]
    print(int(n//min(x)+5))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x, k, d = map(int, input().split())


if x > k * d:
    print(x - k * d)
elif x == k * d:
    print(0)
else:
    q = x // d
    mod = x % d
    k -= q
    x -= q * d

    r = abs(mod - d)
    if k == 0:
        print(abs(x))
    elif k == 1:
        print(abs(x-d))
    elif k % 2 == 0:
        print(mod)
    else:
        print(r)
# Judge status: Wrong Answer
n = int(input())

if 1 <= n and n <= 100 :
    if type(n/2) == int :
        page = int(n/2)
    elif type(n/2) == float :
        page = int(n/2) + 1
    print(page)
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

p = [-1] * N
p[0] = 0
flag = 0
now = 1
i = 0

while flag == 0:
    i += 1
    now = A[now - 1]
    if p[now - 1] != -1:
        flag = 1
    else:
        p[now - 1] = i
    if i == K:
        flag = 2
if flag == 2:
    print(now)

else:
    r = i - p[now - 1]
    e = p[now - 1]

    count = K - e
    pi = count % r

    for i in range(pi):
        now = A[now - 1]

    print(now)
# Judge status: Accepted
n,k = map(int, input().split())

if n % k == 0:
  print(0)
else:
  print(1)
# Judge status: Accepted
s=input()
lis=[]
for i in range(len(s)):
    if s[i]=='0': lis.append('0')
    elif s[i]=='1': lis.append('1')
    elif s[i]=='B' and len(lis)==0: continue
    else: lis=lis[:-1]
print(''.join(lis))
# Judge status: Accepted
S = input()
A = [S[0]]
a = ""
for s in S[1:]:
    a += s
    if a != A[-1]:
        A.append(a)
        a = ""
print(len(A))
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
cnt = 0
for a in A:
  if a%4==0: cnt += 1
  elif a%2==0: cnt += 0.5
cnt = int(cnt)

print("Yes" if n//2 <= cnt else "No")
# Judge status: Accepted
H, W = map(int, input().split())

if H == 1 or W == 1:
    print(1)
else:
    q,r = divmod(H*W, 2)
    print(q+r)
# Judge status: Accepted


s = input()
N = [int(c) for c in s]
ans = 0
for i in range(len(N)):
    ans += N[i]
if ans%9==0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a>k:print(':(')
else:print('Yay!')
# Judge status: Wrong Answer
x=int(input())
if(x<=400 and x>=599):
  print("8")
elif(x<=600 and x>=799):
  print("7")
elif(x<=800 and x>=999):
  print("6")
elif(x<=1000 and x>=1199):
  print("5")
elif(x<=1200 and x>=1399):
  print("4")
elif(x<=1400 and x>=1599):
  print("3")
elif(x<=1600 and x>=1799):
  print("2")
elif(x<=1800 and x>=1999):
  print("1")
# Judge status: Wrong Answer
import math

X = int(input())

if (360 % X == 0):
    print(int(360 / X))
else:
    print((360 * X) // math.gcd(360, X))
# Judge status: Accepted
H = int(input())
k = 1
for i in range(1000000):
    if H != 1:
        H = H//2
        k = k + 1
    else:
        break
print(2**k - 1)