Harryxun/stf_run huggingface dataset:
n,k=map(int,input().split())
A=sorted(list(map(int,input().split())) , key=abs , reverse=1)
import bisect as bi
# print(A)
# import numpy as np
# G=np.prod(A[:k])
def seki(A,mod=10**9+7):
    now=1
    for i in A:
        i=abs(i)
        if i>0 : now*=i
        # if i<0 : now*=i
        if i==0 :return 0
        if now>0 : now%=mod
    return now

CH=A[:k]
NO=A[k:]
# G=seki(A[:k])

mod=10**9+7
# if G>=0 : print(G%mod) ; exit()
if sum([A[i]>0 for i in range(n)])==0 and k%2==1:
  print((-seki(A[n-k:]))%mod) ;exit()
if n==k and len(A[bi.bisect_left(A,-1):])%2==1 :
    print((-seki(A))%mod) ;exit()
if sum([i<0 for i in A[:k]])%2==0 :
    print(seki(A[:k])%mod) ; exit()
if 0 in CH:
    print(0);exit()
  
# done=0 ; done2=0
# # ch=-73267983297 ; ch2=-9263498381621
# 
# for i in range(k-1,-1,-1):
#     if A[i]<0 and done==0:
#         for j in range(i+1,n):
#             if A[j]>=0: 
#                 # ch=G*A[j]//A[i]
#                 x1=A[j] ; y1=A[i]
#                 done=1
#                 break
#     if A[i]>0 and done2==0:
#         for j in range(i+1,n):
#             if A[j]<=0: 
#                 # ch2=G*A[j]//A[i]
#                 x2=A[j] ; y2=A[i]
#                 done2=1
#                 break
# #     if done==1 and done2==1 : break
# 
# G=seki(A[:k])
# G=-G
# if done and done2 :
#     if x1 * y2 > x2 * y1 :
#         print((G*x1//y1)%mod)
#     else:
#         print((G*x2//y2)%mod)
# elif done==1:
#     print((G*x1//y1)%mod)
# elif done2==1:
#     print((G*x2//y2)%mod)
        

done=0 ; done2=0
muri,muri2=0,0

# x1,x2,y1,y2=0,0,0,0
if sum([i<0 for i in NO])==n-k : #NO全部-
    muri=1
if sum([i<0 for i in CH])==k : #CH全部-
    muri2=1
if sum([i<0 for i in NO])==0: #-を入れられない
    muri2=1
    
if muri==0:
    y1= [i for i in CH if i<0][-1]
    x1= [i for i in NO if i>0][0]
    done=1
if muri2==0:
    y2= [i for i in CH if i>0][-1]
    x2= [i for i in NO if i<0][0]
    done2=1

if done and done2:
    if x1 * y2 > x2 * y1 :
        print((-seki(CH)*x1//y1)%mod)
    else:
        print((-seki(CH)*x2//y2)%mod)
elif muri:
    print((-seki(CH)*x2//y2)%mod)
else:
    print((-seki(CH)*x1//y1)%mod)


### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
mod=10**9+7
ans=1

if K%2==1 and A[-1]<0:
    for i in range(K):
        ans=ans*A[N-(i+1)]%mod
    print(ans)
    exit()

l=0
r=N-1
if K%2==1:
    ans=ans*A[r]
    r-=1

for _ in range(K//2):
    ml=A[l]*A[l+1]
    mr=A[r]*A[r-1]
    if ml>mr:
        ans=ans*ml%mod
        l+=2
    else:
        ans=ans*mr%mod
        r-=2

print(ans)
n,k=map(int,input().split())
s[0]*10**5
for i in range(n):
  a,b=map(int,input().split())
  s[a-1]+=b
i=0
while k>0:
  k-=s[i]
  i+=1
print(i)

### FIXED CODE ###

n,k=map(int,input().split())
s=[0]*10**5
for i in range(n):
    a,b=map(int,input().split())
    s[a-1]+=b
i=0
while k>0:
    k-=s[i]
    i+=1
print(i)
wether = ['Sunny','Cloudy','Rainy']
S = input()

if S == wether[0]:
  print(wether[1])
elif S == wether[1]:
  print(wether[2])
else:
  print(wether[3])


### FIXED CODE ###

wether = ['Sunny','Cloudy','Rainy']
S = input()

if S == wether[0]:
  print(wether[1])
elif S == wether[1]:
  print(wether[2])
else:
  print(wether[0])
import math
import collections

n = int(input())

if n == 1:
    print("0")
    exit()

ans = 0

factor = []
tmp = n
for i in range(2 , int(-(-n**0.5//1))+1):
    if tmp % i == 0:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp //= i
        factor.append([i , cnt])

if tmp != 1:
    factor.append([tmp , 1])
if factor == []:
    factor.append([n , 1])
        
s = collections.Counter(factor)


s = list(s.values())

for i in s:
    j = 1
    while True:
        i -= j
        if i < 0:
            break
        j += 1
        ans += 1

print(ans)

### FIXED CODE ###

n = int(input())

if n == 1:
    print("0")
    exit()

ans = 0

factor = []
tmp = n
for i in range(2 , int(-(-n**0.5//1))+1):
    if tmp % i == 0:
        cnt = 0
        while tmp % i == 0:
            cnt += 1
            tmp //= i
        factor.append(cnt)

if tmp != 1:
    factor.append(1)
if factor == []:
    factor.append(1)

for i in factor:
    j = 1
    while True:
        i -= j
        if i < 0:
            break
        j += 1
        ans += 1

print(ans)
n,s=input().split()

### FIXED CODE ###

n = int(input())
s = input()
if n % 2:
    print("No")
    exit()
half = s[0:n // 2]
print("Yes" if s == half + half else "No")
import itertools
iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    for i in range( 1 , min(iM // iN + 1,int(iM ** 0.5)+1) ):
        if iM % i == 0:
            aRet.append( i )
    print( aRet[-1] )


### FIXED CODE ###

iN,iM = [int(_) for _ in input().split()]

if iM % iN == 0:
    print(iM // iN)
else:
    aRet = []
    for i in range(1,iM//iN + 1):
        if iM % i == 0:
            aRet.append(i)
    print(aRet[-1])
h,w = map(int, input().split())
s = [list(input() for i in range(h))]
t = s.copy()
 
 
number = []
cnt = 0
 
for i in range(h) :
  if 1 <= i and i <= h-2 :
    for j in range(w) :
      if j >= 1 and j < w-1 :
        number = [s[i-1][j-1],s[i-1][j],s[i-1][j+1],s[i][j-1],s[i][j+1],s[i+1][j-1],s[i+1][j],s[i+1][j+1]]
        cnt = number.count('#')
        t[i][j] = cnt
        
      elif j == 0 :
        number = [s[i-1][0],s[i+1][0],s[i-1][1],s[i][1],s[i+1][1]]
        cnt = number.count('#')
        t[i][0] = cnt
      
      elif j == w-1 :
        number = [s[i-1][w-1],s[i+1][w-1],s[i-1][w-2],s[i][w-2],s[i+1][w-2]]
        cnt = number.count('#')
        t[i][w-1] = cnt       
  
  elif i == 0 :
    for j in range(w) :
      if 1 <= j and j <= w-2 :
        number = [s[0][j-1],s[0][j+1],s[1][j-1],s[1][j],s[1][j+1]]
        cnt = number.count('#') 
        t[0][j] = cnt
      
      elif j == 0 :
        number = [s[0][1],s[1][0],s[1][1]]
        cnt = number.count('#') 
        t[0][0] = cnt
        
      elif j == w-1 :
        number = [s[0][w-2],s[1][w-2],s[1][w-1]]
        cnt = number.count('#') 
        t[0][w-1] = cnt        
  
  elif i == h-1 :
    for j in range(w) :
      if 1 <= j and j <= w-2 :
        number = [s[h-1][j-1],s[h-1][j+1],s[h-2][j-1],s[h-2][j],s[h-2][j+1]]
        cnt = number.count('#')
        t[h-1][j] = cnt
                
      elif j == 0 :
        number = [s[h-1][1],s[h-2][1],s[h-2][0]]
        cnt = number.count('#') 
        t[h-1][0] = cnt
        
      elif j == w-1 :
        number = [s[h-2][w-1],s[h-1][w-2],s[h-2][w-2]]
        cnt = number.count('#') 
        t[h-1][w-1] = cnt
 
for i in range(h):
  for j in range(w):
    if s[i][j] == '#':
      t[i][j] = '#'
    
  
a0 = map(str,t[0])
a1 = map(str,t[1])
a2 = map(str,t[2])
print(''.join(a0))
print(''.join(a1))
print(''.join(a2))

### FIXED CODE ###

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

if a==b:
  print(c)
elif a==c:
  print(b)
elif b==c:
  print(a)
def can_rotate(text):
    lines = text.split("\n")
    return lines[0] == lines[1][::-1]

text = raw_input()

if can_rotate(text):
    print("OK")
else:
    print("NO")

### FIXED CODE ###

text1 = input()
text2 = input()

if text1 == text2[::-1]:
    print("YES")
else:
    print("NO")
H, W = tuple(map(int, input().split()))
s = [input() for _ in range(H)]
def f(q, h):
    if len(q) == 0:
        return float('inf')
    i, j, k = q[0]
    if i == H - 1 and j == W - 1:
        return k
    a = [(u, v)
         for u, v in ((i + 1, j), (i, j + 1), (i - 1, j), (i, j - 1))
         if 0 <= u < H and 0 <= v < W and s[u][v] == '.' and (u, v) not in h]
    _q = q[1:] + [(u, v, k + 1) for u, v in a]
    _h = h | set(a)
    return f(_q, _h)
print(max(-1, sum(t.count('.') for t in s) - f([(0, 0, 0)], {(0, 0)}) - 1))


### FIXED CODE ###

H, W = tuple(map(int, input().split()))
s = [input() for _ in range(H)]
q = [(0, 0, 0)]
h = {(0, 0)}
opt = float('inf')
while q:
    i, j, k = q.pop(0)
    if i == H - 1 and j == W - 1:
        opt = k
        break
    a = [(u, v)
         for u, v in ((i + 1, j), (i, j + 1), (i - 1, j), (i, j - 1))
         if 0 <= u < H and 0 <= v < W and s[u][v] == '.' and (u, v) not in h]
    q += [(u, v, k + 1) for u, v in a]
    h |= set(a)
print(max(-1, sum(t.count('.') for t in s) - opt - 1))
N,K = map(int,input().split())
 
s = int( (N*(N+1)*(N+2))/6 - (K*(K-1)*(3N-2K+4))/6 + N-K+2 )

print(s%(10**9 + 7))

### FIXED CODE ###

R = float(input())
print(3.14159265*2*R)
N= int(input())
Sl = input()
K= int(input())
S=list(Sl)

for i in range(N):
 if S[i] != S[K-1]:
   S[i] = '*'
Snew = "".join(S)
print(Snew)

### FIXED CODE ###

A,B,C= list(map(int,input().strip().split(" ")))
if A < C< B:
 print('Yes')
elif B < C < A:
 print('Yes')
else:
 print('No')
s=input();a=s[0]+s[-1];print('error' if a>9 else a)

### FIXED CODE ###

s=input();a=int(s[0])+int(s[-1]);print('error' if a>9 else a)
n, m = input().split()
n = int(n)
m = int(m)
c=0
for i in range(n):
  c += a[i]
v = c/(4*m)
a = list(map(int, input().split()))
a.sort(reverse = True)
if a[m-1] < v:
  print('No')
else:
  print('Yes')


### FIXED CODE ###

n, m = input().split()
n = int(n)
m = int(m)
c=0

a = list(map(int, input().split()))
for i in range(n):
  c += a[i]
v = c/(4*m)
a.sort(reverse = True)
if a[m-1] < v:
  print('No')
else:
  print('Yes')
a,b,c,d,e,f=map(int,input().split())
l=[-1]
ans=[]
v=f//(100*a)
m=int(f*e/100)
for i in range(int(v+1)):
  w=(f-100*i)//(100*b)+1
  for j in range(w):
    for k in range(m//c):
      flag=0
      for n in range((m-k*c)//d,0,-1):
        X=100*a*i+100*b*j
        Y=k*c+n*d
        if flag==1:
          break
        elif X+Y==0 or X+Y>f:
          continue
        else:
          p=100*Y/(X+Y)
          mp=100*e/(100+e)
          if p<=mp:
            if p>max(l):
              l.append(p)
              ans.append([X+Y,Y])
              flag=1
            else:
              continue
          else:
            continue
print(ans[-1][0],ans[-1][1])

### FIXED CODE ###

a,b,c,d,e,f=map(int,input().split())
x=set()
y=set()
m=f//(100*a)
for i in range(m+1):
  for j in range(f//(100*b)+1):
    x1=i*100*a+j*100*b
    if x1<=f:
      x.add(x1)

m=int(f*(e/100))
for i in range(0,m+1,c):
  for j in range(0,m-i+1,d):
     y.add(i+j)
x.remove(0) 
z=[-1]
ans=[]
for i in x:
  for j in y:
    if i+j<=f and j*100/(i+j)<=e*100/(100+e):
      if j*100/(i+j)>max(z):
        z.append(j*100/(i+j))
        ans.append([i+j,j])
        
print(ans[-1][0],ans[-1][1])
class B():
    def __init__(self,N):
        self.N = N
        self.node = [0]*(self.N+1)
        self.cnt = 0

    def add(self,x): # 要素 x を追加
        self.cnt += 1
        while x <= self.N:
            self.node[x] += 1
            x += x & -x

    def delete(self,x): # 要素 x を削除
        self.cnt -= 1
        while x <= self.N:
            self.node[x] -= 1
            x += x & -x

    def count(self,x): # x以下の要素数
        tmp = 0
        while x > 0:
            tmp += self.node[x]
            x -= x & -x
        return tmp

    def get_max(self):
        return self.get_ith(self.cnt)

    def get_ith(self,i): # i 番目に小さい要素を取得
        NG = -1
        OK = self.N+1
        while OK-NG > 1:
            mid = (OK+NG)//2
            #print(OK,NG,self.count(mid))
            if self.count(mid) >= i:
                OK = mid
            else:
                NG = mid
        return OK

    def search_low(self,x): # x より小さい最大の要素
        xcn = self.count(x)
        NG = -1
        OK = x
        while OK-NG > 1:
            mid = (OK+NG)//2
            #print(OK,NG,self.count(mid))
            if self.count(mid) >= xcn:
                OK = mid
            else:
                NG = mid
        return OK

    def search_high(self,x): # x より大きい最小の要素
        xcn = self.count(x)
        NG = x
        OK = self.N + 1
        while OK-NG > 1:
            mid = (OK+NG)//2
            #print(OK,NG,self.count(mid))
            if self.count(mid) > xcn:
                OK = mid
            else:
                NG = mid
        return OK

import sys

stdin = sys.stdin

ni = lambda: int(ns())
nl = lambda: list(map(int, stdin.readline().split()))
nm = lambda: map(int, stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
p = nl()
q = [0]*(n+1)
for i in range(n):
    q[p[i]] = i+1
ans = 0
b = B(n)
b.add(q[-1])
for i in range(n-1,0,-1):
  v = q[i]
  l1 = b.search_low(v)
  r1 = b.search_high(v)
  l2 = b.search_low(l1)
  r2 = b.search_high(r1)
  ans += i*((r1-v)*(l1-l2) + (v-l1)*(r2-r1))
  b.add(v)
print(ans)

### FIXED CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
nl = lambda: list(map(int, stdin.readline().split()))
nm = lambda: map(int, stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
p = nl()
q = [0]*(n+1)
for i in range(n):
    q[p[i]] = i+1
    
ans = 0
l = [0] + [i for i in range(n+1)]
r = [i+1 for i in range(n+1)] + [n+1]

for i in range(1,n+1):
    v = q[i]
    l1,r1 = l[v],r[v]
    l2,r2 = l[l1],r[r1]
    ans += i*((v-l1)*(r2-r1) + (r1-v)*(l1-l2))
    l[r1] = l1
    r[l1] = r1
  
print(ans)
a = list(int,input().split())
if a[0]=a[-1]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a=input()
if a[0]==a[2]:
  print("Yes")
else:
  print("No")
a = (int)(input())
b = (int)(input())

if (a > 8 or b > 8):
    print(":(")
else:
    print("Yay!")

### FIXED CODE ###

text = input().split()
a = (int)(text[0])
b = (int)(text[1])

if (a > 8 or b > 8):
    print(":(")
else:
    print("Yay!")
N = int(input())

class Edge:
    def __init__(self,to,cost):
        self.to = to
        self.cost = cost

graph = [[] for i in range(N)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    graph[a-1].append(Edge(b-1,c))
    graph[b-1].append(Edge(a-1,c))
dp = [0 for i in range(N)]

def dfs(s,pare):
    for i in graph[s]:
        if i.to != pare :
            dp[i.to] = dp[s] + i.cost
            dfs(i.to,s)


Q,K = map(int,input().split())
dfs(K-1,-1)
print(dp)
for i in range(Q):
    x,y = map(int,input().split())
    print("{}".format(dp[x-1]+dp[y-1]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
N = int(input())

class Edge:
    def __init__(self,to,cost):
        self.to = to
        self.cost = cost
#隣接グラフ
graph = [[] for i in range(N)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    graph[a-1].append(Edge(b-1,c))
    graph[b-1].append(Edge(a-1,c))
dp = [0 for i in range(N)]

def dfs(s,pare):
    for i in graph[s]:
        if i.to != pare :
            dp[i.to] = dp[s] + i.cost
            dfs(i.to,s)
        else:
            continue 


Q,K = map(int,input().split())
dfs(K-1,-1)
for i in range(Q):
    x,y = map(int,input().split())
    print("{}".format(dp[x-1]+dp[y-1]))
S = input()
S = sorted(set(S))
A = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(A)):
  if len(A) == len(S):
    print("None")
    break
  if A[i] != S[i]:
    print(A[i])
    break
  if i == len(S):
    print(A[i + 1])
    break

### FIXED CODE ###

S = input()
S = sorted(set(S))
A = "abcdefghijklmnopqrstuvwxyz"
for i in range(len(A)):
  if len(A) == len(S):
    print("None")
    break
  if A[i] != S[i]:
    print(A[i])
    break
  if i == len(S) - 1:
    print(A[i + 1])
    break
a,b=map(int,input().split())
cl=[]
tl=[]
for i in range(a):
    c,t=map(int,input().split())
    cl.append(c)
    tl.append(t)
    
ind=0
resut_list=[]
for p in range(a):
    if tl[ind]<=b:
        resut_list.append(cl[ind])
    ind+=1    

print(min(resut_list))


### FIXED CODE ###

n,t = map(int, input().split())
lst_c = []
lst_t = []
a = 0
b = 0
for i in range(n):
    a,b = map(int, input().split())
    if b <= t:
        lst_c.append(a)
if lst_c == []:
    print("TLE")
else:
    print(min(lst_c))
def solve(K, ABs):
    if not ABs: return 0
    ansK = sum(b for a, b in ABs if (K | a) == K)
    pool = []
    for i in range(30, -1, -1):
        if (K & (1<<i)):
            pool.append(i)
    for p in pool:
        v = 1 << p
        KK = (K >> p) << p
        KKK = (K >> p)
        t = sum(b for a, b in ABs if (not(a & v) and (a | KK) >> p == KKK)
        if t > ansK: ansK = t
    return ansK
   

N, K = map(int, input().split())
ABs = []
for i in range(N):
    a, b = map(int, input().split())
    if a > K: continue
    ABs.append([a, b])

print(solve(K, ABs))

### FIXED CODE ###

def solve(K, ABs):
    if not ABs: return 0
    ansK = sum(b for a, b in ABs if (K | a) == K)
    pool = []
    for i in range(30, -1, -1):
        if (K & (1<<i)):
            pool.append(i)
    for p in pool:
        v = 1 << p
        KK = (K >> p) << p
        KKK = (K >> p)
        t = sum(b for a, b in ABs if (not(a & v) and (a | KK) >> p == KKK))
        if t > ansK: ansK = t
    return ansK
   

N, K = map(int, input().split())
ABs = []
for i in range(N):
    a, b = map(int, input().split())
    if a > K: continue
    ABs.append([a, b])

print(solve(K, ABs))
from functools import reduce
from operator import mul
n, p = map(int, input().split())
print(reduce(mul, [1] + [k for k, v in factorint(p).items()  if v >= n]))

### FIXED CODE ###

from math import sqrt
def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n))+1):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n, p = map(int, input().split())
x = 1
for k, v in factorint(p).items():
    x *= k ** (v//n)
print(x)
x = int(input(x)) 
if x == 0:
  print(1)
else:
  print(0)
  

### FIXED CODE ###

s = int(input()) 
if s == 0:
  print(1)
else:
  print(0)
import math

N = int(input())
A = [int(i) for i in input().split()]
ans = A[0]
for i in range(1, N):
    ans = math.gcd(ans, A[i])
print(ans)


### FIXED CODE ###

def gcd(x, y):
    if y > x:
        x, y = y, x
    while y != 0:
        x, y = y, x % y
    return x


N = int(input())
A = [int(i) for i in input().split()]
ans = A[N - 1]
for i in range(N - 1):
    ans = gcd(ans, A[i])
print(ans)
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))

c = [[0 for i in range(w)] for j in range(h)]
fromL = True
x = 0
y = 0

for i in range(1, n+1) :
    for j in range(a[i-1]) :
        c[y][x] = i
        if w == 1 :
            y += 1
        elif j > 0 and x == w - 1 :
            y += 1
            fromL = False
        elif j > 0 and x == 0 :
            y += 1
            fromL = True
        elif fromL :
            x += 1
        else :
            x -= 1

for ci in c :
    print(*ci)

### FIXED CODE ###

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

c = [[0 for i in range(w)] for j in range(h)]
fromL = True
x = 0
y = 0

for i in range(1, n+1) :
    for j in range(a[i-1]) :
        c[y][x] = i
        if w == 1 :
            y += 1
        elif fromL :
            if x == w - 1 :
                y += 1
                fromL = False
            else :
                x += 1
        else :
            if x == 0 :
                y += 1
                fromL = True
            else :
                x -= 1

for ci in c :
    print(*ci)
N = int(input())
shops = []
for i in range(N):
    S, P = input().split()
    shops.append([S, int(P), i])
shops.sort(key=1)
shops.sort()
for shop in shops:
    print(shop[2])

### FIXED CODE ###

N = int(input())
shops = []
for i in range(N):
    S, P = input().split()
    shops.append([S, int(P), i+1])
shops.sort(key=lambda x: x[1], reverse=True)
shops.sort(key=lambda x: x[0])
for shop in shops:
    print(shop[2])
import math
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(round(math.pow(P,(1/N))))):
    tmp=math.pow(i,N-1)
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if (P/i)%tmp==0:
        ans=i
        break
print(ans)

### FIXED CODE ###

import math
from sys import stdin
N,P=[int(x) for x in stdin.readline().rstrip().split()]
for i in reversed(range(round(math.pow(P,(1/N)))+1)):
    tmp=math.pow(i,N)
    if P==1:
        ans=1
        break
    if N==1:
        ans=P
        break
    if P%tmp==0:
        ans=i
        break
print(ans)
n,ans=int(input()),0
for i in range(n):
  a,b=map(int,input().split())
  if b=="JPY":ans+=a
  else:ans+=a*380000
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)
n,k=map(int,input().split())
s=list(input())
ct=0
for i in range(n-1):
  if s[i]=='R' and s[i+1]=='L':
    ct+=1
if s[0]==s[n-1]:
  x=ct
  ct-=min(ct,k)
  ct*=2
  ct+=1
  print(n-ct)
elif s[0]=='L':
  x=ct
  ct-=min(ct,k)
  ct*=2
  if x<k:
    ct-=1
  print(n-ct)
else:
  x=ct
  ct-=min(ct,k)
  ct*=2
  if x<=k
    ct+=1
  print(n-ct)

### FIXED CODE ###

import sys
n,k=map(int,input().split())
s=list(input())
ct=0
for i in range(n-1):
  if s[i]=='R' and s[i+1]=='L':ct+=1
if ct<=k-1:
  print(n-1)
  sys.exit()
ans=n-ct*2
ans+=2*k
if s[0]=='L':
  ans-=1
if s[n-1]=='R':
  ans-=1
print(ans)
from functools import lru_cache

import sys
sys.setrecursionlimit(10000)

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

@lru_cache(maxsize=None)
def rec(n):
  # print(n)
  if n == 1:
    return 0
  elif n == 2:
    return abs(h[1]-h[0])
  else:
    return min(rec(n-1)+abs(h[n-1]-h[n-2]), rec(n-2)+abs(h[n-1]-h[n-3]))

print(rec(N))

### FIXED CODE ###

from functools import lru_cache

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

cost = [None] * N
cost[0] = 0
cost[1] = abs(h[1]-h[0])
for i in range(2, N):
  cost[i] = min(cost[i-1]+abs(h[i]-h[i-1]), cost[i-2]+abs(h[i]-h[i-2]))
print(cost[N-1])
# print(cost)

"""
@lru_cache(maxsize=None)
def rec(n):
  # print(n)
  if n == 1:
    return 0
  elif n == 2:
    return abs(h[1]-h[0])
  else:
    return min(rec(n-1)+abs(h[n-1]-h[n-2]), rec(n-2)+abs(h[n-1]-h[n-3]))

print(rec(N))
"""
n = input()
R = []

for i in range(1,n):
    R.append(input())
 
max = R[1] - R[0]
min = R[0]
 
for i in range(2,n):
    if R[i] - min > max:
        max = R[i] - min
    if R[i] < min:
        min = R[i]
 
print max

### FIXED CODE ###

n = input()

R = [input() for i in range(n)]
  
max = R[1] - R[0]
min = R[0]
  
for i in range(1,n):
    if R[i] - min > max:
        max = R[i] - min
    if R[i] < min:
        min = R[i]
  
print max
h,w = map(int,input().split())
a = [input() for i in range(h)]

from collections import deque
q = deque()
reach = [[False]*w for i in range(h)]
for i in range(h):
    for j in range(w):
        if a[i][j]=='#':
            q.append([i,j,0])
            reach[i][j] = True

ans = 0
while q:
    i,j,cnt = q.popleft()
    for k,l in [[1,0],[-1,0],[0,1],[0,-1]]:
        if 0<=i+k<w and 0<=j+l<h:
            if not reach[i+k][j+l]:
                q.append([i+k,j+l,cnt+1])
                reach[i+k][j+l] = True
    ans = max(ans,cnt)

print(ans)



### FIXED CODE ###

h,w = map(int,input().split())
a = [input() for i in range(h)]

from collections import deque
q = deque()
reach = [[False]*w for i in range(h)]
for i in range(h):
    for j in range(w):
        if a[i][j]=='#':
            q.append([i,j,0])
            reach[i][j] = True

ans = 0
while q:
    i,j,cnt = q.popleft()
    ans = max(ans,cnt)
    for k,l in [[1,0],[-1,0],[0,1],[0,-1]]:
        if 0<=i+k<h and 0<=j+l<w:
            if not reach[i+k][j+l]:
                q.append([i+k,j+l,cnt+1])
                reach[i+k][j+l] = True

print(ans)