Harryxun/stf_run huggingface dataset:
x,y=map(int,input().split())
def cal(number,mod):
    m=mod-2
    mod2=""
    while m!=0:
        if m%2==0:
            mod2="0"+mod2
        else:
            mod2="1"+mod2
        m=m//2
    two=[]
    for i in range(len(mod2)):
        if mod2[len(mod2)-1-i]=="1":
            two.append(i)
    ret=1
    for i in two:
        v=i
        retsub=number
        while v>0:
            retsub=retsub**2
            retsub=retsub%mod
            v-=1
        ret*=retsub
    ret=ret%mod
    return ret
ans=0
M=10**9+7
if (2*x-y)%3==0:
    n=(x+y)//3
    r=(2*x-y)//3
    l=[]
    num=1
    for i in range(1,n+1):
        p=(num*i)%(M)
        l.append(p)
        num=p
    ans=(l[n-1]*cal(l[n-r-1],M)*cal(l[r-1],M))%M
print(ans)


### FIXED CODE ###

x,y=map(int,input().split())
def cal(number,mod):
    m=mod-2
    mod2=""
    while m!=0:
        if m%2==0:
            mod2="0"+mod2
        else:
            mod2="1"+mod2
        m=m//2
    two=[]
    for i in range(len(mod2)):
        if mod2[len(mod2)-1-i]=="1":
            two.append(i)
    ret=1
    for i in two:
        v=i
        retsub=number
        while v>0:
            retsub=retsub**2
            retsub=retsub%mod
            v-=1
        ret*=retsub
    ret=ret%mod
    return ret
ans=0
M=10**9+7
if (2*x-y)%3==0:
    n=(x+y)//3
    r=(2*x-y)//3
    if n<r or r<0:
        print(0)
        exit()
    l=[1]
    num=1
    for i in range(1,n+1):
        p=(num*i)%(M)
        l.append(p)
        num=p
    a=l[n]
    b=cal(l[n-r],M)
    c=cal(l[r],M)
    ans=(a*b*c)%M
print(ans)
from collections import Counter
import math
N = int(input())
x,y = map(int, input().split())
dis_list = [[x,y]]
for i in range(N-1):
	x , y = map(int,input().split())
	for j in range(len(dis_list)):
		x = abs(x- dis_list[j][0])
		y = abs(y-dis_list[j][1])
		dis_list.append([x,y])
dis_list = dis_list[1:1+N*(N-1)//2]
counter = Counter(map(tuple, dis_list))
print(N-counter.most_common()[0][1])


### FIXED CODE ###

import math
N = int(input())
s_dict = {}
cood_list=[]
ans = 0
for i in range(N):
    a,b = map(int,input().split())
    for j in range(len(cood_list)):
        p = a - cood_list[j][0]
        q = b - cood_list[j][1]
        if 0 > p:
            p = -p
            q = -q
        elif p == 0:
            q = abs(q)
        s = str(p)+","+str(q)
        if s not in s_dict:
            s_dict[s] = 1
        else:
            s_dict[s] += 1
    cood = [a,b]
    cood_list.append(cood)
if N != 1:
    print(N-max(s_dict.values()))
else:
    print(1)
a, b = input(""). split("")

seki = int(a) * int(b)
sa = int(a) - int(b)
wa = int(a) + int(b)

if wa >= seki and wa >= sa:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)


### FIXED CODE ###

a, b = input().split()

seki = int(a) * int(b)
sa = int(a) - int(b)
wa = int(a) + int(b)

if wa >= seki and wa >= sa:
    print(wa)
elif sa >= wa and sa >= seki:
    print(sa)
else:
    print(seki)
while True:
    h,w = map(int, input().split())
    if h==w==0:break
    for y in range(h):
        for x in range(w):
            if (x+y)%2==0:prnt('#',end='')
            else print('.',end='')
        print()
    print()

### FIXED CODE ###

while 1:
    h,w = map(int, input().split())
    if h==w==0:break
    for y in range(h):
        for x in range(w):
            if (x+y)%2==0:print('#',end='')
            if (x+y)%2==1: print('.',end='')
        print()
    print()
S = str(input())
Q = int(input())
t = 0

for _ in range(Q):
    A = list(input().split())
    if A[0] == "1":
        if t == 0:
            t = 1
        else:
            t = 0

    elif (A[1] == "1" and t == 0) or (A[1] == "2" and t == 1):
        S = A[2] + S
    else:
        S = S + A[2]

if t == 1:
    S = s[::-1]

print(S)

### FIXED CODE ###

from collections import deque

S = str(input())
Q = int(input())
t = 0

d = deque()
d.append(S)

for _ in range(Q):
    A = list(input().split())
    if A[0] == "1":
        if t == 0:
            t = 1
        else:
            t = 0

    elif (A[1] == "1" and t == 0) or (A[1] == "2" and t == 1):
        d.appendleft(A[2])
    else:
        d.append(A[2])

l = list(d)
ans = "".join(l)
if t == 1:
    ans = ans[::-1]
print(ans)
n = int(input())
string = int(input())

s1 = ""
s2 = ""

if(n % 2 == 0):
    for i st in enumerate(string):
        if i < n/2:
            s1 = s1 + st
        else:
            s2 = s2 + st

    if s1 == s2:
        print("Yes")
    else:
        print("No")
else:
    print("No")


### FIXED CODE ###

n = int(input())
string = str(input())

s1 = ""
s2 = ""

if(n % 2 == 0):
    for i, st in enumerate(string):
        if i < n/2:
            s1 = s1 + st
        else:
            s2 = s2 + st

    if s1 == s2:
        print("Yes")
    else:
        print("No")
else:
    print("No")
S

### FIXED CODE ###

str = input()
 
if (str[0] == str[1]) & (str[1] == str[2]):
  	print("No")
else:
  	print("Yes")
import math

def gcd(l):
    if len(l) == 0:
      return 0
    elif len(l) == 1:
      return l[0]
    elif len(l) == 2:
      return math.gcd(l[0], l[1])
    else:
      m = l[1:]
      return math.gcd(l[0],gcd(m))

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

if N == 2:
  print(max(A))
else:
  m = -1
  for i in range(N):
    L = [A[j] for j in range(0, i)]
    R = [A[j] for j in range(i+1, N)]
    m = max(m, math.gcd(gcd(L),gcd(R)))
  print(m)

### FIXED CODE ###


def gcd(a, b):
	while b > 0:
		a, b = b, a % b
	return a


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

if N == 2:
  print(max(A))
else:

  L = [0 for j in range(N+1)]
  R = [0 for j in range(N+1)]
  
  for j in range(N):
    L[j+1] = gcd(L[j], A[j])
  for j in reversed(range(N)):
    R[j] = gcd(R[j+1], A[j])

    m = -1
  for j in range(N):
    m = max(m, gcd(L[j], R[j+1]))
  print(m)
a = list(input())
b = list(input())
for x,y zip(a,b):
  print(x+y, end = "")

### FIXED CODE ###

a = list(input())
b = list(input())+[""]
for x,y in zip(a,b):
  print(x+y, end = "")
N = int(input())
dp = []
dp[0] = 0
i = 1
j = 1
for k in range(1,N):
  dp[k] = max(i+1*j,i*j+1)
  if max(i+1*j,i*j+1) == i+1*j:
    i += 1
  elif max(i+1*j,i*j+1) == i*j+1:
    j += 1
  if N == dp[k]:
    print(k)
    break


### FIXED CODE ###

N = int(input())
count = 0
for i in range(int(N**0.5),0,-1):
  if N % i == 0:
    count = i + (N//i)
    break
print(count-2)
sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
if x>0 and y>0:
    for k in range(y):
        print(u)
    for k in range(x+1):
        print(r)
    for k in range(y+1):
        print(d)
    for k in range(x+1):
        print(l)
    print(u)
    print(l)
    for k in range(y+1):
        print(u)
    for k in range(x+1):
        print(r)
    for k in range(y+1):
        print(d)
    print(l)

### FIXED CODE ###

sx,sy,tx,ty=map(int,input().split())
x=tx-sx
y=ty-sy
ans=""
for k in range(y):
    ans+="U"
for k in range(x+1):
    ans+="R"
for k in range(y+1):
    ans+="D"
for k in range(x+1):
    ans+="L"
ans+="U"
ans+="L"
for k in range(y+1):
    ans+="U"
for k in range(x+1):
    ans+="R"
for k in range(y+1):
    ans+="D"
for k in range(x):
    ans+="L"
print(ans)
k=int(input())
i=1
while(1):
  if(7*(10**i-1)%9k==0):
    break
  i++
print(i)

### FIXED CODE ###

K = int(input())

t = 7
for i in range(K):
    if t % K == 0:
        print(i + 1)
        break
    t = (t * 10 + 7) % K
else:
    print(-1)
def get_input():
    p = input().split()
    return int(p[0]),int(p[1])

while 1:
	a, b = get_input()
	print(a+b)
	if a == "":
		break



### FIXED CODE ###

import sys
for line in sys.stdin:
    if line == None or line == '/n':
        break
    a,b = line.split(" ")
    print( int(a) + int(b) )
from math import sqrt
N=int(input())
num=1
def checker(n):
    hoge=n
    if hoge>2:
        hoge=n-2
    count=0
    x=1
    for a in range(int(sqrt(hoge))):
        y=1
        for b in range(int(sqrt(hoge))):
            z=1
            for c in range(int(sqrt(hoge))):
                ans=x*x+y*y+z*z+x*y+x*z+z*y
                if ans==n:
                    count=count+1
                z=z+1
            y=y+1
        x=x+1
    return count
for i in range(N):
    print(checker(num)) 
    num=num+1

### FIXED CODE ###

N, M, K = map(int, input().split())
count=0
for i in range(M-N+1):
    ans=N%K
    if ans==0:
        count=count+1
    N=N+1
 
print(count)
A, B, C, X, Y = map(int, input().split())

price = min(A*X+B*Y, C*2*max(X, Y))

is_break = 0


if X >= Y:
    for a in range(X+1):
        if is_break:
            break
        for b in [0, Y]:
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
else:
    for a in [0, X]:
        if is_break:
            break
        for b in range(Y+1):
            if is_break:
                break
            for c in range(2 * max((X-a), (Y-b)), 2 * max(X-a, Y-b)+1):
                if price >= A*a+B*b+C*c:
                    price = A*a+B*b+C*c
                    is_break = 1
                    break
print(price)


### FIXED CODE ###

s = input()

ct = 0

for i in range(len(s)):
    if s[i] == 'o':
        ct += 1

print(700 + 100 * ct)
a = input()
Q = int(input())
Qy = [list(map(str,input().split())) for i in range(Q)]

for i in range(Q):
    if Qy[i][0] == "1":
        a = a[::-1]
    elif Qy[i][1] == "1":
        a = Qy[i][2] + a
    else :
        a += Qy[i][2]
print(a)

### FIXED CODE ###

S = input() 

if S.replace("A" ,"") == "" or S.replace("B", "") == "":
    print("No")
else:
    print("Yes")
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a = b:
    check = 1
    break
  else:
    a = a[len(a)] + a[0:len(a)]
    
if check = 0:
  print("No")
else:
  print("Yes")
    
  
  

### FIXED CODE ###

a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a == b:
    check = 1
    break
  else:
    a = a[len(a)-1] + a[0:len(a)-1]
    
if check == 0:
  print("No")
else:
  print("Yes")
a,b =int(input.split())
if a<=8 and b<=8:
  print('Yay!')
 else:
  print(':(')

### FIXED CODE ###

a,b =map(int, input().split()) 
if a<=8 and b<=8:
    print('Yay!')
else:
    print(':(')
a,b,c = map(int,input().split())
k = int(input())
lm = list(sorted([a,b,c]))

c = lm[2]
lm.remove(c)

for i in range(k):
    c = c * 2
    
print(lm[1] + lm[2] + c)

### FIXED CODE ###

a,b,c = map(int,input().split())
k = int(input())
lm = list(sorted([a,b,c]))

c = lm[2]
lm.remove(c)

for i in range(k):
    c = c * 2
    
print(lm[0] + lm[1] + c)
P=input()
Q=input()
R=input()
p=int(P)
q=int(Q)
r=int(R)
a=p+q
b=q+r
c=r+p

if a<=b:
    if a<=c:
        print(a)
    else:
        print(c)
elif b<a:
    if b<=c:
        print(b)
    else:
        print(c)


### FIXED CODE ###

p,q,r = map(int, input().split())
print(min(p+q,q+r,r+p))
rom collections import deque
import sys

n = int(sys.stdin.readline())
q = deque()

for i in range(n):
    command = sys.stdin.readline()[:-1]
    if command[0] == 'i':
        q.appendleft(command[7:])
    elif command[6] == ' ':
        try:
            q.remove(command[7:])
        except Exception as e:
            pass
    elif command[6] == 'F':
        q.popleft()
    else:
        q.pop()

print(' '.join(q))

### FIXED CODE ###

from collections import deque
import sys

n = int(sys.stdin.readline())
q = deque()

for i in range(n):
    command = sys.stdin.readline()[:-1]
    if command[0] == 'i':
        q.appendleft(command[7:])
    elif command[6] == ' ':
        try:
            q.remove(command[7:])
        except Exception as e:
            pass
    elif command[6] == 'F':
        q.popleft()
    else:
        q.pop()

print(' '.join(q))
from collections import Counter
n = int(input())
A = sorted(Counter(input().split()))
B = sorted(Counter(input().split()))
C = sorted(Counter(input().split()))
ans = ""
for key,value in A.items():
  ans.append(key*min(value,B[key],C[key]))
print(ans)

### FIXED CODE ###

from collections import Counter
n=int(input())
s=Counter(input())
for i in range(n-1):
    s&=Counter(input())
print("".join(sorted(s.elements())))
a_score, b_score = 0, 0
while(True):
  input_list = map(int, raw_input(), split())
  if len(input_list) == 1 and input_list[0] == 0:
    break
  elif len(input_list) == 1:
    print a_score, b_score
    a_score, b_score = 0, 0
  elif len(input_list) == 2:
    a, b = input_list
    if a > b:
      a_score += a + b
    elif b > a:
      b_score += a + b
    else:
      a_score += a
      b_score += b

### FIXED CODE ###


def solve():
  while(1):
    n = int(raw_input())
    if n == 0:
      break
    score_a, score_b = 0, 0
    while(n > 0):
      a, b = map(int, raw_input().split())
      if a > b:
        score_a += a + b
      elif b > a:
        score_b += a + b
      else:
        score_a += a
        score_b += b
      n -= 1
    print score_a, score_b

if __name__ == '__main__':
  solve()
def main():
  N, M = map(int,input().split())
  sc = list(list(input().split()) for _ in range(M))

  li = [""] * N

  for i in range(M):
    j = li[int(sc[i][0]) - 1]
    if j == "": li[int(sc[i][0]) - 1] = sc[i][1]
    elif j != sc[i][1]: return -1

  for i in range(N):
    if i == 0:
      if li[0] == "0" and N != 1: return -1
      if li[0] == "":
        if N == 1: li[0] = "0"
        elif: li[0] = "1"
    elif li[i] == "": li[i] = "0"

  return "".join(li)

print(main())

### FIXED CODE ###

def main():
  N, M = map(int,input().split())
  sc = list(list(input().split()) for _ in range(M))

  li = [""] * N

  for i in range(M):
    j = li[int(sc[i][0]) - 1]
    if j == "": li[int(sc[i][0]) - 1] = sc[i][1]
    elif j != sc[i][1]: return -1

  for i in range(N):
    if i == 0:
      if li[0] == "0" and N != 1: return -1
      if li[0] == "":
        if N == 1: li[0] = "0"
        else: li[0] = "1"
    elif li[i] == "": li[i] = "0"

  return "".join(li)

print(main())
String : ")
str2 = input("Please Enter the Second String : ")

concat1 = str1 + str2
print("The Final String After Python String Concatenation = ", concat1)

concat2 = str1 + ' ' + str2
print("The Final After String Concatenation with Space = ", concat2)

### FIXED CODE ###

A,B=input().split()
print(B+A)
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
def func(x):
    if x == 1:
        return 1
    else:
        return x + func(x - 1)


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

for i in range(1, 999):
    if func(i) - a == func(i + 1) - b:
        print(func(i) - a)
        break


### FIXED CODE ###

H = [1]
for i in range(2, 1000):
    H.append(H[-1] + i)

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

for i in range(998):
    if H[i] - a == H[i + 1] - b:
        print(H[i] - a)
        break
n=input()
print("Yes" if int(n)%sum(map(int,n)==0 else "No")

### FIXED CODE ###

n=input()
print("Yes" if int(n)%sum(map(int,n))==0 else "No")
if a<=9 and b<=9:
    print(a*b)
else:
    print(-1)

### FIXED CODE ###

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


if a<=9 and b<=9:
    print(a*b)
else:
    print(-1)
n, k = map(int,input().split())
s = input()
ha = []
owa = []
ju = 0
for i in range(len(s)) :
    if s[i] == "1" :
        if ju == 0 :
            ha.append(i)
            ju = 1
    else :
        if ju == 1 :
            owa.append(i - 1)
            ju = 0
if ha[0] != 0 :
    ha.insert(0,0)
    owa.insert(0,0)
owa.append(len(s)-1)
if len(ha) != len(owa) :
    ha.append(len(s) - 1)
#print(ha,owa)
dai = 0
for i in range(len(owa) - k) :
    dai = max(dai,owa[i+k] - ha[i] + 1)
if len(ha) > k :
    print(dai)
else :
    print(len(s))


### FIXED CODE ###

n, k = map(int,input().split())
s = input()
ha = []
owa = []
ju = 0
for i in range(len(s)) :
    if s[i] == "1" :
        if ju == 0 :
            ha.append(i)
            ju = 1
    else :
        if ju == 1 :
            owa.append(i - 1)
            ju = 0
if not ha :
    print(len(s))
else :
    if ha[0] != 0 :
        ha.insert(0,0)
        owa.insert(0,0)
    owa.append(len(s)-1)
    if len(ha) != len(owa) :
        ha.append(len(s) - 1)
    #print(ha,owa)
    dai = 0
    for i in range(len(owa) - k) :
        dai = max(dai,owa[i+k] - ha[i] + 1)
    if len(ha) > k :
        print(dai)
    else :
        print(len(s))
N,M - map(int, input())
gate_l = [[int(x) for x in input().split()] for _ in range(M)]

min_card = max(l[0] for l in gate_l)
max_card = min(l[1] for l in gate_l)

if max_card > min_card:
    print(max_card - min_card +1)
    
else:
    print(0)

### FIXED CODE ###

N,M = map(int, input().split())
gate_l = [[int(x) for x in input().split()] for _ in range(M)]

min_card = max(l[0] for l in gate_l)
max_card = min(l[1] for l in gate_l)

if max_card >= min_card:
    print(max_card - min_card +1)
    
else:
    print(0)
a,b = map(int, input(),split())
ans = max(a + b, 2*a-1, 2*b-1)
print(ans)

### FIXED CODE ###

a,b = map(int, input().split())
ans = max(a + b, 2*a-1, 2*b-1)
print(ans)
S = list(input())
T = list(input())
cnt = 0
for t in range(int(len(S))):
  if S[t] != T[t]:
    cnt++
print(cnt)

### FIXED CODE ###

S = list(input())
T = list(input())
cnt = 0
for t in range(0,int(len(S))):
  if S[t] != T[t]:
    cnt += 1
print(cnt)
k, x = mao(int, inout().split())
if 500*k < x: print("No")
else: print("Yes")
  

### FIXED CODE ###

k, x = map(int, input().split())
if 500*k < x: print("No")
else: print("Yes")
from math import factorial

n, k = map(int, input().split())
red = n - k
m = 10**9+7

def com_cal(p, q):
    return factorial(p) // (factorial(p - q) * factorial(q))

for i in range(1, k+1):
    com = com_cal(red + 1, i)
    div_num = com_cal(k - 1, i - 1)
    print((com * div_num)%m)


### FIXED CODE ###

from math import factorial

n, k = map(int, input().split())
red = n - k
m = 10**9+7

def com_cal(p, q):
    return factorial(p) // (factorial(p - q) * factorial(q))

for i in range(1, k+1):
    if red+1 < i:
        print(0)
        continue
    com = com_cal(red + 1, i)
    div_num = com_cal(k - 1, i - 1)
    print((com * div_num)%m)
max = 0
i = 0
j = 0
k = 0
n_max = 0

n_max = int(raw_input())
price = [1,2,3,4,5,6]
for i in range(n_max)
    if max <= price[j] - price[i]:
    print max

### FIXED CODE ###

import sys

n = int(raw_input())

min_R = int(raw_input())
nums = map(int, sys.stdin.readlines())

ans = -10**9

for num in nums:
    if num - min_R > ans:
        ans = num - min_R
    if num < min_R:
        min_R = num
        
print ans
s = input()
 
wea = ["Sunny", "Cloudy", "Rainy"]
 
print("{}".format( wea[(wea.index(s) + 1) % 3)] )

### FIXED CODE ###

s = input()
 
wea = ["Sunny", "Cloudy", "Rainy"]
 
print("{}".format(wea[(wea.index(s) + 1) % 3]))
N = int(input())
X = list(input())

def popcount(a):
    cnt = 0
    while True:
        y = bin(a).count("1")
        a %= y
        cnt += 1
        if a == 0:
            print(cnt)
            break

ans = 0
for i in range(len(X)):
    if X[i] == "1":
        X[i] = "0"
        Flag = True
    else:
        X[i] = "1"
        Flag = False
        
    x = "".join(X)
    n = int(x, 2)
    popcount(n)
            
    if Flag is True:
        X[i] = "1"
    else:
        X[i] = "0"

### FIXED CODE ###

def goes_to_zero(n):
    cnt = 0
    while(n > 0):
        n %= bin(n).count('1')
        cnt += 1
    return cnt

N = int(input())
X = input()

XC = X.count('1')
XI = int(X, 2)
XCP = XC + 1
XCM = XC - 1
XTP = XI % XCP
XTM = XI % XCM if XCM != 0 else 0

for i in range(N):
    if X[i] == "0":
        print(goes_to_zero((XTP + pow(2, N - 1 - i, XCP)) % XCP) + 1)
    else:
        if XCM == 0:
            print(0)
        else:
            print(goes_to_zero((XTM - pow(2,N - 1 - i, XCM)) % XCM) + 1)
a,b,c = map(int, raw_input().split())
lists = [a,b,c]
new_list = sorted(lists)
print new_lists[0], new_lists[1], new_lists[2]

### FIXED CODE ###

l = map(int, raw_input().split())
a, b, c = sorted(l)
print a, b, c
str1, str2 = input().split()
num1, num2 = map(int,input.split())
trim = input()

if trim == str1:
	num1 = num1 - 1
else:
  	num2 = num2 - 1

print("%d %d",%(num1, num2))


### FIXED CODE ###

str1, str2 = input().split()
num1, num2 = map(int,input().split())
trim = input()
 
if trim == str1:
	num1 = num1 - 1
else:
  	num2 = num2 - 1
 
print("%d %d"  %(num1, num2))
# -*- coding: utf-8 -*-

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

dp = [[-1 for k in range(N*(N+1)//2+1)] for n in range(1000+1)]

def generate_substring(a):
    for i in range(N):
        for j in range(i, N):
            yield a[i:j+1]

def find_max_and(i, k):

    if dp[i][k] >= 0:
        return dp[i][k];
    
    if i == N_SUBSTR:
        res = 0xFFFF if k == 0 else 0
    elif k == 0:
        res = find_max_and(i + 1, k)
    else:
        a = find_max_and(i + 1, k)
        b = find_max_and(i + 1, k - 1) & scores[i]
        
        res = b if a == 0xFFFF else max(a, b)

    dp[i][k] = res
    return res

scores = list(map(sum, generate_substring(a)))
N_SUBSTR = len(scores)
print(find_max_and(0, K))



### FIXED CODE ###

# -*- coding: utf-8 -*-
import statistics

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

def argmin(z):
    min_idx = 0
    min_val = 10000
    for k, v in enumerate(z):
        if min_val > v:
            min_idx = k
            min_val = v
    return min_idx, min_val

m = statistics.mean(a)
z = [abs(b - m) for b in a]

k, v = argmin(z)
print(k)
from math import gcd
from functools import reduce

def lcm(x, y):
    return x*y // gcd(x, y)

n = int(input())
nums = [int(input()) for _ in range(n)]
print(reduce(lcm, nums))

### FIXED CODE ###

from functools import reduce

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def lcm(x, y):
    return x*y // gcd(x, y)

n = int(input())
nums = [int(input()) for _ in range(n)]
print(reduce(lcm, nums))
ab,bc,ca = map(int,input().split())
print(ab * ac // 2)

### FIXED CODE ###

ab,bc,ca = map(int,input().split())
print(ab * bc // 2)
N , L= map(int,input().split())
lst = list()
lst2 = ''
for i in range(L):
    lst.append(input())
lst.sort()
#for k  in range(N):
#    for j in range(N-1):
#        if lst[j] > lst[j+1]:
#            lst[j],lst[j+1] = lst[j+1] ,lst[j]

for i in range(L):
    lst2 += lst[i]
print(lst2)


### FIXED CODE ###

N,L=map(int, input().split())
S=[]
for i in range(N):
    S.append(input())
S.sort()
result=''
for j in range(N):
    result+=S[j]     
print(result)
a,b=input().split()
a=int(a)
b=int(b[0]+b[1:])
print((a*b)//100)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=float(b)
b*=1000
b=int(b)
print((a*b)//1000)
N,M,V,P = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse= True)
#print(A)

ans = set()
i = 0
while(A[i] >= A[P-1]):
  ans.add(i)
  i += 1
#print(ans)

for i in range(P,N):
  if A[i]+M >= A[P-1]+((V-P+1)*M-(N-1-i)*M)//(i-(P-1)):
    ans.add(i)
#print(ans)

print(len(ans))


### FIXED CODE ###

N,M,V,P = map(int,input().split())
A = sorted(list(map(int,input().split())),reverse= True)

def check(i):
  if i <= P-1:
    return True
  vote = (V-1)*M
  vote -= (N-1-i)*M
  vote -= (P-1)*M
  if vote <= 0:
    return A[i]+M >= A[P-1]
  else:
    for j in range(i-1,P-1,-1):
      if A[j] > A[i]+M:
        return False
      v = min(A[i]+M-A[j],M,vote)
      vote -= v
      if vote <= 0:
        break
    if vote <= 0:
      return A[i]+M >= A[P-1]
    else:
      return A[i]+M >= A[P-1]+vote

ok = -1
ng = N
while(ok+1 < ng):
  md = (ok+ng)//2
  if check(md):
    ok = md
  else:
    ng = md
print(ok+1)
A,B,C = map(int, input().split())
print(max(A,B,C)*9+sum(A,B,C))


### FIXED CODE ###

A,B,C = map(int, input().split())
print(max(A,B,C)*9+A+B+C)
n = int(input())
b = list(map(int,input().split()))
a = [0] * n
if n==2:
    print(b[0]*2)
else:
    #c = d = 0
    a[0] = b[0]
    for i in range(n-1,-1,-1):
        if i == n-1:
            a[i] = b[i-1]
        elif i == 0:
            #a[0] = min(b[0],b[1])
        else:
            a[i] = min(b[i-1],b[i])
    print(sum(a))

### FIXED CODE ###

n = int(input())
b = list(map(int,input().split()))
a = [0] * n
if n==2:
    print(b[0]*2)
else:
    #c = d = 0
    a[0] = b[0]
    for i in range(n-1,-1,-1):
        if i == n-1:
            a[i] = b[i-1]
        elif i == 0:
            pass
            #a[0] = min(b[0],b[1])
        else:
            a[i] = min(b[i-1],b[i])
    print(sum(a))