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

import heapq

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
BC = [list(map(int,input().split())) for _ in range(M)]
BC = sorted(BC,reverse=True,key=lambda x: x[1])
i = 0

for B,C in BC:
    for a in A[i:]:
        if a < C and B != 0:
            A[i] = C
            B -= 1
            i += 1
        else:
            break
print(sum(A))

### FIXED CODE ###

import sys

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

def main():

    N,M = map(int,input().split())
    A = sorted(list(map(int,input().split())))
    BC = [list(map(int,input().split())) for _ in range(M)]
    BC = sorted(BC,reverse=True,key=lambda x: x[1])
    D = []

    for B,C in BC:
        for b in range(B):
            if len(D) != N:
                D.append(C)
            else:
                break
        else:
            continue
        break

    for i in range(len(D)):
        if A[i] < D[i]:
            A[i] = D[i]
        else:
            break

    print(sum(A))

if __name__ == "__main__":
    main()
### BUGGY CODE ###

import fractions as f

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

l = 1

mod = pow(10, 9) + 7

for i in list(a):
    l = l * i // f.gcd(l, i)

ans = 0

for i in list(a):
    ans += l // i
    ans %= mod
    
print(ans)

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
mod=10**9+7
def lcm(X,Y):
    x=X
    y=Y
    if y>x:
        x,y=y,x
    while x%y!=0:
        x,y=y,x%y
    return X*Y//y

cnt=0
ans=0
LCM=1
for i in range(n):
    Q=lcm(LCM,A[i])
    cnt*=Q//LCM
    LCM=Q
    cnt+=Q//A[i]
print(cnt%mod)
### BUGGY CODE ###

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

la = list()
for i in range(Q):
    la.append(int(input()))

for i in range(1,N+1):
    if Q-la.count(i) < K:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

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

la = list()
for i in range(Q):
    la.append(int(input()))

lcount = [0] * N
for i in range(Q):
    lcount[la[i]-1] += 1

for i in range(N):
    if K+lcount[i]-Q > 0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n = int(input())
s = input()

count = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            f1 = False
            f2 = False
            p1 = 0
            p2 = 0
            for i in range(0, n-2):
                if int(s[i]) == a:
                    f1 = True
                    p1 = i
                    break
            if f1:
                for j in range(p1+1, n-1):
                    if int(s[j]) == b:
                        f2 = True
                        p2 = j
                        break
            if f2:
                for k in range(p2+1, n):
                    if int(s[k]) == c:
                        count += 1
                        break
            if not f1 or not f2:
                break
        if not f1:
            break
print(count)


### FIXED CODE ###

# TLE

n = int(input())
s = input()

count = 0
for a in range(10):
    for b in range(10):
        for c in range(10):
            f1 = False
            f2 = False
            p1 = 0
            p2 = 0
            for i in range(0, n-2):
                if int(s[i]) == a:
                    f1 = True
                    p1 = i
                    break
            if f1:
                for j in range(p1+1, n-1):
                    if int(s[j]) == b:
                        f2 = True
                        p2 = j
                        break
            if f2:
                for k in range(p2+1, n):
                    if int(s[k]) == c:
                        count += 1
                        break
            if not f1 or not f2:
                break
print(count)
### BUGGY CODE ###

from bisect import bisect_left, bisect, insort
def main():
    n = int(input())
    a = ord("a")
    orda = lambda x: ord(x)-a
    s = list(map(orda, list(input())))
    q = int(input())
    _is = [[] for _ in range(26)]
    for i, si in enumerate(s, 1):
        _is[si].append(i)
    
    for _ in range(q):
        t, i, c = input().split()
        i = int(i)
        if t == "1":
            _is[s[i-1]].remove(i)
            insort(_is[ord(c)-a], i)
            s[i-1] = ord(c)-a
        else:
            c = int(c)
            cnt = 0
            for j in range(26):
                is_in = bisect(_is[j], c)-bisect_left(_is[j], i)
                if is_in:
                    cnt += 1
            print(cnt)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n = int(input())
    a = ord("a")
    orda = lambda x: ord(x)-a
    s = list(map(orda, list(input())))
    q = int(input())
    bits = [BIT(n) for _ in range(26)]
    for i, si in enumerate(s, 1):
        bits[si].add(i, 1)
    for _ in range(q):
        t, i, c = input().split()
        i = int(i)
        if t == "1":
            bits[s[i-1]].add(i, -1)
            bits[ord(c)-a].add(i, 1)
            s[i-1] = ord(c)-a
        else:
            c = int(c)
            cnt = 0
            for bit in bits:
                is_in = bit.sum_(c) - bit.sum_(i-1)
                if is_in:
                    cnt += 1
            print(cnt)
            
            
class BIT:
    __slots__ = ["length", "data"]
    def __init__(self, length):
        self.data = [0]*(length+1)
        self.length = length
    
    def add(self, i, x):
        while i < self.length+1:
            self.data[i] += x
            i += i&-i
    
    def sum_(self, i):
        x = 0
        while i > 0:
            x += self.data[i]
            i -= i&-i
        return x


if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,k = map(int,input().split())
lamps = list(map(int,input().split()))
for ki in range(k):
    lamplog = [0]*(n+1)
    for i in range(n):
        lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
        lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
    # print(lamplog)
    for i in range(n):                      #累積和を計算
        lamplog[i+1] += lamplog[i]
    # print(lamplog)
    lamplog.pop()
    if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
        break
    lamps = lamplog                         #今回の結果を記録

ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())

### FIXED CODE ###

from numba import jit
@jit
def main():
    n,k = map(int,input().split())
    lamps = list(map(int,input().split()))
    for ki in range(k):
        lamplog = [0]*(n+1)
        for i in range(n):
            lamplog[max(0,i-lamps[i])  ] += 1   #先端を出す
            lamplog[min(i+lamps[i]+1,n)] -= 1   #末尾を出す
        # print(lamplog)
        for i in range(n):                      #累積和を計算
            lamplog[i+1] += lamplog[i]
        # print(lamplog)
        lamplog.pop()
        if(lamplog == lamps):                   #１つ前の結果と今回の結果が同じだったら。
            break
        lamps = lamplog                         #今回の結果を記録
    return lamplog

lamplog = main()
ans = ""
for i in range(len(lamplog)):
    ans += str(lamplog[i]) +" "
print(ans.rstrip())
### BUGGY CODE ###

MOD=10**9+7

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

#print(alist)
blist=[0]*64
for a in alist:
  bin_str=format(a, '064b')
  dlist=list(map(int,list(bin_str)))
  #print(bin_str)
  for i in range(64):
    blist[i]+=dlist[i]
      
blist.reverse()
#print(blist)
answer=0
for i in range(64):
  answer+=blist[i]*(N-blist[i])*(2**i)
  
print(answer%MOD)

### FIXED CODE ###

MOD=10**9+7

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

#print(alist)
blist=[0]*64
for a in alist:
  bblist=[]
  acopy=a
  while(acopy>0):
    bblist.append(acopy%2)
    acopy//=2
    
  #print(bblist)
  for b in range(len(bblist)):
    blist[-1-b]+=bblist[b]
      
blist.reverse()
#print(blist)
answer=0
for i in range(64):
  answer+=blist[i]*(N-blist[i])*(2**i)
  
print(answer%MOD)
### BUGGY CODE ###

import sys
from collections import deque
def input():
	return sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
adj = [[] for _ in range(n)]
eff = [0 for _ in range(n)]
edges = []
is_reversed = [0 for _ in range(m)]

for i in range(m):
	a, b = map(int, input().split())
	adj[a-1].append([b-1, i])
	adj[b-1].append([a-1, i])
	edges.append([a, b])
	eff[a-1] += 1

if m%2 == 1:
	print(-1)
	sys.exit()

def dfs(start):
	prev = [(-1, -1) for _ in range(n)]
	prev[start] = (start, -1)
	q = [start]
	while q:
		l = q.pop()
		if l != start and eff[l]%2 == 1:
			eff[start] += 1
			eff[l] += 1
			break
		for v, i in adj[l]:
			if prev[v][0] < 0:
				prev[v] = (l, i)
				q.append(v)
	s, t = l, prev[l][1]
	while t >= 0:
		is_reversed[t] ^= 1
		s = prev[s][0]
		t = prev[s][1]

odd = [i for i in range(n) if eff[i]%2 == 1]
for o in odd:
	if eff[o]%2 == 1:
		dfs(o)

for i in range(m):
	if is_reversed[i]:
		print(*edges[i][::-1])
	else:
		print(*edges[i])

### FIXED CODE ###

import sys
def input():
	return sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
adj = [[] for _ in range(n)]
eff = [0 for _ in range(n)]
edges = []
visited = [False for _ in range(n)]
is_reversed = [0 for _ in range(m)]

for i in range(m):
	a, b = map(int, input().split())
	adj[a-1].append([b-1, i])
	adj[b-1].append([a-1, i])
	edges.append([a, b])
	eff[a-1] ^= 1

if m%2 == 1:
	print(-1)
	sys.exit()

def dfs(x, e):
	for v, i in adj[x]:
		if not visited[v]:
			visited[v] = True
			dfs(v, i)
	if e == -1:
		return
	else:
		if eff[x] == 1:
			is_reversed[e] ^= 1
			eff[x] ^= 1
			eff[(edges[e][0]-1) * (edges[e][1]-1) // x] ^= 1
		return

visited[0] = True
dfs(0, -1)
for i in range(m):
	if is_reversed[i]:
		print(*edges[i][::-1])
	else:
		print(*edges[i])
### BUGGY CODE ###

def main():
    N = int(input())
    S = input()

    ans = S[0]
    for i in range(1, N):
        if S[i-1] != S[i]:
            ans = ans + S[i]

    print(len(ans))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    S = input()

    ans = S[0]
    for i in range(1, N):
        if S[i-1] != S[i]:
            ans = ans + S[i]

    print(len(ans))


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
inf=10000000
sys.setrecursionlimit(inf)
from collections import deque
h,w,k=map(int,input().split())
x1,y1,x2,y2=map(int,input().split())
c=[input() for i in range(h)]
dp=[[inf if c[i][j]=="." else -1 for j in range(w)] for i in range(h)]
now=deque()
now.append([x1-1,y1-1])
def bfs(d):
    global h,w,k,dp,now,x2,y2
    l=len(now)
    if l==0:
        return
    for i in range(l):
        x,y=now.popleft()
        for j in range(1,min(k+1,w-y)):
            if dp[x][y+j]==inf:
                dp[x][y+j]=d
                now.append([x,y+j])
            if dp[x][y+j]==-1:
                break
        for j in range(1,min(k+1,y+1)):
            if dp[x][y-j]==inf:
                dp[x][y-j]=d
                now.append([x,y-j])
            if dp[x][y-j]==-1:
                break
        for j in range(1,min(k+1,h-x)):
            if dp[x+j][y]==inf:
                dp[x+j][y]=d
                now.append([x+j,y])
            if dp[x+j][y]==-1:
                break
        for j in range(1,min(k+1,x+1)):
            if dp[x-j][y]==inf:
                dp[x-j][y]=d
                now.append([x-j,y])
            if dp[x-j][y]==-1:
                break
    bfs(d+1)
bfs(1)
print(dp[x2-1][y2-1] if dp[x2-1][y2-1]!=inf else -1)

### FIXED CODE ###

import sys
inf=1000002
sys.setrecursionlimit(inf)
from collections import deque
h,w,k=map(int,input().split())
x1,y1,x2,y2=map(int,input().split())
c=[input() for i in range(h)]
dp=[[inf if c[i][j]=="." else -1 for j in range(w)] for i in range(h)]
now=deque()
now.append([x1-1,y1-1])
dp[x1-1][y1-1]=0
#kの更新が遅い
def bfs(d):
    global h,w,k,dp,now,x2,y2
    l=len(now)
    if l==0:
        return
    dp_sub=deque()
    cand=set()
    for i in range(l):
        x,y=now.popleft()
        for j in range(1,min(k+1,w-y)):
            if dp[x][y+j]==inf:
                dp_sub.append([x,y+j,d])
                #dp[x][y+j]=d
                cand.add((x,y+j))
                #now.append([x,y+j])
            else:
                break
        for j in range(1,min(k+1,y+1)):
            if dp[x][y-j]==inf:
                dp_sub.append([x,y-j,d])
                #dp[x][y-j]=d
                cand.add((x,y-j))
                #now.append([x,y-j])
            else:
                break
        for j in range(1,min(k+1,h-x)):
            if dp[x+j][y]==inf:
                dp_sub.append([x+j,y,d])
                #dp[x+j][y]=d
                cand.add((x+j,y))
                #now.append([x+j,y])
            else:
                break
        for j in range(1,min(k+1,x+1)):
            if dp[x-j][y]==inf:
                dp_sub.append([x-j,y,d])
                #dp[x-j][y]=d
                cand.add((x-j,y))
                #now.append([x-j,y])
            else:
                break
    while dp_sub!=deque([]):
        e=dp_sub.popleft()
        dp[e[0]][e[1]]=e[2]
    for i in cand:
        now.append(i)
    bfs(d+1)
bfs(1)
print(dp[x2-1][y2-1] if dp[x2-1][y2-1]!=inf else -1)
### BUGGY CODE ###

import numpy as np
import sys
import math

#n = map(int,input().split())

k = int(input())


def gcd(a,b):
    if a > b:
        a , b = b , a

    # q = b / a
    r = b % a

    if r == 0:
        return a
    else:
        return gcd(a,r)
    

sum = 0



for i in range(1,k+1):
    for j in range(1,k+1):
        x = gcd(i,j)
        for l in range(1,k+1):
            sum += gcd( x, l)

print(sum)

### FIXED CODE ###

import numpy as np
import sys
import math

#n = map(int,input().split())

data = [2246640
,2332104
,2379085
,2434833
,2490534
,2554600
,2609625
,2693919
,2742052
,2813988
,2875245
,2952085
,3003306
,3096024
,3157249
,3224511
,3306240
,3388576
,3444609
,3533637
,3591322
,3693924
,3767085
,3842623
,3912324
,4027884
,4102093
,4181949
,4270422
,4361548
,4427853
,4548003
,4616104
,4718640
,4812789
,4918561
,5003286
,5131848
,5205481
,5299011
,5392008
,5521384
,5610705
,5739009
,5818390
,5930196
,6052893
,6156139
,6239472
,6402720
,6493681
,6623853
,6741078
,6864016
,6953457
,7094451
,7215016
,7359936
,7475145
,7593865
,7689630
,7886244
,7984165
,8130747
,8253888
,8403448
,8523897
,8684853
,8802826
,8949612
,9105537
,9267595
,9376656
,9574704
,9686065
,9827097
,9997134
,10174780
,10290813
,10493367
,10611772
,10813692]


k = int(input())

if k >= 119:
    print(data[k-119])
    sys.exit()


def gcd(a,b):
    if a > b:
        a , b = b , a

    # q = b / a
    r = b % a

    if r == 0:
        return a
    else:
        return gcd(a,r)
    

sum = 0



for i in range(k):
    for j in range(k):
        for l in range(k):
            sum += gcd(i+1,gcd(j+1,l+1))


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


from collections import deque
from collections import defaultdict
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))

T = defaultdict(list)

Y = [True] * N
for _ in range(M):
    x, y = list(map(int, input().split()))
    x -= 1
    y -= 1
    T[x].append(y)
    Y[y] = False

DP = [0] * N

q = deque()
for n in range(N):
    if Y[n]:
        q.append(n)


while q:
    e = q.popleft()
    for t in T[e]:
        DP[t] = max(DP[e] + 1, DP[t])
        q.append(t)

print(max(DP))


### FIXED CODE ###


from collections import deque
from collections import defaultdict
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))

T = defaultdict(list)
in_num = defaultdict(int)

for _ in range(M):
    x, y = list(map(int, input().split()))
    x -= 1
    y -= 1
    T[x].append(y)
    in_num[y] += 1

q = deque()

for n in range(N):
    if in_num[n] == 0:
        q.append(n)


DP = [0] * N

while q:
    v = q.popleft()
    t = T[v]
    for y in t:
        in_num[y] -= 1
        if in_num[y] == 0:
            q.append(y)
            DP[y] = max(DP[y], DP[v]+1)


print(max(DP))
### BUGGY CODE ###

n = int(input())

l = []
for i in range(n):
    s = input()
    l.append("".join(sorted(s)))

l_2 = set(l)
ans = 0
for j in l_2:
    i = l.count(j)
    ans += int((i*(i-1))/2)

print(ans)


### FIXED CODE ###

import collections

n = int(input())

l = []
for i in range(n):
    s = input()
    l.append("".join(sorted(s)))

l_2 = collections.Counter(l)
ans = 0
for j in l_2.values():
    ans += int((j*(j-1))/2)

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

import math

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

# 2整数の公約数一覧 // 2num common divisor -> list
def commonDivisor (n1, n2):
    common_divisor=[]
    for i in range(2, min(n1, n2) + 1):
        if n1 % i == 0 and n2 % i == 0:
            common_divisor.append(i)
    return common_divisor

# 素数判定 // is prime? -> bool
def isPrime(n):
    for i in range(2, n):
        if n % i == 0:
            return False
    return True

cd = commonDivisor(a, b)
cd.insert(0, 1)
res = []
for num in cd:
    if isPrime(num) and res.count(num) == 0:
        res.append(num)

print("{}".format(len(res)))

### FIXED CODE ###

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

# 最大公約数
def gcd(a, b):
    while b: a, b = b, a % b
    return abs(a)

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

n = gcd(a, b)
pf = factorization(n)
if pf == [[1, 1]]:
    print("{}".format(len(pf)))
else:
    print("{}".format(len(pf)+1))
### BUGGY CODE ###

N = int(input())
L = []
for i in range(N):
    a = int(input())
    if a in L:
        L.remove(a)
    else:
        L.append(a)

L = set(L)
print(len(L))

### FIXED CODE ###

N = int(input())
L = []
for i in range(N):
    a = int(input())
    L.append(a)

L.sort()
ptr = 0
temp = 0
num = 1
ans = 0
while ptr < N:
    cc = L[ptr]
    f = 0
    while ptr < N and L[ptr] == cc:#同じ数字が続く終了条件
        f += 1
        ptr += 1
    ans += f%2

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

from copy import deepcopy

N, MA, MB = map(int, raw_input().split())
X = [map(int, raw_input().split()) for _ in range(N)]

DP = [[100000 for _ in range(401)] for _ in range(401)]
DP[0][0] = 0

S = {(0, 0)}
for a, b, c in X:
    DP2 = deepcopy(DP)
    for sa, sb in S:
        if DP[sa+a][sb+b] > DP2[sa][sb] + c:
            DP[sa+a][sb+b] = DP2[sa][sb] + c
    T = {(sa+a, sb+b) for sa, sb in S}
    S |= T

a, b = MA, MB
ans = 100000
while a <= 400 and b <= 400:
    ans = min(ans, DP[a][b])
    a += MA
    b += MB

if ans == 100000:
    print -1
else:
    print ans


### FIXED CODE ###

from collections import defaultdict

N, MA, MB = map(int, raw_input().split())
X = [map(int, raw_input().split()) for _ in range(N)]

dp = defaultdict()

dp[(0, 0)] = 0
for a, b, c in X:
    dp2 = defaultdict()
    for sa, sb in dp:
        if (sa+a, sb+b) not in dp:
            dp2[(sa+a, sb+b)] = dp[(sa, sb)] + c
        elif dp[(sa+a, sb+b)] > dp[(sa, sb)] + c:
            dp2[(sa+a, sb+b)] = dp[(sa, sb)] + c
    for (na, nb) in dp2:
        dp[(na, nb)] = dp2[(na, nb)]

a, b = MA, MB
ans = 100000
while a <= 400 and b <= 400:
    if (a, b) in dp:
        ans = min(ans, dp[(a, b)])
    a += MA
    b += MB

if ans == 100000:
    print -1
else:
    print ans
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque

def all_bit_count(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

n = int(readline())
g = [[] * n for i in range(n)]
for i in range(n-1):
  u, v = map(int,readline().split())
  u -= 1
  v -= 1
  g[u].append(v)
  g[v].append(u)
  
m = int(readline())
c = []
for i in range(m):
  u, v = map(int,readline().split())
  u -= 1
  v -= 1  
  que = deque()
  que.append((u,set()))
  chk = [False]*n
  chk[u] = True
  while que:
      now,L = que.popleft()
      if now == v:
        c.append(L)
        break
      for i in g[now]:
          if not chk[i]:
            chk[i] = True
            mi = min(now,i)
            ma = max(now,i)
            que.append((i,L|{(mi,ma)}))
                     
import itertools
ans = 1<<(n-1)
for i in range(1,m+1):
  for j in itertools.combinations(c,i):
    K = set()
    for k in j:
      K |= k
    l = len(K)
    ans += pow(-1,i)*pow(2,n-1-l)
    
print(ans)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque

n = int(readline())
g = [[] * n for i in range(n)]
for i in range(n-1):
  u, v = map(int,readline().split())
  u -= 1
  v -= 1
  g[u].append(v)
  g[v].append(u)
  
m = int(readline())
c = []
for i in range(m):
  u, v = map(int,readline().split())
  u -= 1
  v -= 1  
  que = deque()
  que.append((u,set()))
  chk = [False]*n
  chk[u] = True
  while que:
      now,L = que.popleft()
      if now == v:
        c.append(L)
        break
      for i in g[now]:
          if not chk[i]:
            chk[i] = True
            mi = min(now,i)
            ma = max(now,i)
            que.append((i,L|{mi*100+ma}))
                     
import itertools
#print(c)
ans = 1<<(n-1)
for i in range(1,m+1):
  for j in itertools.combinations(c,i):
    K = set()
    for k in j:
      K |= k
    l = len(K)
    ans += pow(-1,i)*pow(2,n-1-l)
    
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
def main():
    N = int(input())
    S = input()

    ans = 0
    for i in range(N):
        for j in range(i, N):
            for k in range(j, N):
                if (1
                        and S[i] != S[j]
                        and S[i] != S[k]
                        and S[j] != S[k]
                        and j - i != k - j):
                    ans += 1
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
def main():
    N = int(input())
    S = input()

    res = 0
    R, G, B = S.count('R'), S.count('G'), S.count('B')
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            k = j + j - i
            if k >= N:
                continue
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                res += 1
    print(R * G * B - res)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
cumS = [0]
for a in A:
    cumS.append(a + cumS[-1])
cumS_rem = {i: 0 for i in range(M)}
for c in cumS:
    r = c % M
    cumS_rem[r] += 1
ans = 0
for r in range(M):
    n_r = cumS_rem[r]
    if n_r > 1:
        ans += n_r*(n_r-1)//2
print(ans)

### FIXED CODE ###

from collections import defaultdict

N, M = map(int, input().split())
A = list(map(int, input().split()))
cumS = [0]
for a in A:
    cumS.append(a + cumS[-1])
cumS_rem = defaultdict(int)
for c in cumS:
    r = c % M
    cumS_rem[r] += 1
ans = 0
for r, n_r in cumS_rem.items():
    if n_r > 1:
        ans += n_r*(n_r-1)//2
print(ans)
### BUGGY CODE ###

N = int(input())
As = list(map(int,input().split()))
sum = 1
for i in As:
    sum *=i
sum = sum if sum<=(10**18) else -1
print(sum)

### FIXED CODE ###

N = int(input())
As = list(map(int,input().split()))
sum = 1
if 0 in As:
    print(0)
    exit()
for i in As:
    sum *=i
    if sum>10**18:
        sum = -1
        break
print(sum)
### BUGGY CODE ###

import math
import sys
A,B,N=map(int, input().split())
NUM=0
if N<B:
    NUM=math.floor(A*N/B)-A*math.floor(N/B)
    print(NUM)
    sys.exit()
else:
    if A>B:
        for x in range(N+1,math.floor(N/4),-1):
            TGT=math.floor(A*x/B)-A*math.floor(x/B)
            if TGT>NUM:
                NUM=TGT
    else:
        for x in range(1,math.floor(N/4)+1):
            TGT=math.floor(A*x/B)-A*math.floor(x/B)
            if TGT>NUM:
                NUM=TGT
print(NUM)

### FIXED CODE ###

A,B,N = (map(int , input().split()))
min(B-1,N)
x = min(B-1,N)
print(((A*x)//B - A * (x//B)))