Harryxun/stf_run huggingface dataset:
n=int(input())
z=0
for i in range(n):
  a,b=input().split()
  if b=="BTC":
    z += float(a)*380000
  else:
    z += int(a)
print(z)

### FIXED CODE ###

s=input()
if(s>"2019/04/30"):
   print("TBD")
else:
   print("Heisei")
import math

def cmb(n, r):
  if r == 0 or n == r:
    return 1
  return math.factorial(n) // math.factorial(n-r) // math.factorial(r)

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

for i in range(K):
  C = (cmb(K-1, i) * cmb((N-K+1), i+1)) % (10 ** 9 + 7)
  print(C)

### FIXED CODE ###

import math

def cmb(n, r):
  if n == r:
    return 1
  return math.factorial(n) // math.factorial(n-r) // math.factorial(r)

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

for i in range(K):
  if (N-K+1) < i + 1:
    print(0)
  else:
  	C = (cmb(K-1, i) * cmb((N-K+1), i+1)) % (10 ** 9 + 7)
  	print(C)
import math


def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n % b


def main():
    n = int(input())
    s = int(input())
    if s == 1:
        print(n)
        return
    elif s == n:
        print(n+1)
        return
    elif s > n:
        print(-1)
        return
    sqrt = -int(-math.sqrt(n))
    b = 2
    for b in range(2, sqrt+1):
        if f(b, n) == s:
            print(b)
            return
    for x in range(sqrt, s, -1):
        y = s - x
        z = n - x
        b = z // y
        if z % y == 0 and f(b, n) == s:
            print(b)
            return
    print(-1)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import math


def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + n % b


def main():
    n = int(input())
    s = int(input())
    if s == n:
        print(n+1)
        return
    elif s > n:
        print(-1)
        return
    sqrt = int(math.sqrt(n))
    for b in range(2, sqrt+2):
        if f(b, n) == s:
            print(b)
            return
    for x in range(sqrt, 0, -1):
        if x > s:
            continue
        y = s - x
        b = (n - y) // x
        if b >= 2 and (n - y) % x == 0 and f(b, n) == s:
            print(b)
            return
    print(-1)


if __name__ == "__main__":
    main()
C = str(input())
print chr(ord(C) + 1)

### FIXED CODE ###

C = str(input())
print(chr(ord(C) + 1))
import math

def koch(n,p1,p2):
    if n==0:
        return
    s = [(2*p1[0]+1*p2[0])/3, (2*p1[1]+1*p2[1])/3]
    t = [(1*p1[0]+2*p2[0])/3, (1*p1[1]+2*p2[1])/3]
    u = [(t[0]-s[0])*0.5 - (t[1]-s[1])*sin60+ s[0],
        (t[0]-s[0])*sin60 + (t[1]-s[1])*0.5 + s[1]]
    koch(n-1,p1,s)
    print s[0],s[1]
    koch(n-1,s,u)
    print u[0],u[1]
    koch(n-1,u,t)
    print t[0],t[1]
    koch(n-1,t,p2)
        
n = int(raw_input())
p1 = (0,0)
p2 = (100,0)
print p1[0],p1[1]
koch(n,p1,p2)
print p2[0],p1[1]

### FIXED CODE ###

import math
sin60 = math.sin(60*math.pi/180)
def koch(n,p1,p2):
    if n==0:
        return
    s = [(2*p1[0]+1*p2[0])/3., (2*p1[1]+1*p2[1])/3.]
    t = [(1*p1[0]+2*p2[0])/3., (1*p1[1]+2*p2[1])/3.]
    u = [(t[0]-s[0])*0.5 - (t[1]-s[1])*sin60+ s[0],
        (t[0]-s[0])*sin60 + (t[1]-s[1])*0.5 + s[1]]
    koch(n-1,p1,s)
    print s[0],s[1]
    koch(n-1,s,u)
    print u[0],u[1]
    koch(n-1,u,t)
    print t[0],t[1]
    koch(n-1,t,p2)
        
n = int(raw_input())
p1 = (0,0)
p2 = (100,0)
print p1[0],p1[1]
koch(n,p1,p2)
print p2[0],p1[1]
n=int(inpput())
list=[input() for i in range(n)]
lists=[]
for i in list:
  lists.append(''.join(sorted(i)))
  
print(len(lists)-len(set(lists)))

### FIXED CODE ###

n = int(input())

words = {}
anagrams = 0

for i in range(n):
    word = "".join(sorted(input()))
    if word not in words:
        words[word] = 1
    else:
        anagrams += words[word]
        words[word] += 1

print(anagrams)
import sys
ds = int(raw_input())
list =[int(x) for x in sys.stdin.readlines()]
print list
for i in xrange(ds):
    print str(list[i*2]+list[i*2+1])

### FIXED CODE ###

ds = int(raw_input())
for i in xrange(ds):
    x=int(raw_input())
    y=int(raw_input())
    sum = str(x+y)
    if len(sum) > 80:
        print "overflow"
    else:
        print sum
def judge(N):
    return N//100000000

N=int(input())
arr0=[]
arr1=[]
arr2=[]
arr3=[]
arr4=[]
arr5=[]
arr6=[]
arr7=[]
arr8=[]
arr9=[]
arrs=[arr0,arr1,arr2,arr3,arr4,arr5,arr6,arr7,arr8,arr9]

amount=0

for n in range(N):
    _=int(input())
    a = judge (_)
    if arrs[a].count(_)>1:
        arrs[a].remove(_)
    else:
        arrs[a].append(_)

for x in range(len(arrs)):
    amount +=len(arrs[x])

print(amount)

### FIXED CODE ###

N=int(input())
S=set()

for n in range(N):
    _=int(input())
    if _ in S:
        S.remove(_)
    else:
        S.add(_)

print(len(S))
N,K = list(map(int,input().split()))

tree = [[] for _ in range(N+10)]

for i in range(N-1):
    a,b = list(map(int,input().split()))
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

ans = []
def wfs(now,back):
    if now != 0:
        cnt = K - 2 #まず一個上のを引く。
    else:
        cnt = K - 1
    for nxt in tree[now]:
        if nxt != back:
            ans.append(cnt)
            cnt = cnt - 1
            wfs(nxt,now)

ans.append(K)
wfs(0,-1)

ans2 = 1
for j in range(len(ans)):
    ans2 = (ans2 * ans[j]) % (10**9+7)
print(ans2)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
 

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

tree = [[] for _ in range(N+10)]

for i in range(N-1):
    a,b = list(map(int,input().split()))
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)

ans = []
def wfs(now,back):
    if now != 0:
        cnt = K - 2 #まず一個上のを引く。
    else:
        cnt = K - 1
    for nxt in tree[now]:
        if nxt != back:
            ans.append(cnt)
            cnt = cnt - 1
            wfs(nxt,now)

ans.append(K)
wfs(0,-1)

ans2 = 1
for j in range(len(ans)):
    ans2 = (ans2 * ans[j]) % (10**9+7)
print(ans2)
S = input()
T = input()
# print()
if len(S)>=10**5+5*10**4:
    print("No")
else:
    for i in range(len(S)):
        if S[i] != T[i]:
            S = S.translate(str.maketrans({S[i]:T[i],T[i]:S[i]}))
            # S=S.replace(S[i],T[i])
    if S==T:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

a,b,c=  map(int,input().split())
temp= [a,b,c]
temp.sort()
temp1=int(str(temp[-1])+str(temp[-2]))
print(temp1+temp[0])
n = int(input())
A = list(map(int, input().split()))

rgb = [0, 0, 0]
ans = 1
for a in A:
    ans = ans * rgb.count(a) % 1000000007
    idx = rgb.index(a)
    rgb[idx] += 1

print(ans)


### FIXED CODE ###

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

rgb = [0, 0, 0]
ans = 1
for a in A:
    if a not in rgb:
        print(0)
        break
    ans = (ans * rgb.count(a)) % 1000000007
    idx = rgb.index(a)
    rgb[idx] += 1
else:
    print(ans)
a = list(map(int, input().split()))
print(i[0]*i[1])

### FIXED CODE ###

i = list(map(int, input().split()))
print(i[0]*i[1])
n = input()
m = str(n)
if m[-1] == m[-2] == m[-3] == "0":
    print(0)
else:
    print(1000 - int(m[-3]+m[-2]+m[-1]))

### FIXED CODE ###

n = int(input())
for i in range(100):
    if i * 1000 >= n:
        print(i * 1000 - n)
        break
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np
 
DIV_NUM = 1000000000 + 7
 
INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])
 
A = [int(x) for x in input().split()]
AA = np.array(A , dtype='int64')

if N==1:
    print(0)
    exit()
 
tree = [0] * (N+1)

def BIT_update(x):
    while x <= N:
        tree[x] += 1
        y = x
        z = 1
        while y:
            if y % 2 == 1:
                x += z
                break
            y /= 2
            z *= 2
def BIT_sum(x):
    s = 0
    while x > 0:
        s += tree[x]
        y = x
        z = 1
        while y:
            if y % 2 == 1:
                x -= z
                break
            y /= 2
            z *= 2
    return s
 
answer = N*(N-1)//2
for i in AA:
    answer -= BIT_sum(int(i))
    BIT_update(int(i))

print(type(i),type(N))
print(tree)


B = sorted(A)
 
q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r
 
# print(answer,K)
answer = answer % DIV_NUM
answer = int(answer)
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)
 

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

DIV_NUM = 1000000000 + 7

INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])

A = [int(x) for x in input().split()]
AA = np.array(A)
if N==1:
    print(0)
    exit()

# https://kira000.hatenadiary.jp/entry/2019/02/23/053917
def bubble_sort(A):
    cnt = 0
    for i in range(len(A)):
        for j in range(len(A)-1, i, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
    return cnt

answer = bubble_sort(AA)

B = sorted(A)
q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r

# print(answer,K)
answer = answer % DIV_NUM
answer = int(answer)
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)
n=int(input())
s=input()

l=["A","B","C","D","E","F","G","H","I","J","K","L","M","","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

ans=""

for a in s:
  index = l.index(a)
  index=(index+n)%26
  ans += l[index]

print(ans)

### FIXED CODE ###

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

l=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

ans=""

for a in s:
  index = l.index(a)
  index=(index+n)%26
  ans += l[index]

print(ans)
n = int(input())
low, upper = [], []
i = 1
while i*i <= n:
    if n % i == 0:
        low.append(i)
        if i != n//i:
            upper.append(n//i)

    i += 1
print(len(str(min(upper))))

### FIXED CODE ###

n = int(input())
num = 1
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
       num = i

ans = len(str(max(num, n // num)))
print(ans)
tree = [[] for _ in range(200001)]
res = [0]*200001
 
def dfs(p, pre):
    for child in tree[p]:
        if child == pre: continue
        res[child] += res[p]
        dfs(child, p)
 
def main():
    """ main """
    N, Q = map(int, input().split())
    for _ in range(N-1):
        a,b = map(int, input().split())
        tree[a].append(b)
        tree[b].append(a)
    for _ in range(Q):
        p,x = map(int, input().split())
        res[p] += x
    dfs(1, 0)
 
    print(*res[1:N+1])
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
from heapq import *
sys.setrecursionlimit(10**8)

input = sys.stdin.readline

tree = [[] for _ in range(200001)]
res = [0]*200001

def dfs(p, pre):
    for child in tree[p]:
        if child == pre: continue
        res[child] += res[p]
        dfs(child, p)

def main():
    """ main """
    N, Q = map(int, input().split())
    for _ in range(N-1):
        a,b = map(int, input().split())
        tree[a].append(b)
        tree[b].append(a)
    for _ in range(Q):
        p,x = map(int, input().split())
        res[p] += x
    dfs(1, 0)

    print(*res[1:N+1])

if __name__ == '__main__':
    main()
s=[input()]
q=int(input())
turn=True
for i in ragne(q):
    qq=input().split()
    if qq[0]=='1':
        turn=not turn
    else:
        if turn==not (int(qq[1])-1]):
            s.insert(0,qq[2])
        else:
            s.append(qq[2])
text="".join(s)
print(text if turn else text[::-1])

### FIXED CODE ###

s=[input()]
q=int(input())
turn=True
l=""
for i in range(q):
    qq=input().split()
    if qq[0]=='1':
        turn=not turn
    else:
        if turn==bool(int(qq[1])-2):
            l+=qq[2]
        else:
            s.append(qq[2])

text=l[::-1]+"".join(s)
print(text if turn else text[::-1])
S = input()

S = np.array( [S[i] for i in range(len(S))] )

if (S[0::2]=='L').any():
  print('No')
elif (S[1::2]=='R').any():
  print('No')
else:
  print('Yes')

### FIXED CODE ###

import numpy as np

S = input()
 
S = np.array( [S[i] for i in range(len(S))] )
 
if (S[0::2]=='L').any():
  print('No')
elif (S[1::2]=='R').any():
  print('No')
else:
  print('Yes')
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = INT()
h = LIST()
count = 0
for i in h:
    if i >= k:
        count += 1
print(count)


### FIXED CODE ###

import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
h = LIST()
count = 0
for i in h:
    if i >= k:
        count += 1
print(count)
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
count = 0
 
for i in range(n):
  a = list(map(int, input().split()))
  for j in range(m):
    if 0 < a[m] * b[m] + c:
      count += 1
print(count)

### FIXED CODE ###

n, m, c = map(int, input().split())
b = list(map(int, input().split()))
count = 0
 
for i in range(n):
  a = list(map(int, input().split()))
  p = c
  for j in range(m):
  	p += a[j] * b[j]
  if 0 < p:
    count += 1
print(count)
while(True):
  temp = raw_input()
  temp_list = temp.split()
  x = int(temp_list[0])
  y = int(temp_list[1])
  if x == y and x == 0:
    break
  else:
    print(str(min([x, y]) ) + " " + str(max([x, y]) )
  


### FIXED CODE ###

while(True):
  temp = raw_input()
  temp_list = temp.split()
  x = int(temp_list[0])
  y = int(temp_list[1])
  if x == y and x == 0:
    break
  else:
    print(str(min([x, y]) ) + " " + str(max([x, y]) ))
s=input()

for i in range(0,1):
    if s[i]!=s[i+1]:
        X=Yes
        break
    else :
        X=No

print(X)


### FIXED CODE ###

s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
  
else :
  print("Yes")
a=int(input())
b=int(input())
print((b-a-1)*(b-a)//2-a)

### FIXED CODE ###

a=int(input())
if (a>999):
    print('ABD')
else:
    print('ABC')
s=input()
a=s[:len(s)//2]
b=s[(len(s)//2)+1:]
if a==b:
  if a==reversed(a) and b==reversed(b):
  print('Yes')
  else:
    print('No')
else:
  print('No')


### FIXED CODE ###

s=input()
ans='No'
if s==s[::-1]:
  t=s[:len(s)//2]
  if t==t[::-1]:
    u=s[len(s)//2+1:]
    if u==u[::-1]:
      ans='Yes'
print(ans)
n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])    
    for  j in range(l):
        C.append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for ni in range(n):
    print(" ".join(str(s) for s in C[ni]))

### FIXED CODE ###

n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
for ni in range(n):
    print(" ".join([str(s) for s in C[ni]]))
def Warshall_Floyd(edges,N):
  """頂点N個のグラフ上の隣接行列edges(空欄はinfとせよ)が与えられたとき, 
  2点間の最短距離距離を隣接行列で返す"""
  for k in range(0:N:2):
    for i in range(N):
      for j in range(i):
        if edges[i][j]>edges[i][k]+edges[k][j]: return 1
  return 0
 
import sys
from sys import stdin
input = stdin.readline
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
if Warshall_Floyd(A,N):
  print(-1)
  sys.exit()
 
ans=0
print(ans)

### FIXED CODE ###

def Warshall_Floyd(edges,N):
  """頂点N個のグラフ上の隣接行列edges(空欄はinfとせよ)が与えられたとき, 
  2点間の最短距離距離を隣接行列で返す"""
  for k, i, j in itertools.product(range(N), range(N),range(N)):
    if edges[i][j]>edges[i][k]+edges[k][j]: return 1
  return 0
 
import sys
import itertools
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
if Warshall_Floyd(A,N):
  print(-1)
  sys.exit()
 
ans=0
for i, j in itertools.product(range(N),range(N)):
  need=1
  for k in range(N):
    if k!=i and k!=j and A[i][j]==A[i][k]+A[k][j]:
      need=0
      break
  if need:ans+=A[i][j]
print(ans//2)
import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n=ri()
a=rl()
t=0
for i in a:
    t^=i
t=bin(t)[2:]
max_len=len(bin(max(a)))-2
#print(max_len)
if len(t)<max_len:t="0"+t
#print(t)
a=list(map(lambda x : bin(x)[2:],a))
for i in range(n):
    if len(a[i])<max_len:
        a[i]="0"+a[i]
#print(a)
ans=[[] for i in range(n)]
for i in range(max_len):
    for j in range(n):
        if a[j][i]==t[i]:
            ans[j].append("0")
        else:
            ans[j].append("1")
#print(ans)
for i in ans:
    print(int("".join(i), 2))
    


### FIXED CODE ###

import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n=ri()
a=rl()
t=0
for i in a:
    t^=i
t=bin(t)[2:]
max_len=max(len(bin(max(a)))-2,len(t))

if len(t)<max_len:t="0"*(max_len-len(t))+t
try:
    a=list(map(lambda x : bin(x)[2:],a))
except:
    sys.exit()
    
try:
    for i in range(n):
        if len(a[i])<max_len:
            a[i]="0"*(max_len-len(a[i]))+a[i]
except:
    sys.exit()


ans=[[] for i in range(n)]
for i in range(max_len):
    for j in range(n):  
            if a[j][i]==t[i]:
                ans[j].append("0")
            else:
                ans[j].append("1")

for i in ans:
    print(int("".join(i), 2))
import sys
from heapq import heappop, heappush, heapify

def main():
    input = sys.stdin.readline
    
    N, Q = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    ls = [b-a for a, b in zip(A, B)]
    st = set(ls[1:-1])
    q_m = [-v for v in ls[1:-1] if v < 0]
    q_p = [v for v in ls[1:-1] if v >= 0]
    heapify(q_m)
    heapify(q_p)
    sum_A = sum(A)
    sum_q_p = sum(q_p)
    to_remove = set()
    odd = len(q_p) % 2
    Ans = []
    ans = sum_A + sum_q_p - (min(q_p[0], q_m[0]) if odd else 0)
    for _ in range(Q):
        p, x, y = map(int, input().split())
        p -= 1
        v = y-x
        sum_A += x - A[p]
        if p==0 or p==2*N-1:
            ans += x - A[p]
            Ans.append(ans)
            A[p] = x
            continue
        A[p] = x
        odd ^= (ls[p] >= 0) ^ (v >= 0)
        if v >= 0:
            sum_q_p += v
        if ls[p] >= 0:
            sum_q_p -= ls[p]
        to_remove.add(ls[p])
        ls[p] = v
        if v >= 0:
            heappush(q_p, v)
        else:
            heappush(q_m, -v)
        ans = sum_q_p + sum_A
        if odd:
            while q_p[0] in to_remove:
                heappop(q_p)
            while q_m[0] in to_remove:
                heappop(q_m)
            ans -= min(q_p[0], q_m[0])
        Ans.append(ans)
    print("\n".join(map(str, Ans)))

main()


### FIXED CODE ###

import sys
from heapq import heappop, heappush, heapify

def main():
    input = sys.stdin.readline
    
    N, Q = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    ls = [b-a for a, b in zip(A, B)]
    q_m = [-v for v in ls[1:-1] if v < 0]
    q_p = [v for v in ls[1:-1] if v >= 0]
    heapify(q_m)
    heapify(q_p)
    sum_A = sum(A)
    sum_q_p = sum(q_p)
    to_remove = set()
    odd = len(q_p) % 2
    Ans = []
    ans = sum_A + sum_q_p - (min(q_p[0], q_m[0]) if odd else 0)
    for _ in range(Q):
        p, x, y = map(int, input().split())
        p -= 1
        v = y-x
        sum_A += x - A[p]
        if p==0 or p==2*N-1:
            ans += x - A[p]
            Ans.append(ans)
            A[p] = x
            continue
        A[p] = x
        odd ^= (ls[p] >= 0) ^ (v >= 0)
        if v >= 0:
            sum_q_p += v
        if ls[p] >= 0:
            sum_q_p -= ls[p]
        to_remove.add(ls[p])
        ls[p] = v
        if v >= 0:
            heappush(q_p, v)
        else:
            heappush(q_m, -v)
        ans = sum_q_p + sum_A
        if odd:
            while q_p[0] in to_remove:
                to_remove.remove(heappop(q_p))
            while -q_m[0] in to_remove:
                to_remove.remove(-heappop(q_m))
            ans -= min(q_p[0], q_m[0])
        Ans.append(ans)
    print("\n".join(map(str, Ans)))

main()
import math
import sys


if __name__ == '__main__':
    n = int(input())
    a_list = list(map(int, input().split()))

    max_comb = - sys.maxsize
    answer1 = -1
    answer2 = -1
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            if a_list[i] < a_list[j]:
                continue
            comb = math.factorial(a_list[i])/(math.factorial(a_list[j]) * math.factorial(a_list[i] - a_list[j]))

            if max_comb < comb:
                max_comb = comb
                answer1 = a_list[i]
                answer2 = a_list[j]

    print(str(answer1) + " " + str(answer2))

### FIXED CODE ###

import math
import sys


if __name__ == '__main__':
    n = int(input())
    a_list = list(map(int, input().split()))

    max_a = max(a_list)
    a_list.remove(max_a)

    min_diff = sys.maxsize
    answer1 = max_a
    answer2 = -1
    for i in range(n-1):
        diff = math.fabs(max_a/2 - a_list[i])
        if min_diff > diff:
            min_diff = diff
            answer2 = a_list[i]

    print(str(answer1) + " " + str(answer2))
A,B,C,D,E=map(int,input().split())
if A == 0:
  print(1)
elif B == 0:
  print(2)
elif C == 0:
  print(3)
elif D == 0:
  print(4)
else E == 0:
  print(5)


### FIXED CODE ###

A,B,C,D,E=map(int,input().split())

if A == 0:
    print(1)
elif B == 0:
    print(2)
elif C == 0:
    print(3)
elif D == 0:
    print(4)
else:
    print(5)
n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[0][i]==B:
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

n=int(input())
s=input()
b=0
r=0
for i in range(0,n):
  if s[i]=='B':
    b=b+1
  else:
    r=r+1
if r>b:
  print('Yes')
else:
  print('No')
s,t = input()
print(t+s)

### FIXED CODE ###

s = input().split()
print(s[1]+s[0])
import copy
N,K=list(map(int,input().split()))
a=list(map(int,input().split()))

num=0
a_sum=[0]
for i in range(N):
  num+=a[i]
  a_sum.append(num)
  

a_mat=[[0 for i in range(N)] for j in range(N)]
non_zero=[]
for i in range(N):
  for j in range(i,N):
    a_mat[i][j] = a_sum[j+1]-a_sum[i]
    non_zero.append([i,j])

a_mat2=copy.deepcopy(a_mat)

maxbit=1
while True:
  if a_sum[N]<2**maxbit and a_sum[N]>=2**(maxbit-1): 
    break
  else:
    maxbit+=1
maxnum=0
num_rest=int(N*(N+1)/2)
num_rest_now=int(N*(N+1)/2)
for bit in range(maxbit):
  non_zero2=[]
  for i, j in non_zero:
    if a_mat[i][j]&(2**(maxbit-bit-1)) == 0 and a_mat[i][j]!=0:
      num_rest_now-=1
      a_mat2[i][j]=0
    else:
      non_zero2.append([i,j])
  #print(non_zero)
  #print(a_mat)
  #print(num_rest_now)
  
  if num_rest_now >= K:
    maxnum+=2**(maxbit-bit-1)
    a_mat=copy.deepcopy(a_mat2)
    num_rest=num_rest_now
    non_zero=copy.deepcopy(non_zero2)
  else:
    a_mat2=copy.deepcopy(a_mat)
    num_rest_now=num_rest
    
  
  
print(maxnum)
    

### FIXED CODE ###

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

ave=sum(a)/N

mini=1000
argmin=-1
for i in range(N):
  if abs(ave-a[i])<mini:
    mini=abs(ave-a[i])
    argmin=i
    
print(argmin)