Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n  = int(input())
a  = list(map(int, input().split()))
q  = int(input())
bc = [list(map(int, input().split())) for i in range(q)]

for i in range(q):
  # 数値の変換
  for j in range(n):
    if a[j] == bc[i][0]:
      a[j] = bc[i][1]
  print(sum(a))

### FIXED CODE ###

import collections

n  = int(input())
a  = list(map(int, input().split()))
q  = int(input())
bc = [list(map(int, input().split())) for i in range(q)]

# aの中の各要素のカウント
c = collections.Counter(a)

ans = sum(a)
for i in range(q):
  ans += (bc[i][1] - bc[i][0]) * c[bc[i][0]]
  c[bc[i][1]] += c[bc[i][0]]
  c[bc[i][0]]  = 0
  print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n-1):
    for j in range(i,n):
        if a[i]+a[j]==(j+1)-(i+1):
            ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
l=[0]*n
r=[0]*n
for i in range(n):
    if a[i]+i+1<n:
        l[a[i]+i+1]+=1
    if i+1-a[i]>0:
        r[i+1-a[i]]+=1
ans=0
for i in range(n):
    ans+=l[i]*r[i]

print(ans)
### BUGGY CODE ###

from itertools import product
N = int(input())

for h, n in product(range(1, 3501), range(1, 3501)):
    a = (4 * h * n - N * n - N * h)
    if a != 0:
        w = (N * h * n) / a
        if w == int(w) and w > 1:
            print(n,h,int(w))
            exit()

### FIXED CODE ###

from itertools import product
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        a = (4 * h * n - N * n - N * h)
        if a > 0 and (N * h * n) % a == 0:
            w = (N * h * n) / a
            int_w = int(w)
            if w == int_w:
                print(n,h,int_w)
                exit()
### BUGGY CODE ###

A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1, 2):
    ans = (ans ^ i)
    if B >= i + 1:
        ans = (ans ^ i + 1)
print(ans)

### FIXED CODE ###

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

def F(v):
    tmp = v // 2
    amari = v % 2
    ans = 0
    if tmp % 2 == 0:
        if amari != 0:
            ans = v - 1
    else:
        if amari != 0:
            ans = 1 ^ (v - 1)
        else:
            ans = 1
    return ans

ansA = F(A)
ansB = F(B + 1)
print(ansA ^ ansB)
### BUGGY CODE ###

N, K = map(int, input().split())
P = [(int(i)+1)/2 for i in input().split()]

wa_temp = 0
wa_max = 0.0
wa_temp = [sum(P[i:i+K]) for i in range(N-K+1)]
print(max(wa_temp))


### FIXED CODE ###

N, K = map(int, input().split())
P = [(int(i)+1)/2 for i in input().split()]

wa_temp = sum(P[0:K])
max_wa = wa_temp

for i in range(N-K):
    wa_temp = wa_temp - P[i] + P[i+K]
    if wa_temp > max_wa:
        max_wa = wa_temp
print(max_wa)
### BUGGY CODE ###

import numpy as np

H, W, M = map(int, input().split())
h_t = [0]*H
w_t = [0]*W
t = np.array([[0] * W for i in range(H)])
for i in range(M):
    h, w = map(int, input().split())
    t[h-1][w-1] = 1
    h_t[h-1]+=1
    w_t[w-1]+=1
h_max = max(h_t)
h_max_list = [i for i in range(len(h_t)) if h_t[i] == h_max]
w_max = max(w_t)
w_max_list = [i for i in range(len(w_t)) if w_t[i] == w_max]

for h in h_max_list:
    for w in w_max_list:
        if t[h][w] == 0:
            print(h_max + w_max)
            exit()
print(h_max + w_max - 1)

### FIXED CODE ###

import numpy as np

H, W, M = map(int, input().split())
h_t = [0]*H
w_t = [0]*W
t = {}
for i in range(M):
    h, w = map(int, input().split())
    t[(h-1, w-1)] = 1
    h_t[h-1]+=1
    w_t[w-1]+=1
h_max = max(h_t)
h_max_list = [i for i in range(len(h_t)) if h_t[i] == h_max]
w_max = max(w_t)
w_max_list = [i for i in range(len(w_t)) if w_t[i] == w_max]

for h in h_max_list:
    for w in w_max_list:
        if (h, w) not in t:
            print(h_max + w_max)
            exit()
print(h_max + w_max - 1)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
s=0 
for k in range(len(A)):
  s=s+A[k]
  
for i in range(Q):
  B,C=map(int,input().split())
  m=0
  for j in range(len(A)):
    if A[j]==B:
      A[j]=C
      m+=1
  s=s+m*(C-B)
  print(s)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
l=[0]*1000000
ans=sum(A)

for i in A:
  l[i]+=1

for i in range(Q):
  b,c=map(int,input().split())
  ans=ans+(c-b)*l[b]
  l[c]+=l[b]
  l[b]=0
  print(ans)
### BUGGY CODE ###

import numpy as np
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

# だいたいpdfの通り
def main():
    l,a,b,md=MI()

    # 数列の要素がk桁になるのがi項目で、k+1桁になるのがj項目
    k=0
    i=0
    cc=np.eye(3,dtype="i8")
    # 各桁数ごとに処理
    while i<l:
        k+=1
        j=(10**k-a+b-1)//b
        if j==0:continue
        if j>l:j=l
        # k桁の要素の個数がe
        e=j-i
        # i項目まで連結した整数をans[i],数列のi項目をs[i]とすると
        #                                       [10**k 0 0]
        # [ans[i],s[i],b] = [ans[i-1],s[i-1],b] [  1   1 0]
        #                                       [  0   1 1]
        # 最後の3x3行列をbbとして、e乗すればよいので、最小二乗法でやる
        bb=np.zeros((3,3),dtype="i8")
        bb[0,0]=pow(10,k,md)
        bb[1,0]=bb[1,1]=bb[2,1]=bb[2,2]=1
        while e:
            if e&1:cc=np.dot(cc,bb)%md
            bb=np.dot(bb,bb)%md
            e>>=1
        i=j

    # bbの累乗からできたccを初期値にかけて、答えを出す
    ans=[0,a%md,b%md]
    ans=np.array(ans,dtype="i8")
    ans=np.dot(ans,cc)%md
    print(ans[0])

main()


### FIXED CODE ###

import numpy as np
import sys

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

# だいたいpdfの通り
def main():
    l,a,b,md=MI()

    # 数列の要素がk桁になるのがi項目で、k+1桁になるのがj項目
    k=0
    i=0
    ans=[0,a%md,b%md]
    ans=np.array(ans,dtype="i8")
    # 各桁数ごとに処理
    while i<l:
        k+=1
        j=(10**k-a+b-1)//b
        if j<=0:continue
        if j>l:j=l
        # k桁の要素の個数がe
        e=j-i
        # i項目まで連結した整数をans[i],数列のi項目をs[i]とすると
        #                                       [10**k 0 0]
        # [ans[i],s[i],b] = [ans[i-1],s[i-1],b] [  1   1 0]
        #                                       [  0   1 1]
        # 最後の3x3行列をbbとして、e乗すればよいので、繰り返し二乗法でやる
        bb=np.zeros((3,3),dtype="i8")
        bb[0,0]=pow(10,k,md)
        bb[1,0]=bb[1,1]=bb[2,1]=bb[2,2]=1
        while e:
            if e&1:ans=np.dot(ans,bb)%md
            bb=np.dot(bb,bb)%md
            e>>=1
        i=j

    print(ans[0])

main()
### BUGGY CODE ###

N,M = map(int,input().split())
requests = []
for _ in range(M):
        a,b = map(int,input().split())
        requests.append([a,b])

ans = 1
requests = sorted(requests, key=lambda x:(x[0],x[1]))
b = min(requests, key=lambda x:x[1])[1]
for i in range(M):
        if requests[i][0] < b:
                continue
        else:
                ans += 1
                b = min(requests[i:], key=lambda x:x[1])[1]

print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
requests = []
for _ in range(M):
        a,b = map(int,input().split())
        requests.append([a,b])

ans = 1
requests = sorted(requests, key=lambda x:x[1])
b = requests[0][1]
for i in range(M):
        if requests[i][0] < b:
                continue
        else:
                ans += 1
                b = requests[i][1]

print(ans)
### BUGGY CODE ###

import math
A,B,N=map(int,input().split())

Ans=[0]
for i in range(N+1):
    ans=math.floor(A*i/B)-A*(math.floor(i/B))
    Ans.append(ans)
    if Ans[i-1]>Ans[i]:
        break
    else:
        pass
    
#print(Ans)
print(max(Ans))


### FIXED CODE ###

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

x=min(N,B-1)

Ans=int(A*x/B)-A*int(x/B)
#print(Ans)
print(Ans)
### BUGGY CODE ###

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

from collections import defaultdict

d = defaultdict(int)

for i in range(n):
    d[s[i]]+= 1

r = 0
key = sorted(list(d.keys()))
ng = len(key)
for i in range(ng)[::-1]:
    ki = key[i]
    for j in range(i+1)[::-1]:
        kj = key[j]
        if kj <= ki / 2:
            continue
        for k in range(j+1)[::-1]:
            ti = 0
            kk = key[k]
            if kj + kk <= ki:
                break
            if ki != kj and kj != kk and ki != kk:
                ti = d[ki] * d[kj] * d[kk]
            elif ki == kj and kj == kk:
                if d[ki] < 3:
                    continue
                else:
                    ti = d[ki] * (d[ki]-1) * (d[ki]-2) // 6
            elif ki == kj:
                if d[ki] < 2:
                    continue
                else:
                    ti = d[ki] * (d[ki]-1) * d[kk] // 2
            elif kj == kk:
                if d[kk] < 2:
                    continue
                else:
                    ti = d[j] * (d[kj]-1) * d[ki] // 2
            elif ki == kk:
                if d[ki] < 2:
                    continue
                else:
                    ti = d[ki] * (d[ki]-1) * d[kj] // 2
            r+=ti
print(r)




### FIXED CODE ###

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

import bisect

s = sorted(s)

res = 0
for i in range(n)[::-1]:
    for j in range(i)[::-1]:
        if s[j] <= s[i] / 2:
            break
        k = bisect.bisect_left(s, s[i]-s[j]+1)
        res += max(0, j-k)
print(res)
### BUGGY CODE ###

import numpy as np

n, m = map(int, input().split())
alist = np.array(list(map(int, input().split())))

for _ in range(m):
  b, c = map(int, input().split())
  alist =np.concatenate([alist, np.array([c for _ in range(b)])], axis=1)

print(np.sum(np.sort(alist)[-n:]))

### FIXED CODE ###

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

CB = []
for _ in range(M):
  b,c = map(int,input().split())
  CB.append([c,b])
CB.sort(reverse=True)

num = 0
ans = 0 
for c,b in CB:
  for bi in range(b):
    if num >= N: break
    if num > N or c<=A[num]:
      break
    else:
      num += 1
      ans += c
print(ans+sum(A[num:]) if num != N else ans)
### BUGGY CODE ###

import math
 
K = int(input());
gcd = 0;
gcd1 = 0;
  
for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      gcd1 = math.gcd(a,b);
      gcd += math.gcd(gcd1,c);

print(gcd)


### FIXED CODE ###

from math import gcd
 
K = int(input());
sum = 0;

for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      sum += gcd(gcd(a,b),c);

print(sum)
### BUGGY CODE ###

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

s = 0
for i, di in enumerate(d):
    d2 = d[i+1:]
    for j, dj in enumerate(d2):
        d3 = d2[j+1:]
        for dk in d3:
            if (di < dj + dk) and (dj < di + dk) and (dk < di + dj):
                s += 1

print(s)

### FIXED CODE ###

import bisect

n=int(input())
L=sorted(list(map(int,input().split())))

ans=0
for i in range(n-1):
  for j in range(i+1,n):
    idx=bisect.bisect_left(L,L[j]+L[i])
    ans+=max(0,idx-j-1)

print(ans)
### BUGGY CODE ###

NM=list(map(int,input().split()))
N=NM[0]
M=NM[1]
graph=[[0 for i in range(N)] for j in range(N)]

for i in range(M):
  edge=list(map(int,input().split()))
  graph[edge[0]-1][edge[1]-1]=1
  
ST=list(map(int,input().split()))
S=ST[0]-1
T=ST[1]-1



first=[]
second=[]
third=[]
able=[S]

step=0

while True:
  first=[]
  second=[]
  third=[]
  judge = 0
  for i in range(len(able)):
    for j in range(N):
      if (graph[able[i]][j] == 1) and not (j in first):
        first.append(j)
  for i in range(len(first)):
    for j in range(N):
      if (graph[first[i]][j] == 1) and not (j in second):
        second.append(j)
  for i in range(len(second)):
    for j in range(N):
      if (graph[second[i]][j] == 1) and not (j in third):
        third.append(j)
  for i in range(len(third)):
      if not third[i] in able:
        able.append(third[i])
        judge = 1
  if judge == 0:
    print(-1)
    break
  step+=1
  if T in able:
    print(step)
    break
    
  

      




### FIXED CODE ###



import sys
from collections import deque, defaultdict
import copy
import bisect
#sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import combinations, permutations

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


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

graph = [[] for _ in range(3*N)]

for i in range(M):
	u, v = list(map(int, input().split()))
	u -= 1
	v -= 1
	graph[u%(3*N)].append((v + N)%(3*N))
	graph[(u + N) % (3 * N)].append((v+2*N)%(3*N))
	graph[(u + 2*N) % (3 * N)].append(v % (3 * N))
S, T = list(map(int, input().split()))
S -= 1
T -= 1

dist = [1000000000000000000 for _ in range(3*N)]
que = deque([])
que.append(S)
dist[S] = 0
while len(que) > 0:
	node = que.popleft()
	for edge in graph[node]:
		if dist[edge] > dist[node] + 1:
			dist[edge] = dist[node] + 1
			que.append(edge)

if dist[T] < 100000000000000:
	print(dist[T]//3)
else:
	print(-1)
### BUGGY CODE ###

import re

a, i = [int(n) for n in input().split()]
s = input()
k = 0
f = []
e = []
result = []

while k < i:
    ft, et = [int(n) for n in input().split()]
    f.append(ft)
    e.append(et)
    result.append(len(re.findall("AC", s[ft - 1:et])))
    k += 1

for kekka in result:
    print(kekka)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n, q = map(int, input().split())
s = input()

count = [0]
for i in range(1, n):
    count.append(count[i-1])
    if(s[i-1:i+1] == "AC"):
        count[i] += 1

# print(count)

for _ in range(q):
    l, r = map(int, input().split())
    print(count[r-1]-count[l-1])
### BUGGY CODE ###

n, k = list(map(int,input().split()))
a = list(map(int,input().split()))
# 循環を調べる
tmp_city=[]
c=0
init_city=0

while (1):
    tmp=a[c]
    if tmp in tmp_city:
        init_city=tmp_city.index(tmp)+1
        tmp_city=[1]+tmp_city
        break
    tmp_city.append(tmp)
    c=tmp-1
if len(tmp_city)>k:
    print(tmp_city[k])
else:
    print(tmp_city[init_city:][(k-(init_city))%len(tmp_city[init_city:])])

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))
D = [0] * (n+1)
now = 1
for i in range(1, k+1):
    tmp = A[now-1]
    if not D[tmp]:
        now = tmp
        D[now] += i
    else:
        pre = D[tmp]
        loop = i - D[tmp]
        if loop>1:
            now=D.index((k - pre) % loop + pre)
        else:
            now=tmp
        break
print(now)
### BUGGY CODE ###

N = int(input())
li = list(map(int, input().split()))
for k in range(N):
    check_li, ans = li[:k]+li[k+1:], 0
    for i in range(1, N+1):
        ans += check_li.count(i) * (check_li.count(i)-1) // 2
    print(ans)

### FIXED CODE ###

from collections import Counter
N, li = int(input()), list(map(int, input().split()))
cnt_dict, cnt_total = Counter(li), 0
for i in cnt_dict.items():
    cnt_total += i[1] * (i[1]-1) // 2
for k in range(N):
    buf = cnt_dict[li[k]]
    print(cnt_total - buf*(buf-1)//2 + (buf-1)*(buf-2)//2)
### BUGGY CODE ###

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

result = 1
for i in range(len(a)):
  result = result*a[i]
  if result == 0:
    break

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
result = 1
for i in range(len(a)):
  result = result*a[i]
  if result == 0:
    break
  elif result > 1000000000000000000:
    break

if result <= 1000000000000000000:
  print(result)
else:
  print(-1)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import bisect

n,d,a= map(int, input().split())
x= [list(map(int, input().split())) for i in range(n)]

x.sort()
y=[]
for i in range(n):
    y.append(x[i][0])
    x[i][1]=-(-x[i][1]//a)

# どのモンスターまで倒したか管理しながら進める。
ans=0
k=0
for i in range(n):
    if x[i][1]>=1:
        w=x[i][1]
        ans+=w
        q=bisect.bisect_right(y,x[i][0]+2*d,i,n)
        for j in range(q-i):
            if x[i+j][1]<=0:
                continue
            else:
                x[i+j][1]-=w
    i=i+k
    k=0
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
import bisect
import collections
from collections import deque
n,d,a= map(int, input().split())
x= [list(map(int, input().split())) for i in range(n)]

x.sort()
y=[]
for i in range(n):
    y.append(x[i][0])
    x[i][1]=-(-x[i][1]//a)

# どのモンスターまで倒したか管理しながら進める。
# 累積ダメージを管理
qq=deque([])
ans=0
atk=0
for i in range(n):
    w=x[i][1]
    # iがダメージの有効期限を超過している場合
    while len(qq)>0 and i > qq[0][0]:
        atk-=qq[0][1]
        qq.popleft()

    if w-atk>0:
        ans+=w-atk
        q=bisect.bisect_right(y,x[i][0]+2*d)-1
        # 有効期限　ダメージ
        qq.append([q,w-atk])
        atk += w - atk
print(ans)
### BUGGY CODE ###

N = int(input())
a = list(map(int,input().split()))
ans=1
for i in range(N):
    ans=ans*a[i]
    if a[i]==0:
        ans=0
        break
if ans>1000000000000000000:
    ans=-1
print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
ans=1
check=0
for i in range(N):
    ans=ans*a[i]
    if a[i]==0:
        ans=0
        check=2
        break
    if ans>1000000000000000000:
        ans=1
        check=1
if check==1:
    ans=-1
print(ans)
### BUGGY CODE ###

n= int(input())
s = input()
total = 0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if s[i] != s[j] and  s[i] != s[k] and s[j] != s[k]:
                if j!= (k+i)/2:
                    # if j<3:
                        # print(i,j,k)
                    total += 1
print(total)

### FIXED CODE ###

n = int(input())
s = input()
a = []
for i in range(n):
    if s[i] == 'R' :
         a.append(0)
    if s[i] == 'G' :
         a.append(1)
    if s[i] == 'B' :
         a.append(2)
cnt = [0,0,0]
for i in range(n):
    cnt[a[i]] +=1
ans = 1

for i in range(3):
    ans *= cnt[i]
# print(a)
for i in range(n):
    for j in range(i+1,n):
        k = j+(j-i)
        if k<n:
            if a[i] != a[j] and  a[i] != a[k]and a[k] != a[j]:
                # print(i,j,k,a[i],a[j],a[k])
                ans -=1



# print(cnt)
print(ans)
### BUGGY CODE ###

K,S = input().split()
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if int(S)-x-y >=0 and int(S)-x-y <=int(K):
      count+=1


print(count)

### FIXED CODE ###

K,S = [int(x) for x in input().split()]
count = 0

for x in range(int(K)+1):
  for y in range(int(K)+1):
    if 0<=S-x-y<=K:
      count+=1


print(count)
### BUGGY CODE ###

def main():
  n = int(input())
  a = tuple(map(int, input().split()))
  ov = 10**9+7
  from fractions import gcd
  def lcm(a):
      x = a[0]
      for i in range(1, len(a)):
          x = (x * a[i]) // gcd(x, a[i])
      return x
  l = lcm(a)
  b= [l//i%ov for i in a]
  print(sum(b)%ov)
if __name__ == "__main__":
  main()

### FIXED CODE ###

def main():
  from functools import reduce
  from fractions import gcd
  ans = 0
  n = int(input())
  b = tuple(map(int, input().split()))
  ov = 10**9+7
  def lcm(x,y):
    return (x * y) // gcd(x, y)
  def lcm_list(a):
    return reduce(lcm, a, 1)
  l = lcm_list(b)
  for i in range(n):
    ans += l//b[i]
  print(ans%ov)
if __name__ == "__main__":
  main()
### BUGGY CODE ###

def main():
    n = int(input())
    doubly_linked_list=[]
    for i in range(n):
        # organize an inputted command
        input_command = input()
        if ' ' in input_command:
            command, key = input_command.split()
        else:
            command, key = input_command, None

        # execute a command
        if command == 'insert':
            doubly_linked_list.insert(0, key)
        elif command == 'delete':
            if key in doubly_linked_list:
                doubly_linked_list.remove(key)
        elif command == 'deleteFirst':
            doubly_linked_list.pop(0)
        elif command == 'deleteLast':
            doubly_linked_list.pop()
        else:
            raise AssertionError
        #print(doubly_linked_list)

    print(' '.join(doubly_linked_list))

    return


main()


### FIXED CODE ###

import sys
from collections import deque


def main():
    line = sys.stdin.readlines()
    deq = deque()
    for i in range(1, int(line[0]) + 1):
        input_command = line[i]

        if input_command[0] == 'i':         # 'insert index'
            deq.appendleft(input_command[7:-1])
        elif input_command[0] == 'd':
            if input_command[6] == ' ':     # 'delete index'
                key = input_command[7:-1]
                if key in deq:
                    deq.remove(key)
            elif input_command[6] == 'F':   # 'deleteFirst':
                deq.popleft()
            elif input_command[6] == 'L':   # 'deleteLast':
                deq.pop()

    print(' '.join(deq))
    return


main()
### BUGGY CODE ###

import numpy as np
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,k=map(int,input().split())
a=np.array(list(map(int,input().split())))
dp=np.full(k+1,False)
calted=np.full(k+1,False)
# dp[i]:残り石i個で自分のターンになった時、勝てるならTrue
# dp[0]=False,dp[a]=True,求めるのはdp[k]
mi=np.min(a)
ma=np.max(a)
dp[a]=True
calted[a]=True
# dp[i]={dp[i-a]の中にFalseがあればTrue、すべてTrueならFalse}
for i in range(mi+1,k+1):
      if calted[i]:
            continue
      il=i-a
      f=np.prod(dp[il[il>=0]])
      if f == 0:
            dp[i]=True
      else:
            dp[i]=False
print('First' if dp[k] else 'Second')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
#n,k=100,100000
#a=range(1,101)

dp=[False for _ in range(k+1)]
calted=[False for _ in range(k+1)]
# dp[i]:残り石i個で自分のターンになった時、勝てるならTrue
# dp[0]=False,dp[a]=True,求めるのはdp[k]
mi=min(a)
ma=max(a)
for ai in a:
	dp[ai]=True
	calted[ai]=True
# dp[i]={dp[i-a]の中にFalseがあればTrue、すべてTrueならFalse}
for i in range(mi+1,k+1):
      if calted[i]:
            continue
      il=[i-ai for ai in a if i-ai>=0]
      f=1
      for l in il:
        f*=dp[l]
      if f == 0:
            dp[i]=True
      else:
            dp[i]=False
print('First' if dp[k] else 'Second')
#print(dp)
#print(datetime.datetime.now())
### BUGGY CODE ###

def add(x, y):
  if dp_list[x][y] == 0:
    dp_list[x][y] = lists[x] + lists[y]
  return dp_list[x][y]


N = int(input())
lists = list(map(lambda x: int(x), input().split()))
# 昇順ソート
lists.sort()
dp_list = [[0 for i in range(N)] for j in range(N)]
count = 0

for a in range(len(lists)):
  if(a + 1) >= len(lists):
    break
  for b in range(a + 1, len(lists)):
    if(b + 1) >= len(lists):
      break
    for c in range(b + 1, len(lists)):
      if add(a, b) > lists[c]:
        count += 1
      else:
        break
#      if add(a, b) > lists[c] and add(b, c) > lists[a] and add(a, c) > lists[b]:
#        count += 1
            
print(count)

### FIXED CODE ###

from bisect import bisect_left
n = int(input())
l = list(map(int,input().split()))
l.sort()
 
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
   ans += bisect_left(l,l[i] + l[j]) - j - 1
print(ans)