Harryxun/stf_run huggingface dataset:
N=int(input())
S=list(input())
ks=S[int(input())+1]
for i in range(N):
  if S[i]!=ks:
    S[i]='*'
print(ks)

### FIXED CODE ###

N=int(input())
S=list(input())
ks=S[int(input())-1]
for i in range(N):
  if S[i]!=ks:
    S[i]='*'
print(''.join(S))
n,m=map(int,input().split())
p=[[]for _ in range(n)]
c=[0]*n
for i in range(m):
    x,y=map(int,input().split())
    p[x-1].append(y-1)
from functools import lru_cache
@lru_cache(maxsize=9*n)
def l(k):
    return max([l(i)for i in p[k]]+[0])+1
print(max([l(i)for i in range(n)])-1)

### FIXED CODE ###

n,m=map(int,input().split())
p=[[]for _ in range(n)]
c=[0]*n
import sys
sys.setrecursionlimit(10**6)
for i in range(m):
    x,y=map(int,input().split())
    p[x-1].append(y-1)
from functools import lru_cache
@lru_cache(maxsize=n)
def l(k):
    return max([l(i)for i in p[k]]+[0])+1
print(max([l(i)for i in range(n)])-1)
n,m = map(int,input().split())

a = [0]*n
a = [int(s) for s in input().split()]

a_half = [s//2 for s in a]
#print(a)

def check(x):
    while (all(c%2 == 1 for c in x)):
        if any(c%2 == 1 for c in x):
            return 0
        x /= 2
    
    return 1

def gcd(x,y):
    #print(x,y)
    if(x%y == 0):
        #print(y)
        return y
    else:
        return gcd(y,x%y)


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

if(check(a)== 1):
    x = a_half[0]
    for i in range(1,n):
        y = a_half[i]
        x = lcm(x,y)
    
    if((m//x)%2==0):
        print(int(m/x)//2)
    else:
        print((int(m/x)+1)//2)
else:
    print(0)
    
    
    


### FIXED CODE ###

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

a = [1]*n
#print(a)
a = [int(s) for s in input().split()]

a_half = [s//2 for s in a]
#print(a)

def check(x):
    while (all(c%2 == 0 for c in x)):
        x = [s//2 for s in x]
        if any(c%2 == 1 for c in x) and any(c%2 == 0 for c in x):
            return 0
        
    
    return 1

def gcd(x,y):
    #print(x,y)
    if(x%y == 0):
        #print(y)
        return y
    else:
        return gcd(y,x%y)


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

if(check(a)== 1):
    x = a_half[0]
    for i in range(1,n):
        y = a_half[i]
        x = lcm(x,y)
    if(x > m):
        print(0)
    else:
        res = int((m//x+1)//2)
        print(res)
else:
    print(0)
N,M = map(int,input().split(' '))
left = float('-inf')
right = float('inf')
for i in range(M):
  L,R = map(int,input().split(' '))
  if left <= L:
    left = L
  if R <= right:
    right = R
  if (right - left) < 0:
    print(0)
    exit()
print(right-left+1)

### FIXED CODE ###

A,B = map(int,input().split(' '))
if A >= 13:
  print(B)
elif 6 <= A < 13:
  print(int(B/2))
else:
  print(0)
N = int(input())
list = [0]*1001
for i in range(1,int(N**0.5)):  
    for j in range(1,int(N**0.5)):
        a = i*i + j*j + i*j
        for k in range(1,int(N**0.5)):
            a = i*i + j*j + k*k + i*j +j*k + i*k
            if a <= N:
                list[a] += 1
for i in range(1,N+1):
    print(list[i])

### FIXED CODE ###

N = int(input())
list = [0]*(N+1)
for i in range(1,100):  
    for j in range(1,100):
        a = i*i + j*j + i*j
        for k in range(1,100):
            a = i*i + j*j + k*k + i*j +j*k + i*k
            if a <= N:
                list[a] += 1
for i in range(1,N+1):
    print(list[i])
s = input()
K = int(input())
subs = []
for i in range(0, len(s)):
    for j in range(i+1, len(s)+1):
        subs.append(s[i:j])
subs = list(set(subs))
subs.sort()
print(subs[K-1])

### FIXED CODE ###

s = input()
K = int(input())
subs = []
for i in range(0, len(s)):
    for j in range(i+1, K+i+1 if i + K <= len(s) else len(s)+1):
        subs.append(s[i:j])
subs = list(set(subs))
subs.sort()
print(subs[K-1])
import math


n = int(input())
a = [int(x) for x in input().split()]
l = [[] for i in range(n)]

def gcd(p,q):
    while q != 0:
        p = min(p%q,-(p%q)+q)
        p,q = q,p
    return p


g = a[0]
for i in range(1,n):
    g = gcd(g,a[i])

if g != 1:
    print("not coprime")

else:
    def fur(x):
        k = [1 for i in range(x+1000)]
        k[0]=k[1]=0
        for i in range(2,x+1):
            for j in range(i-1,x//i):
                k[i+j*i] = 0
        return k

    t = fur(10**6)

    cnt = 0

    def soi(x):
        global t,cnt
        for i in range(2,int(math.sqrt(x))+1):
            if x%i==0:
                if t[i] == 1:
                    t[i] = 2
                if t[x//i] == 1:
                    t[x//i] = 2
                if t[i] == 2 or t[x//i] == 2:
                    cnt = 1
                    break
    
    for i in range(n):
        if cnt == 1:
            break
        else:
            soi(a[i])
    
    if cnt == 1:
        print("setwise coprime")
    
    else:
        print("pairwise coprime")

### FIXED CODE ###

(d,t,s) = map(int,input().split())
if d > t*s:
    print("No")
else:
    print("Yes")
a=list(input())
if a[2]==a[3] and a[4]==a[5]:
  print('Yes')
else:
  prin('No')


### FIXED CODE ###

a=list(input())
if a[2]==a[3] and a[4]==a[5]:
  print('Yes')
else:
  print('No')
S = input()
T = input()
lS = len(S)
lT = len(T)
C = []
for i in range(lS-lT):
    count = 0
    for j in range(lT):
        if S[i+j]!=T[j]:
            count += 1
    C.append(count)
print(min(C))           

### FIXED CODE ###

S = input()
T = input()
lS = len(S)
lT = len(T)
C = []
for i in range(lS-lT+1):
    count = 0
    for j in range(lT):
        if S[i+j]!=T[j]:
            count += 1
    C.append(count)
print(min(C))
n, x = map(int, input().split())
m = [int(input()) for _ in range(n)]
a = x - sum(m)
out = a//min(a)
print(out + n)

### FIXED CODE ###

n, x = map(int, input().split())
m = [int(input()) for _ in range(n)]
a = x - sum(m)
out = a//min(m)
print(out + n)
import math

N = int(input())
X = int(input())
m = {}
num = 0


for i in range(N):
  m[i] = int(input())
  X = X - m[i]
  num += 1
  print(num)
  print(X)

print(math.floor(X / min(m[i] for i in m) + num))


### FIXED CODE ###

import math

N, X = map(int, input().split())
m = {}
num = 0


for i in range(N):
  m[i] = int(input())
  X = X - m[i]
  num += 1

print(math.floor(X / min(m[i] for i in m) + num))
s=list(map(int,input()))
if (s[0]+s[1]+s[2]>=22):
  print(bust)
else:
  print(win)


### FIXED CODE ###

s=list(map(int,input().split()))
if (s[0]+s[1]+s[2]>=22):
  print("bust")
else:
  print("win")
import collections, scipy.special 
n, p = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n):
    a[i] %= 2
c = collections.Counter(a)
zero = c[0]
one = c[1]
ans = 0
if p == 0:
    s = 0
else:
    s = 1
for i in range(s, one + 1, 2):
    ans += 2 ** zero * scipy.special.comb(one, i, exact=True)

print(ans)

### FIXED CODE ###

import collections, scipy.misc 
n, p = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n):
    a[i] %= 2
c = collections.Counter(a)
zero = c[0]
one = c[1]
ans = 0
if p == 0:
    s = 0
else:
    s = 1
for i in range(s, one + 1, 2):
    ans += 2 ** zero * scipy.misc.comb(one, i, exact=True)

print(ans)
X,N=map(int,input().split())
p=list(map(int,input().split()))
for i in range(102):
    if i in p:
        p.remove(i)
    else:
        p.append(i)
for i in range(102-N):
    if abs(X-p[i])<abs(X-ans):
        ans=p[i]
print(ans)

### FIXED CODE ###

ans=0
X,N=map(int,input().split())
p=list(map(int,input().split()))
for i in range(102):
    if i in p:
        p.remove(i)
    else:
        p.append(i)
for i in range(102-N):
    if abs(X-p[i])<abs(X-ans):
        ans=p[i]
print(ans)
import math
while True:
    n = int(input())
    if n == 0:
        break
    score = [ int(i) for i in input().split(" ") ] 
    average = sum(score) / n
    print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / n ) 

### FIXED CODE ###

import math
while True:
    n = int(input())
    if n == 0:
        break
    s = [int(i) for i in input().split(" ")]
    m = sum(s) / n
    print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2 for x in s]) / n)))
S = input()
if set(S) == {'a', 'b', 'c'}:   
    print('Yes')                   
else:                             

### FIXED CODE ###

S = input()
if set(S) == {'a', 'b', 'c'}:
    print('Yes')
else:
    print('No')
N   =   int(input())
L   =   int(input())

s_list = [input() for _ in range(N)]
s_list.sort()

for ele in s_list: 
    print(ele, end = '')

### FIXED CODE ###

n, l = map(int, input().strip().split())
s_list = [input() for _ in range(n)]
s_list.sort()
 
for s in s_list:
    print(s, end='')
print()
S=input()
l=len(S)
def solve(s,h):
    if h==1:
        return 1
    elif h==2:
        if s[0]==s[1]:
            return 1
        else:
            return 2
    else:
        if s[h-1]==s[h-2]:
            return solve(s,h-3)+2
        else:
            return solve(s,h-1)+1
print(solve(S,l))
        

### FIXED CODE ###

S=input()
cnt=0
pre=''
tmp=''
for s in S:
    tmp+=s
    if tmp!=pre:
        pre=tmp
        tmp=''
        cnt+=1
print(cnt)
a, b = map(str, input().split())
if a == 'H' and b == 'H' or A == ' D' and b = = 'D':
    print('H')
else:
    print('D')

### FIXED CODE ###

import sys
a, b = map(str, input().split())
if (a, b) == ('H', 'H'):
    print('H')
    sys.exit()
if (a, b) == ('D', 'D'):
    print('H')
    sys.exit()
else:
    print('D')
N = int(input())
src = map(int,input().split())
asc = 0
ans = 1
for i in range(N-1):
    d = src[i+1] - src[i]
    if asc * d < 0:
        ans += 1
        asc = 0
    else:
        asc = d
print(ans)

### FIXED CODE ###

N = int(input())
src = list(map(int,input().split()))
asc = None
ans = 1
for i in range(N-1):
    d = src[i+1] - src[i]
    if d == 0: continue
    if asc is None:
        asc = d > 0
    elif (asc and d < 0) or (not asc and d > 0):
        ans += 1
        asc = None
print(ans)
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
  
n = int(input())
arr = list(map(int,input().split(" ")))
list.sort(arr)

memoa = [None for i in range(n)]
memoa[0] = arr[0]
memob = [None for i in range(n)]
memob[0] = arr[-1]
for i in range(1,n):
  memoa[i] = gcd(memoa[i-1],arr[i])
  memob[i] = gcd(memob[i-1],arr[i])

m = 0
for i in range(len(arr)):
  if i is 0:
    ans = memob[n-2]
  elif i is n-1:
    ans = memoa[n-2]
  else:
    ans = gcd(memoa[i-1],memob[n-i-2])
      
  m = max(m, ans)
print(m)

### FIXED CODE ###

l = list(map(int,input().split(" ")))
A = l[0]
B = l[1]
T = l[2]

print((T//A)*B)
# -*- coding: utf-8 -*-
import sys

def maybe_check(A,n):
    maybe_list = []
    for i in range(1, n+1):
        left = abs(i - n)
        right = (n -1 )- left
        maybe_list.append(abs(left - right))

    pattern =  len(set([x for x in maybe_list if maybe_list.count(x) != 1]))

    for i in A:
        if i in maybe_list:
            maybe_list.remove(i)
        else:
            return 0

    return (2 ** pattern) % div


args = sys.argv
n = int(args[1])
A = map(int,args[2:])
div = 10 ** 9 + 7
print maybe_check(A, n)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import Counter

def maybe_check(n,A):
    try:
        if n <= 0 or n > 100000:
            raise

        div = 1000000007
        maybe_list = [abs(abs(i - n) - ((n -1 ) - abs(i - n))) for i in range(1, n+1)]
        maybe_list.sort()
        A.sort()
        if A !=  maybe_list:
            raise

        pattern = len([num for num,count in Counter(maybe_list).items() if count != 1])
        return (2 ** pattern) % div

    except:
        return 0


_n = int(raw_input())
_A = map(int,raw_input().split())

print maybe_check(_n,_A)
n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

norm()

### FIXED CODE ###

import math

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

print(sum(map(lambda v: math.fabs(v[0] - v[1]), zip(x, y))))
print(sum(map(lambda v: math.fabs((v[0] - v[1]) ** 2), zip(x, y))) ** (1/2))
print(sum(map(lambda v: math.fabs((v[0] - v[1]) ** 3), zip(x, y))) ** (1/3))
print(max(map(lambda v: math.fabs(v[0] - v[1]), zip(x, y))))
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from collections import deque
import sys


def input(): return sys.stdin.readline()[:-1]

n = int(input())
data = [list(map(int, list(input()))) for i in range(n)]
fordfs = [[] for i in range(n)]
for i in range(n):
    for j in range(n):
        if data[i][j] == 1:
            fordfs[i].append(j)

def bfs():
    V = [-1]*n
    V[0] = 0
    que = deque()
    que.append(0)
    while que:
        now = que.popleft()
        nowv = V[now]
        for ne in fordfs[now]:
            if nowv == V[ne]:
                print(-1)
                exit()
            elif V[ne] == -1:
                V[ne] = (nowv+1) % 2
                que.append(ne)

bfs()
# print(data)
G = csgraph_from_dense(data)
d = floyd_warshall(G)
d.tolist()
M = 0
for i in d:
    M = max(M, max(i))
M = int(M)
print(M+1)


### FIXED CODE ###

#!/usr/bin/env python3
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from collections import deque
import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)
def solve():
    n=int(input())
    data=[list(map(int,list(input()))) for i in range(n)]
    fordfs=[[] for i in range(n)]
    for i in range(n):
        for j in range(n):
            if data[i][j]==1:
                fordfs[i].append(j)

    def dfs():
        V=[-1]*n
        V[0]=0
        que=deque()
        que.append(0)
        while que:
            now=que.popleft()
            nowv=V[now]
            for ne in fordfs[now]:
                if nowv==V[ne]:
                    print(-1)
                    exit()
                elif V[ne]==-1:
                    V[ne]=(nowv+1)%2
                    que.append(ne)
    
    dfs()
    # print(data)
    G=csgraph_from_dense(data)
    d = floyd_warshall(G)
    d.tolist()
    M=0
    for i in d:
        M=max(M,max(i))
    M=int(M)
    print(M+1)
    return



def main():

    solve()
    return
if __name__ == '__main__':
    main()
x , n= map(int,input().split())
p = list(map(int,input().split()))
ans = []
if n == 0:
    print(x)
else:
    for i in range(1,101):
        if i in p:
            pass
        else:
            ans.append(i)
    sa = []
    for i in range(0,len(ans)):
        sa.append(abs(ans[i]-x))
    MIN=min(sa)
    for i in range(n):
        if MIN == abs(ans[i]-x):
            print(ans[i])

### FIXED CODE ###

x , n= map(int,input().split())
p = list(map(int,input().split()))
ans = []
if n == 0:
    print(x)
else:
    for i in range(-10,102):
        if i in p:
            pass
        else:
            ans.append(i)
    sa = []
    for i in range(len(ans)):
        sa.append(abs(ans[i]-x))
    MIN=min(sa)
    for i in range(len(ans)):
        if MIN == abs(ans[i]-x):
            print(ans[i])
            break
n,m = map(int,raw_input().split())

arr = []
for i in range(n):
	arr.append(map(int,raw_input().split()))


ans = float('-inf')

def check(k,o,f,p,i):
	global ans,m,n
	if i < n and p < m:
		check(k+arr[i][0],o+arr[i][1],f+arr[i][2],p+1,i+1)

	if i < n:
		check(k,o,f,p,i+1)

	if p == m:
		ans = max(ans,abs(k)+abs(o)+abs(f))


check(0,0,0,0,0)

print ans

### FIXED CODE ###

n,m = map(int,raw_input().split())

arr = []

for i in range(n):
	arr.append(map(int,raw_input().split()))

v = [[1,1,1],[1,1,-1],[1,-1,-1],[1,-1,1],[-1,-1,-1],[-1,1,1],[-1,1,-1],[-1,-1,1]]

ans = 0

for i in range(8):
	tmp = []
	for j in range(n):
		tmp.append(arr[j][0] * v[i][0] + arr[j][1] * v[i][1] + arr[j][2] * v[i][2])

	tmp.sort()
	ans = max(ans,sum(tmp[n-m:]))

print ans
Num,K=map(int,input().split())
L=[[]for i in range(Num+1)]
for i in range(Num):
    t,d=map(int,input().split())
    L[t].append(d)
for i in range(1,Num+1):
    L[i].sort(reverse=True)

M=[]
m=[]
for i in range(1,Num+1):
    if len(L[i])>=1:
        M.append(L[i][0])
        if len(L[i])>=2:
            for j in range(1,len(L[i])):
                m.append(L[i][j])
M.sort(reverse=True)
m.sort(reverse=True)
MM=[0]
for i in range(len(M)):
    MM.append(MM[-1]+M[i])
mm=[0]
for i in range(len(m)):
    mm.append(mm[-1]+m[i])
#print(MM)
#print(mm)
ANS=0

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for i in range(len(M)+1):
    ANS=max(i*i+MM[i]+mm[min(len(mm)-1,K-i)],ANS)
    #print(ANS,i)
print(ANS)

### FIXED CODE ###

Num,K=map(int,input().split())
L=[[]for i in range(Num+1)]
for i in range(Num):
    t,d=map(int,input().split())
    L[t].append(d)
for i in range(1,Num+1):
    L[i].sort(reverse=True)

M=[]
m=[]
for i in range(1,Num+1):
    if len(L[i])>=1:
        M.append(L[i][0])
        if len(L[i])>=2:
            for j in range(1,len(L[i])):
                m.append(L[i][j])
M.sort(reverse=True)
m.sort(reverse=True)
MM=[0]
for i in range(len(M)):
    MM.append(MM[-1]+M[i])
mm=[0]
for i in range(len(m)):
    mm.append(mm[-1]+m[i])
#print(MM)
#print(mm)
ANS=0

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for i in range(1,min(K,len(M))+1):
    ANS=max(i*i+MM[i]+mm[min(len(mm)-1,K-i)],ANS)
    #print(ANS,i)
print(ANS)
n,m = map(int, input().split())
d = {}
ans = 0
for _ in range(n):
  a,b = map(int, input().split())
  if a in d:
    d[a] += b
  else:
    d[a] = b

d = sorted(d.items(), key= lambda x: x[0])

for i in range(n):
  if m >= d[i][1]:
    ans += d[i][0] * d[i][1]
    m -= d[i][1]
  else:
    ans += d[i][0] * m
    break
print(ans)

### FIXED CODE ###

n,m = map(int, input().split())
d = {}
ans = 0
for _ in range(n):
  a,b = map(int, input().split())
  if a in d:
    d[a] += b
  else:
    d[a] = b

d = sorted(d.items(), key= lambda x: x[0])

for i in range(len(d)):
  if m >= d[i][1]:
    ans += d[i][0] * d[i][1]
    m -= d[i][1]
  else:
    ans += d[i][0] * m
    break
print(ans)
n,m = list(map(int, input().split()))

print ((n-1)*(m-1)

### FIXED CODE ###

n,m = list(map(int, input().split()))
 
print ((n-1)*(m-1))
from math import *
a,b=[int(i) for i in input().split()]
#def lcm(x,y):
    #return (x*y) // math.gcd(x,y)

  
  
z= (a*b)/math.gcd(a,b)
print(int(z))

### FIXED CODE ###

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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
def lcm(a, b):
	return a * b // gcd (a, b)
  
print(lcm(A,B))
n = int(input())
alist = [str(input()) for i in range(n)]
for i in range(n):
  for j in range(i+1,n):
    if alist[i] == alist[j]:
      print("No")
      exit()
for i in range(n):
  if all(alist[i][-1]==alist[i+1][0]):
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n = int(input())
alist = [input() for i in range(n)]
 
if len(set(alist))==n:
  if all(alist[i][-1]==alist[i+1][0] for i in range(n-1)):
    print("Yes")
    exit()
print("No")
import numpy as np

A,S= map(str,input().split())
A = int(A)

if(A>=3200):
    print(S)
else:
    print("red")


### FIXED CODE ###

import numpy as np

A = input()
A = int(A)
S = input()
S = str(S)

if(A>=3200):
    print(S)
else:
    print("red")
s=input()
s[1]=a
s[2]=b
c = a*b
if c%2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a, b= (int(i) for i in input().split())  
c = a*b
if c%2 == 0:
    print("Even")
else:
    print("Odd")
# 拡張ユークリッド互除法
# ax + by = gcd(a,b)の最小整数解を返す
def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)


# mを法とするaの乗法的逆元
def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

def lcm(num1, num2): 
    if(num1>num2): 
        num = num1 
        den = num2 
    else: 
        num = num2 
        den = num1 
    rem = num % den 
    while(rem != 0): 
        num = den 
        den = rem 
        rem = num % den 
    gcd = den 
    lcm = int(int(num1 * num2)/int(gcd)) 
    return lcm 


MOD = 10**9+7

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

s = sum(modinv(a,MOD) for a in A)%MOD


m = A[0]
for a in A:
    m = lcm(m,a)

s *= m
print(s%MOD)


### FIXED CODE ###

from collections import Counter, defaultdict
# 拡張ユークリッド互除法
# ax + by = gcd(a,b)の最小整数解を返す
def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)


# mを法とするaの乗法的逆元
def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


# 素因数分解
def prime_factors(n):
    i = 2
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            yield i
    if n > 1:
        yield n

# mを法とするときのa^n
def modpow(a,n,m):
    res = 1
    t = a
    while n:
        if n%2:
            res = (res*t)%m
        t = (t*t)%m
        n //= 2
    return res

def lcm_mod(nums, mod):
    p = defaultdict(int)
    for n in nums:
        c = Counter(prime_factors(n))
        for v,cnt in c.items():
            p[v] = max(p[v],cnt)

    res = 1
    for v,cnt in p.items():
        res *= modpow(v,cnt,mod)
        res %= mod
    return res


MOD = 10**9+7

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

s = sum(modinv(a,MOD) for a in A)%MOD

s *= lcm_mod(A, MOD)
print(s%MOD)
n = int(input())
l =[]
for i in range(n):
    l.append(int(input()))
l = sorted(l)
 
for i in range(n-1):
    ave = (l[0] + l[1])/2
    l[0:2] = []
    l.insert(0,ave)
    
print(l[0])

### FIXED CODE ###

n = int(input())
l =list(map(int,input().split()))
l = sorted(l)
 
for i in range(n-1):
    ave = (l[0] + l[1])/2
    l[0:2] = []
    l.insert(0,ave)
    
print(l[0])
x,y,z = = map(int, input(),split())
print(X,Z,Y)

### FIXED CODE ###

a, b, c = map(int, input().split())
print(c, a, b)
N = int(input())
A = list(map(int, input().split()))

A = A.sort(reverse=True)

ans = 0
for i in range(len(A)):
    if i % 2 == 0:
        ans += A[i]
    elif i % 2 == 1:
        ans += -A[i]

print(ans)

### FIXED CODE ###

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

A.sort(reverse=True)

ans = 0
for i in range(N):
    if i % 2 == 0:
        ans += A[i]
    if i % 2 == 1:
        ans -= A[i]

print(ans)
n,k=map(int,input().split())
A = list(map(int, input().split()))
r = max(A)
l = 0
while l+1<r:
  mid=(l+r)//2
  if sum([a-1]//mid for a in A)>k:
    l=mid
  else:
    r = mid
print(r)


### FIXED CODE ###

n,k=map(int,input().split())
A = list(map(int, input().split()))
r = max(A)
l = 0
while l+1<r:
  mid=(l+r)//2
  if sum([(a-1)//mid for a in A])>k:
    l=mid
  else:
    r = mid
print(r)
coding: utf-8

def selectionSort(A, N):
	count = 0
	for i in xrange(N):
		minj = i
		for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		if minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	return count

def main():
	N = input()
	A = map(int, raw_input().split())
	print selectionSort(A, 6)
	print ' '.join(map(str, A))

if __name__ == '__main__':
	

### FIXED CODE ###

# coding: utf-8

def selectionSort(A, N):
	A = A[:]
	count = 0
	for i in xrange(N):
		minj = i
		for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		if minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	return A, count

def main():
	N = input()
	A = map(int, raw_input().split())
	sorted_, count = selectionSort(A, N)
	print ' '.join(map(str, sorted_))
	print count

if __name__ == '__main__':
	main()
a,b = map(int, input().split())
print(6-a-b)

### FIXED CODE ###

a= int(input())
b= int(input())
print(6-a-b)
n=int(input())
ans=0
b=380000
for i in range(n):
  x,u=input().split()
  if u=="JPY":
    ans+=int(x)
  else:
    ans+=int(x)*b
print(ans)

### FIXED CODE ###

n,ans=int(input()),0
for i in range(n):
  a,b=input().split();a=float(a)
  if b=="JPY":ans+=a
  else:ans+=a*380000
print(ans)