peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n, m = map(int, input().split())
step = [True] * n
r = [0,1]
MOD = 10**9 + 7
for _ in range(m):
    broken = int(input())
    step[broken - 1] = False
for i, tf in enumerate(step):
    if tf:
        r += [(r[i] + r[i+1]) % MOD]
    else:
        r += [0]
print(r[-1])
# Judge status: Accepted
from itertools import accumulate
n = int(input())
a = list(map(int, input().split()))
# 0が混ざってる場合に対応して、１ずつ足しておく
a = [i+1 for i in a]

# 10**5だと99999がコーナーケースになる
l = [0] * 10 ** 6
# いもす法
for i in a:
    l[i-1] += 1
    l[i+2] -= 1

b = accumulate(l)
print(max(list(b)))
# Judge status: Accepted
# https://atcoder.jp/contests/abc043/tasks/abc043_b
s = list(input())
result = []
for c in s:
    if c == 'B':
        if len(result) > 0:
            result.pop()
    else:
        result.append(c)

print(''.join(result))
# Judge status: Wrong Answer
#!/usr/bin/env python3

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

# 主処理
result = 1
isSkip = False
for i in range(1, n-1):
    if isSkip:
        isSkip = False
        continue
    center = a[i]
    left = a[i-1]
    right = a[i+1]
    if ((center < left and center < right) or (left < center and right < center)):
        result += 1
        isSkip = True

# 出力
print(result)
# Judge status: Wrong Answer
#!/usr/bin/env python3

x = int(input())

tmp = 0
if x % 11 < 7:
    tmp = 1
else:
    tmp = 2
print(x//11 * 2 + tmp)
# Judge status: Accepted
import math

n,k = map(int,input().split())
a = [int(i) for i in input().split()]

a.sort()
r = a[n-1]
l = 0


def calc(t,x):
    return math.ceil(t / x) - 1


while r - l > 1:
    mid = (r+l)//2
    count = 0
    for i in a:
        count += calc(i,mid)
    if count > k:
        l = mid
    else:
        r = mid

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

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

if A[N-1] - A[0] <= K / 2:
    res = A[N-1] - A[0]
else:
    res = K - max(dist)

print(res)
# Judge status: Wrong Answer
N = int(input())
a = [int(input()) for _ in range(N)]

l = 1
p = a[0] - 1
while l < int(1e5):
    l += 1
    if a[p] == 2:
        print(l)
        break
    else:
        p = a[p] - 1
else:
    print(-1)
# Judge status: Wrong Answer
n=int(input())
c=1
x=100
while x<n:
    x=x*(1.01)
    x=int(x)
    c+=1
print(c)
# Judge status: Accepted
n=int(input())
p=list(map(int,input().split()))

l=list(range(1,n+1))
k=0
for i in range(n):
    if p[i]!=l[i]:
        k+=1
if k==0 or k==2:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n,q=map(int,input().split())
s=input()
cnt=[]
for i in range(n-1):
    if s[i:i+1]=="AC":
      cnt.append(1)
    else:
      cnt.append(0)

for i in range(q):
    li,ri=map(int,input().split())
#    print(s[li-1:ri].count("AC"))
    print(sum(cnt[li-1:ri-1]))
# Judge status: Accepted
a,b,c,d=map(int,input().split())
list1=[a*c,a*d,b*c,b*d]
if (b<0 and c>0) or (a>0 and d<0):
  ans=max(list1)
else:
  list1.append(0)
  ans=max(list1)
print(ans)
# Judge status: Wrong Answer
import sys
n = int(input())
for i in range(n,0,-1):
    if ((i**(1/2))%1 == 0) or ((i **(1/3))%1 == 0) or  ((i **(1/5))%1 == 0) or ((i **(1/7))%1 == 0) or ((i **(1/9))%1 == 0):
        print(i)
        sys.exit()
print(1)
# Judge status: Accepted
import fractions
a,b,c=map(int,input().split())
print("YES" if c%fractions.gcd(a,b)==0 else "NO")
# Judge status: Accepted
s=input()
t=input()
if s[0]==t[2] and s[1]==t[1] and s[2]==t[0]:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
money=1000
stock=0
for i in range(n-1):
  if A[i]<A[i+1]:
    stock=money//A[i]
    money-=stock*A[i]
    money+=stock*A[i+1]
print(money)
# Judge status: Accepted
# -*- coding: <encoding name> -*-

a, b, c = map(int, input().split())
print('Yes' if a <= c <= b else 'No')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

cnt_2 = 0
cnt_4 = 0
for a in A:
  if a % 4 == 0:
    cnt_4 += 1
  elif a % 2 == 0:
    cnt_2 += 1

cnt_1 = N - cnt_2 - cnt_4
    
if cnt_2 == 0 and cnt_1 <= cnt_4 + 1:
  print('Yes')
elif cnt_1 <= cnt_4:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n = int(input())
aList = []
bList = []
for i in range(n):
  a, b = map(int, input().split())
  aList.append(a)
  bList.append(b)

aList.sort()
bList.sort()

if n % 2 == 0:
  middle = n // 2
  print(bList[middle] + bList[middle-1] - aList[middle] - aList[middle-1] + 1)
else:
  middle = (n-1) // 2
  print(bList[middle] - aList[middle] + 1)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

for i in range(max(a, b, c, d)):
  if b >= c:
    print('Yes')
    exit()
  else:
    c -= b
    if a <= d:
      print('No')
      exit()
    else:
      a -= d
      continue
# 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
n = int(input())
l = list(map(int,input().split()))
count = 0
if n < 3:
  pass
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        a,b,c = l[i],l[j],l[k]
        if abs(a-c)<b<a+c and a!=b and b!=c and c!=a:
          count += 1
print(count)
# Judge status: Accepted
# n=int(input())
x, y, z = map(int, input().split())
# l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
ans = x // (y + z)
if x - ans*(y + z) < z:
    ans = max(0, ans-1)
print(ans)
# Judge status: Accepted
"""
author : halo2halo
date : 31, Jan, 2020
"""

import sys
import itertools

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B = map(int, readline().decode('utf8').split())
if A == 1:
    A = 100
if B == 1:
    B = 100

print('Alice' if A > B else 'Draw' if A == B else 'Bob')
# Judge status: Accepted
W, H, N = list(map(int, input().split()))
A = []
for _ in range(N):
  A.append(list(map(int, input().split())))
  
xmax, xmin, ymax, ymin = W, 0, H, 0
for a in A:
  if a[2] == 1:
    xmin = max(xmin, a[0])
  if a[2] == 2:
    xmax = min(xmax, a[0])
  if a[2] == 3:
    ymin = max(ymin, a[1])
  if a[2] == 4:
    ymax = min(ymax, a[1])
    
S = (xmax-xmin) * (ymax-ymin)
if S < 0 or xmin > xmax or ymin > ymax:
  S = 0
print(S)
# Judge status: Wrong Answer
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

print(N * X + Y * max(N - K,0))
# Judge status: Accepted
n, a, b = map(int, input().split())
mod = pow(10, 9) + 7
 
def comb(N, x):
    numerator = 1
    for i in range(N-x+1, N+1):
        numerator = numerator * i % mod
    denominator = 1
    for j in range(1, x+1):
        denominator = denominator * j % mod
    d = pow(denominator, mod-2, mod)
    return numerator * d
 
a = comb(n, a)
b = comb(n, b)
 
print((pow(2, n, mod) -1 -a -b) % mod)
# Judge status: Wrong Answer
N = int(input())

stations = [tuple(map(int, input().split(' '))) for _ in range(N - 1)]

for i in range(N - 1):
    t = 0
    for j in range(i, N - 1):
        c, s, f = stations[j]
        t = max(t, s)
        t += t % f
        t += c
    print(t)
print(0)
# Judge status: Accepted
x=int(input())
if x in [7,5,3]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import defaultdict

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


for i in range(n,pow(10,5)):
    a=set()
    v=str(i)
    for j in range(len(v)):
        a.add(int(v[j]))

    if a.isdisjoint(d):
        print(i)
        exit()
# Judge status: Accepted
n,d=map(int,input().split())
ans=0
for i in range(n):
    x,y=map(int,input().split())
    if x**2 + y**2 <= d**2:
        ans+=1
print(ans)
# Judge status: Accepted
a, b, c, k = map(int, input().split())

xa = min(a, k)
k -= xa
xb = min(b, k)
k -= xb
xc = k
ans = xa - xc

print(ans)
# Judge status: Accepted
s = list(input())
s1 = [0]*len(s)
s0 = [1]*len(s)
for i in range(1,len(s), 2):
  s1[i] += 1
  s0[i] -= 1
n1 = 0
n0 = 0
for i in range(len(s)):
  if s1[i] != int(s[i]):
    n1 += 1
  elif s0[i] != int(s[i]):
    n0 += 1
print(min(n1, n0))
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    N,M = map(int,input().split())

    vol = [1 for i in range(N)]
    prob = [False for _ in range(N)]
    prob[0] = True
    
    for _ in range(M):
        a,b = map(int,input().split())
        if prob[a-1]:
            prob[b-1] = True
        vol[a-1] -= 1
        vol[b-1] += 1
        if vol[a-1] == 0:
            prob[a-1] = False

    print(prob.count(True))

if __name__ == "__main__":
    main()
# Judge status: Accepted
a,b=map(int,input().replace('.','').split())
print(a*b//100)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = list(map(int, input().split()))
mini = n / (4 * m)
a.sort(reverse = True)
if a[m-1] < mini:
	print('No')
else:
	print('Yes')
# Judge status: Wrong Answer

a,b,c,x,y = map(int,input().split())
z = 0
p = 0

if a + b < c * 2:
    p = a * x + b * y
else:
    if x > y:
        x -= y
        z = y * 2
        y = 0
        if a > c * 2:
            z += x * 2
            x = 0

    else:
        y -= x
        z = x * 2
        x = 0
        if b > c * 2:
            z += 0

print(x * a + y * b + z * c)
# Judge status: Wrong Answer
a,b=list(map(int,input().split()))
if a>b:
  print("Alice")
elif a==b:
  print("Draw")
else:
  print("Bob")
# Judge status: Wrong Answer
sx, sy, tx, ty = map(int,input().split())

dx = (tx - sx)
dy = (ty - sy)

s = 'U' * dy + 'R' * dx

s += 'D' * dy + 'L' * dx

s += 'L' + 'U' * (dy+1) + 'R' * (dx+1)

s += 'R' + 'D' * (dy+1) + 'L' * (dx+1)

print(s)
# Judge status: Accepted
N = int(input())

cnt = 0
for i in range(1, N):
  j =  (N - 1)//i
  cnt += j

print(cnt)
# Judge status: Wrong Answer
## 20
n = int(input())
a = [0 for i in range(10**5)]

for i in range(n):
    num = (int(input())-1)%10**4
    a[num] += 1
    a[num] %= 2
    
    
print(a.count(1))
# Judge status: Accepted
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())
s = input()
count = 0
max_num = 0
for _ in s:
    if _=="I":
        count+=1
    else:
        count-=1
    if max_num<count:
        max_num=count
print(max_num)
# Judge status: Accepted
def main():
    s = input()
    MOD = 2019
    r = [0]*MOD
    r[0] = 1
    z = 0
    t = 0
    for i in reversed(s):
        z = int(i) * pow(10,t,MOD) + z
        z %= MOD
        r[z] += 1
        t += 1
    print(sum(i*(i-1)//2 for i in r))


if __name__ == '__main__':
    main()
# Judge status: Accepted
from collections import Counter

n, m = map(int, input().split())
l = [list(map(int, input().split()))[1:] for _ in range(n)]
#1次元に変換
r = []
for row in l:
  for i in row:
    r.append(i)
c = dict(Counter(r))
ans = 0
for value in c.values():
  if value == n:
    ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
nos = list(map(int, input().split()))
count = 1
min = nos[0]
for j in range(1,N):
  if nos[j] <= min:
    count += 1
    min = nos[j]
print(count)
# Judge status: Wrong Answer
n,m=map(int,input().split())
p=[tuple(map(int,input().split())) for i in range(n)]
for i in range(m):
  c,d=map(int,input().split())
  ans=10**10
  for j,k in p:
    ans=min(ans,abs(c-j)+abs(d-k))
  print(ans)
# Judge status: Accepted
n = int(input())

dp = [[0] * 10 for _ in range(10)]
for i in range(1, n + 1):
    s = str(i)
    x = int(s[0])
    y = int(s[-1])
    dp[x][y] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += dp[i][j] * dp[j][i]

print(ans)
# Judge status: Accepted
n = int(input())

a = n//500
b = (n%500)//5

print(1000*a+5*b)
# Judge status: Wrong Answer
h, n = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
attack = sum(A[:2])
print("Yes") if h <= attack else print("No")
# Judge status: Accepted
n, *a = map(int, open(0).read().split())

ans = [0] * n
for i in range(n-1, -1, -1):
    cnt = 0
    for j in range(i+1, n+1, i+1): cnt += ans[j-1]
    if cnt%2!=a[i]: ans[i] = 1

print(sum(ans))
for i in range(n):
    if ans[i]: print(i+1)
# Judge status: Wrong Answer
N, M = map(int, input().split())
PYlist = [tuple(map(int, input().split())) for _ in range(M)]
from copy import deepcopy
PYsorted = sorted(deepcopy(PYlist), key=lambda x: x[1])


def zero_ume(num: int) -> str:
    return (6 - len(str(num))) * "0" + str(num)


now_ken = 0
ans_dict = {}
for p, y in PYsorted:
    if p != now_ken:
        now_num = 1
        now_ken = p
    else:
        now_num += 1
    ans_dict[(p, y)] = zero_ume(p) + zero_ume(now_num)

for py in PYlist:
    print(ans_dict[py])
# Judge status: Accepted
a,b,c,k=map(int,input().split())
if k<=a:
    print(k)
elif k<=(a+b):
    print(a)
else:
    print(a-(k-(a+b)))
# Judge status: Accepted
W, H, x, y = map(int, input().split())
if x == W/2 and y == H/2:
  ans = 1
else:
  ans = 0
print(W * H / 2, ans)
# Judge status: Accepted
import math
N = int(input())
x = []
y = []

for i in range(N):
    xi, yi = map(int, input().split(" "))
    x.append(xi)
    y.append(yi)


route = 0
for i in range(N):
    for j in range(i, N):
        route += math.sqrt((x[i]-x[j])**2 + (y[i]-y[j])**2)

# print(route * math.factorial(N-1) * 2 / math.factorial(N))
print(route * 2 / N)
# Judge status: Wrong Answer
n,k=map(int,input().split())
ans=0
for i in range(k,n+2):
  mi=i*(i-1)//2
  ma=(2*n-i+1)*i//2
  c=(ma-mi+1)%(10**9+7)
  ans+=c
print(ans)
# Judge status: Accepted
from collections import deque
n,m = map(int, input().split())
g = [[] for _ in range(n)]

for _ in range(m):
  a,b = map(int, input().split())
  a,b = a-1, b-1
  g[a].append(b)
  g[b].append(a)
stack = deque([0])
dist = [-1]*n
dist[0] = 0

while stack:
  v = stack.popleft()
  for nv in g[v]:
    if dist[nv] == -1:
      dist[nv] = v+1
      stack.append(nv)

print("Yes")
print(*dist[1:], sep= "\n")
# Judge status: Wrong Answer
import collections

N = int(input())
a = list(map(int,input().split()))
ans = 0

aa = collections.Counter(a).most_common()
print(aa)

for i,j in aa:
    if i > j:
        ans += j
    if i < j:
        ans += j-i
    
print(ans)
# Judge status: Accepted
import math

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

left = [0] * (N+1)
for i in range(1, N+1):
    left[i] = math.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] = math.gcd(right[i+1], A[i])
    
output = 0
for i in range(N):
    output = max(output, math.gcd(left[i], right[i+1]))
    
print(output)
# Judge status: Wrong Answer
b = [[int(e) for e in input().split()] for _ in range(3)]
N = int(input())

for _ in range(N):
  x = int(input())

  for i in range(3):
    for j in range(3):
      if b[i][j] == x:
        b[i][j] = -1

ans = False
for i in range(3):
  if b[i][:] == [-1] * 3 or b[:][i] == [-1] * 3:
    ans = True

if [b[0][0], b[1][1], b[2][2]] == [-1] * 3 or [b[0][2], b[1][1], b[2][0]] == [-1] * 3:
  ans = True

if ans:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
# -*- coding: utf-8 -*-


def main():
    from fractions import gcd

    n = int(input())
    a = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    lcm = 1
    ans = 0

    # 同じコードがPython3だとギリギリ通るが、PyPy3だとTLE
    for ai in a:
        lcm = lcm * ai // gcd(lcm, ai)

    for ai in a:
        ans += lcm // ai

    print(ans % mod)


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

if a == b:
    print("Draw")
elif a == 1 and b != 1:
            print("Alice")
elif a != 1 and b == 1:
            print("Bob")
elif a < b:
            print("Alice")
else:
            print("Bob")
# Judge status: Accepted
import sys
si = sys.stdin.readline


def main():
    [n, k] = [int(e) for e in si().split()]
    l = [int(e) for e in si().split()]
    l.sort()
    s = 0
    for i in range(k):
        s += l[i]

    print(s)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))
print((N+K-3)//(K-1))
# Judge status: Accepted
n,m,k = map(int,input().split())
ok = False
for i in range(n+1):
    for j in range(m+1):
        if i*(m-j)+(n-i)*j == k:
            ok = True
            break
if ok:print('Yes')
else:print('No')
# Judge status: Accepted
A, B = map(int, input().split())
if A > B:
    A, B = B, A
A = str(A)
print(A * B)
# Judge status: Wrong Answer
def resolve():
    n = input()
    ln = list()
    for i in range(10):
        ln.append(0)
    
    for c in n:
        num = int(c)
        ln[num] += 1
    
    ans = ""
    for i in range(10):
        if ln[i] >= 3:
            ans = "Yes"
            break
    if ans == "":
        print("No")
    else:
        print("Yes")
resolve()
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
m = Y[(N // 2) - 1]
M = Y[N // 2]
for x in X:
  if m >= x:
    print(M)
  elif M <= x:
    print(m)
# Judge status: Accepted
N = int(input())
cnt = [0] * (10 ** 4 + 1)
for x in range(1, 3333):
    for y in range(1, 3333):
        for z in range(1, 3333):
            check = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if check > 10000:
                break
            else:
                cnt[check - 1] += 1
for i in range(N):
    print(cnt[i])
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

# N = 10 ** 5 * 2
# K = N
# A = [0] * (N+1)

cnt = 0
while (A[0] < N or A[-1] < N) and cnt < K:
    cnt += 1
    next_A = [0] * (N+1)
    for j in range(N):
        tmp = A[j]
        next_A[max(j-tmp, 0)] += 1
        next_A[min(N, tmp+1+j)] -= 1
    for j in range(N):
        next_A[j+1] += next_A[j]
    next_A.pop()
    A = next_A
print(" ".join([str(i) for i in A]))
# Judge status: Wrong Answer
N=int(input())
d=[int(s) for s in input().split(" ")]

d.sort()

if (N//2)%2==0:
    print(0)
else:
    K=d[(N//2)]-d[(N//2)-1]
    if d[N//2]==d[(N//2)-2]:
        K=0
    elif K==0:
        K=1
    print(K)
# Judge status: Accepted
A = list(map(int, input().split()))

A.sort()
if A[0] == 5:
    if A[1] == 5:
        if A[2] == 7:
            print("YES")
            exit()
print("NO")
# Judge status: Wrong Answer
s = [input() for i in range(2)] 
li = list(map(int, s[1].split()))
s0 = int(s[0])
f1 = 0
for i in li:
    if i == 1:
        f1 += i
for j in range(1,s0+1):
    if s0-f1*j > 0:
        print(f1)
    else:
        print(0)
# Judge status: Accepted
n, k = map(int, input().split())
R, S, P = map(int, input().split())
t = input()
point = {'r':P, 's':R, 'p':S}

ans = 0
for i in range(k):
    j = i
    m = 0
    pre_t = 'na'
    counted = False
    while j < n:
        if not (t[j] == pre_t and counted):
            ans += point[t[j]]
            counted = True
        else:
            counted = False
        pre_t = t[j]
        m += 1
        j = i + m * k
print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for i in range(N):
  if S[i] == "a" and a + b < A + B:
    print("Yes")
    a += 1
  elif S[i] == "b" and a + b < A + B and b < B:
    print("Yes")
    b += 1
  else:
    print("No")
# Judge status: Accepted
import math
A,B,H,M = map(int,input().split())
zisin = 360/12 * H + 30/60 * M
hunsin = 360/60 * M 
kakusa = min(abs(zisin - hunsin),abs(360-zisin+hunsin))*math.pi/180
ans_2 = A**2 + B**2 - 2*A*B*math.cos(kakusa)
print(ans_2**0.5)
# Judge status: Wrong Answer
while True:
    num1,num2 = input().split()
    if int(num1) < 1 or int(num1) > 100 or int(num2) < 1 or int(num2) > 100:
         break
    if int(num1) < int(num2):
         print("safe")
         break
    else:
         print('unsafe')
         break
# Judge status: Wrong Answer
x=int(input())
if x==7 or 5 or 3:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
d = int(input())

if d == 25:
    ans = 'Christmas'
elif d == 24:
    ans = 'Christmas Eve'
elif d == 23:
    ans = 'Christmas Eve Eve'
else:
    ans = 'Christmas Eve Eve Eve'

print(ans)
# Judge status: Wrong Answer

def solve():
    A = [0]*N
    A[-1] = 10**6
    A[0] = 10**6
    for i in range(N-2,0,-1):
        A[i] = min(A[i+1], B[i-1])
#        print(i)
    A[-1] = B[-1]
    A[0] = B[0]
#    print(A)
    print(sum(A))

if __name__ == "__main__":
    N = int(input())
    B = list(map(int, input().split()))
    solve()
# Judge status: Wrong Answer
s=int(input())

n = s - 5

dp = [0] * 2001

dp[1]=2
dp[2]=3
dp[3]=4

for i in range(4, 2001):
    dp[i] = dp[i-1] + dp[i-3]

if s < 3:
    print(0)
elif s == 3:
    print(1)
elif s == 4:
    print(1)
elif s == 5:
    print(1)
else:
    print(dp[n])
# Judge status: Accepted
n = int(input())
s = input()

r = len([i for i in range(n) if s[i] == "R"])
g = len([i for i in range(n) if s[i] == "G"])
b = len([i for i in range(n) if s[i] == "B"])

count = 0
for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            count += 1

print(r * g * b - count)
# Judge status: Wrong Answer
n,m=map(int,input().split())
c=0
v=list(map(int,input().split()))
s=sum(v)
v.sort(reverse=True)
val=s/(m*4)
if(v[m-1]>=val):
	print("YES")
else:
	print("NO")
# Judge status: Accepted
n,k = map(int,input().split())
s = input()

score=0
for i in range(n-1):
    if s[i] == s[i+1]:
        score+=1

ans=min(score+2*k,n-1)
print(ans)
# Judge status: Accepted
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]
A.insert(0,[0,0,0])
for i in range(len(A)-1):
    dt = A[i+1][0]-A[i][0]
    dist = abs(A[i+1][1]-A[i][1])+abs(A[i+1][2]-A[i][2])
    if dist>dt:
        print("No")
        quit()
    if dist%2!=dt%2:
        print("No")
        quit()
print("Yes")
# Judge status: Accepted
# -*- coding: utf-8 -*-

def main():

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

    D = 0
    ans = 0

    if D <= X:
        ans += 1

    for i in L:
        D += i
        if D <= X:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n=int(input())
lo=2
li=1
cou=0
import sys
if n==1:
    print(1)
if n==2:
    print(3)
    sys.exit()

for  i in range(n-1):

    cou=lo+li
    lo=li
    li=cou
   

print(cou)
# Judge status: Wrong Answer
import math
n = int(input())

res = 0
if n <= 1:
	print(res)
else:
	max_num = math.ceil(math.sqrt(n + 1))
	org_n = n
	used_num_list = []
	for z in range(2, max_num + 1):
		if n == 1 or z > math.sqrt(n):
			res += 1
			break
		if n % z == 0:
			res += 1
			n = n // z
			if n == z:
				break
	if n == org_n:
		res += 1
	print(res)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
  if a <= sum(list(map(int, list(str(i))))) <= b:
    ans += 1
print(ans)
# Judge status: Accepted
X, K, D = list(map(int, input().split()))

X = abs(X)
count = X // D

if count >= K:
    answer = X - K*D
else:
    if (K - count) % 2 == 0:
        answer = X - count*D
    else:
        answer = abs(X - (count+1)*D)

print(answer)
# Judge status: Wrong Answer
n = int(input())
if n < 105:
  print(0)
else:
  output = 0
  for i in range(105,n+1):
    yaku = 0
    for j in range(1,n+1):
      if n % j == 0:
        yaku += 1
      if yaku > 8:
        continue
    if yaku == 8:
      output += 1
  print(output)
# Judge status: Accepted
import itertools
import math
from statistics import mean

N = int(input())
towns = []
for i in range(N):
    xi,yi=map(int,input().split())
    towns.append([xi,yi])
order=[int(x) for x in range(N)]
root_time=[]
for one_order in itertools.permutations(order):
    root_t=0
    for i in range(len(one_order)-1):
        root_t += math.sqrt((towns[one_order[i]][0]-towns[one_order[i+1]][0])**2+(towns[one_order[i]][1]-towns[one_order[i+1]][1])**2)
    root_time.append(root_t)

print(mean(root_time))