Harryxun/stf_run huggingface dataset:
n=int(input())
d,x=map(int,input().split())
cnt=x
for i in range(n):
  a = input()
  if a < d:
    cnt+=1
print(cnt)

### FIXED CODE ###

n=int(input())
d,x=map(int,input().split())
cnt=x
for i in range(n):
  a = int(input())
  day=1
  while day <= d:
    cnt+=1
    day+=a
    
print(cnt)
N = int(input())
a = list(range(N))
#a[0] = a[-1]
Mmax = sum(a)

print(Mmax)

### FIXED CODE ###

N = int(input())

a = N/2
b = int(N/2)
if not(N%2 == 0):
    Mmax = N*b
elif N%2 == 0:
    Mmax = N*(b-1) + b



print(Mmax)
import bisect
x = int(input())
num_list = list(range(x))
a = [0]*x
a[0] = num_list[0]
for i in range(1,x):
    a[i] = a[i-1] + num_list[i]
print(bisect.bisect_left(a, x))

### FIXED CODE ###

x = int(input())
for i in range(x+10):
    if (i*(i+1) / 2 < x) & (((i+1)*(i+2)) / 2 >= x):
        break
ans = i+1
print(ans)
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import groupby, accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A = [k for k, g in groupby(A)]
i = 1
ans = 0

while i < N-1:
	if A[i-1] < A[i] > A[i+1] or A[i-1] > A[i] < A[i+1]:
		ans += 1
		i += 1
	i += 1

print(ans+1)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import groupby, accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A = [k for k, g in groupby(A)]
N = len(A)
i = 1
ans = 0

while i < N-1:
	if A[i-1] < A[i] > A[i+1] or A[i-1] > A[i] < A[i+1]:
		ans += 1
		i += 1
	i += 1

print(ans+1)
K, S = map(int, input().split())


ans = 0
for x in range(K+1):
    for y in range(K+1):
       z = S - x - y
       if z >= 0 and z <= K:
           ans += 1

print(ans)

### FIXED CODE ###

s = input()

print(s.replace(",", " "))
date1,date2 = list(map(int, input().split()))
a = min(date1)   # 2
b = max(date1)   # 50
c = sum(date1)   # 256
print(f'{a}')
print(f'{b}')
print(f'{c}')



### FIXED CODE ###

n = input()
lst = list(map(int, input().split()))
print(min(lst), max(lst), sum(lst))
#!/usr/bin/env python3
def main():
    N, K = map(int, input().split())
    A = [int(x) - 1 for x in input().split()]

    route = []
    now = 0
    for k in range(K):
        if now in route:
            break
        route.append(now)
        now = A[now]

    loop_start = route.index(now)
    K -= len(route[:loop_start])
    K %= len(route[loop_start:])
    for k in range(K):
        now = A[now]
    print(now + 1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
def main():
    N, K = map(int, input().split())
    A = [int(x) - 1 for x in input().split()]

    way = []
    seen = [False for _ in [0] * (2 * 10 ** 5 + 1)]
    now = 0
    for _ in range(K):
        if seen[now]:
            loop_start = way.index(now)
            loop = way[loop_start:]
            K -= len(way[:loop_start])
            now = loop[K % len(loop)]
            break
        way.append(now)
        seen[now] = True
        now = A[now]
    print(now + 1)


if __name__ == '__main__':
    main()
a, b, c, d = map(int,input().split())
if abs(a - b) =< d or abs(b - c) =< d:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

a, b, c, d = map(int,input().split())
if abs(a - b) <= d and abs(b - c) <= d or abs(a - c) <= d:
  print("Yes")
  
else:
  print("No")
n = int(input())
record =  [ [ [0 for r in range(10)] for f in range(3) ] for b in range(4)]
for i in range(n):
    b, f, r, v = [int(a) for a in input().split(" ")]
    record[b - 1][f - 1][r - 1] += v
for b in range(4):
    for f in record[b]:
        print( " "+" ".join([str(x) for x in f]) )
    if b != 3:
        print("".join(["#" for q in range(20)]))
        

### FIXED CODE ###

n = int(input())
record = [ [ [0 for r in range(10)] for f in range(3)] for b in range(4)]
for _ in range(n):
    b,f,r,v = [int(i) for i in input().split(" ")]
    record[b - 1][f - 1][r - 1] += v
for b1 in range(4):
    for f in record[b1]:
        print(" "+" ".join([str(x) for x in f]))
    if b1 != 3:
        print("#" * 20)
N = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(N)]
for j in range(N):
  B[A[j]] = j+1
print(' '.join(map(str, B)))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(N)]
for j in range(N):
  B[A[j]-1] = j+1
print(' '.join(map(str, B)))
def two_power(num: int) -> int:
    count = 0

    while num % 2 == 0:
        try:
            num = num / 2
            count += 1
        except ValueError:
            pass
    return count


n = int(input())
li = (input().split(' '))

l = []
for i in range(0, n):
    l.append(int(li[i]))

ans_list = []
for i in range(0, n):
    ans_list.append(two_power(l[i]))

print(min(ans_list))

### FIXED CODE ###

n = input()

n0 = int(n[0])
n1 = int(n[1])
n2 = int(n[2])

s = n0 + n1 + n2
print(s)
def u(a,b):
  if(a<b):
    z = b
    b = a
    a = z
   r = a % b;
  while(r!=0):
    a = b
    b = r
    r = a % b
  return b
 
l = int(input())
s = 0
for i in range(1,l+1):
  for i2 in range(1,l+1):
    z = u(i,i2)
    for i3 in range(1,l+1):
      z2 = u(z,i3)
      s+=z2
print (s)

### FIXED CODE ###

def u(a,b):
  if(a<b):
    z = b
    b = a
    a = z
  r = a % b
  while(r!=0):
    a = b
    b = r
    r = a % b
  return b
 
l = int(input())
s = 0
for i in range(1,l+1):
  for i2 in range(1,l+1):
    z = u(i,i2)
    for i3 in range(1,l+1):
      z2 = u(i3,z)
      s+=z2
print (s)
print(sum(range(int(input())))

### FIXED CODE ###

n = int(input())-1
print(((2+n-1)*n ) >> 1)
x = list(input())
y = list(input())+[""]

print(y)
for o,p in zip(x,y):print(o+p,end="")

### FIXED CODE ###

a,b,c = map(int,input().split())
print("YES" if b-a==c-b else "NO")
n,a,b=map(int,input().split())
m=10**9+7
def com(n,k,m):
  p,q=1,1
  for i in range(n-k,n+1):
    p*=i
    p%=m
  for i in range(1,k+1):
    q*=i
    q%=m
  return p*pow(q,m-2,m)%m
ans=(pow(2,n,m)-ca-cb)%m

### FIXED CODE ###

n,a,b=map(int,input().split())
m=10**9+7
def com(n,k,m):
  p,q=1,1
  for i in range(n-k+1,n+1):
    p*=i
    p%=m
  for i in range(1,k+1):
    q*=i
    q%=m
  return p*pow(q,m-2,m)%m
ca,cb=com(n,a,m),com(n,b,m)
ans=(pow(2,n,m)-1-ca-cb)%m
print(ans)
import math

A, B = input().split()

print(int(A), int(B))
print(int(int(A) * int(B) / math.gcd(A, B)))


### FIXED CODE ###

A = int(input())
B = int(input())

r = list(filter(lambda x: x != A and x != B, [1, 2, 3]))
print(r[0])
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(v-w)
i=0
for i in range(t+1):
  if v<=w:
    print("NO")
  if p*t == d:
    print("YES")


### FIXED CODE ###

a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
    print('NO')
else:
    if 1 <= (abs(b - a) / (v - w)) <= t:
        print('YES')
    else:
        print('NO')
A, B, K = (int(i) for i in input().split()) 
low = range(A,A+K)
high = range(B,B-K,-1)
t = sorted(list(set(low) | set(high)))
for s in t:
    if s >= A and s <= B:
        print(s)

### FIXED CODE ###

a = input()
if a in ["abc","acb","bac","bca","cab","cba"]: #== ("abc" or "acb" or "bac" or "bca" or "cab" or "cba"):
  print("Yes")
else:
  print("No")
year = 0 # 答え
money = 100 # 初期値の100円

# x円以上になるまでループを回す
while money < x:
    money *= 1.01
    money = int(money)
    year += 1

print(year)

### FIXED CODE ###

X = int(input())

n = 100
year_count = 0

while n < X:
    n += n // 100
    year_count += 1

print(year_count)
import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7

if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()

A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]

ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

while ansA>0:
  ansA-=MOD
B1=A[0:K]
B2=sorted(A[K:N])
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]
if B2[0]>0:B2.insert(0,0)
if B2[-1]<0:B2.insert(-1,0)

print(ansA)
print(Bm,Bp)
B1.remove(Bp[-1])
B1.append(B2[0])

ansB = 1
for a in B1[0:K]:
  ansB *= a
  ansB %= MOD

C1=A[0:K]
C1.remove(Bm[-1])
C1.append(B2[-1])

ansC = 1
for a in C1[0:K]:
  ansC *= a
  ansC %= MOD


print(B1,C1)
print(ansB,ansC)
print(max(ansB,ansC)%MOD)

### FIXED CODE ###

import numpy as np
N,K=map(int, input().split())
A =list(map(int,input().split()))
MOD = 10 ** 9 + 7
if N==K:
  ans0 = 1
  for a in A[0:N]:
    ans0 *= a
    ans0 %= MOD
  print(ans0)
  exit()
A=sorted(A)  
if (K%2==1 and A[-1]<0):
  ans1 = 1
  for a in A[N-K:N]:
    ans1 *= a
    ans1 %= MOD
  print(ans1)
  exit()
 
A=sorted(A, key=lambda x:abs(x), reverse=True)
AA=[np.sign(i) for i in A]
 
ansA = 1
for a in A[0:K]:
  ansA *= a
  ansA %= MOD
ansAA = AA[0:K].count(-1)%2
if ansA==0 or ansAA==0:
  print(ansA)
  exit()

while ansA>0:
  ansA-=MOD

B1=A[0:K]
C1=A[0:K]
B2=sorted(A[K:N])
Bp=[i for i in A[0:K] if i>0]
Bm=[i for i in A[0:K] if i<0]
 
if B2[0]>0:B2.insert(0,0)
if B2[-1]<0:B2.insert(-1,0)
if not Bp:Bp.insert(0,B1[-1])
if not Bm:Bm.insert(0,B1[0])
  
#print(Bp,Bm,B2)
#print(Bp[-1],B2[0])
B1.remove(Bp[-1])
B1.append(min(B2[0],0))
#print(B1)
ansB = 1
for a in B1[0:K]:
  ansB *= a
  ansB %= MOD
#print(Bm[-1],B2[-1])
C1.remove(Bm[-1])
C1.append(max(B2[-1],0))
 
ansC = 1
for a in C1[0:K]:
  ansC *= a
  ansC %= MOD
#print(B1,C1)
#print(ansB,ansC)
BB1=[np.sign(i) for i in B1]
ansBB1 = BB1[0:K].count(-1)%2
BB2=[np.sign(i) for i in C1]
ansBB2 = BB2[0:K].count(-1)%2
#print(ansBB1,ansBB2)
if ansBB1==1:
  print(ansC)
  exit()
if ansBB2==1:
  print(ansB)
  exit()
#print(B2[0]/Bp[-1],B2[-1]/Bm[-1])
#print(Bp[-1]*B2[-1],Bm[0]*B2[0])

#print(abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0]))
#print(ansB,ansC)
if abs(Bp[-1]*B2[-1])-abs(Bm[-1]*B2[0])>=0:
  print(ansC)
else: print(ansB)
import math
while True:
    n = int(input())
    score = [ int(i) for i in input().split(" ") ] 
    average = sum(score) / float(n)
    if n == 0:
        break
    print("{0:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / 2 ) 

### 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)))
n = int(input())

a = []
xys = [[] for i in range(n)]

for j in range(n):
    a.append(int(input()))
    for i in range(a[j]):
        xys[j].append(list(map(int,input().split())))


ps = list()
for i in range(2**n):
    ps.append(list(map(int, list(bin(i)[2:].zfill(n)))))

for l in range(2**n):
    for i in range(n):
        if  (ps[l])[i] == 1:
            for j in range(a[i]):
                if ps[l][xys[i][j][0] - 1] != xys[i][j][1]:
                    ps[l] = [0,0,0]

print(max(sum(ps[l]) for l in range(2**n)))



### FIXED CODE ###

n = int(input())

a = []
xys = [[] for i in range(n)]

for j in range(n):
    a.append(int(input()))
    for i in range(a[j]):
        xys[j].append(list(map(int,input().split())))


ans = 0
for i in range(1,2**n):
    cont = True
    for j in range(n):
        if (i >> j) & 1 == 1:
            for x,y in xys[j]:
                if (i >> (x-1)) & 1 != y:
                    cont = False
                    break
        if not cont:
            break
    if cont:
        ans = max(ans,bin(i)[2:].count('1'))

print(ans)
n, m = [int(i) for i in input().split(' ')]
wa = [0] * n
ac = [0] * n
for _ in range(m):
    problem, status = input().split(' ')
    problem = int(problem) - 1
    if status == 'WA':
        if ac[problem] == 0:
            wa[problem] += 1
        continue
    ac[problem] = 1

no_ac = sum(ac)
no_wa = sum(wa)

print(str(no_ac) + ' ' + str(no_wa))

### FIXED CODE ###

print(chr(ord(input()) + 1))
# -*- coding: utf-8 -*-
"""
Created on Sat Sep  8 18:34:07 2018
ABC109C
@author: maezawa
"""
import math
n, x0 = list(map(int, input().split()))
x = list(map(int, input().split()))

xx0 = [abs(xi-x0) for xi in x ]

y = xx0[0]
for yi in xx0:
    y = math.gcd(y, yi)
    
print(y)

### FIXED CODE ###

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

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

xx0 = [abs(xi-x0) for xi in x ]

y = xx0[0]
for yi in xx0:
    y = gcd(y, yi)
    
print(y)
print(2 * R * 3.141592)

### FIXED CODE ###

import math
a = int(input())
print(2 * a * math.pi)
import sys

def isEmpty(S):
  if len(S) == 0:
    return True

def isFull(S):
  if len(S) >= 100000:
    return True

def enqueue(x):
  if isFull(x_list_list):
    print 'Error'
  x_list_list.append(x)

def dequeue(x_list_list):
  if isEmpty(x_list_list):
    print 'Error'
  del_list = x_list_list[0]
  x_list_list.pop(0)
  return(del_list)

y = sys.stdin.readline()
a, b = y.split(" ")
a = int(a)
b = int(b)

S = []
x_list_list = []

for i in range(a):
  text = raw_input()
  x_list = text.split()
  x_list[1] = int(x_list[1])
  x_list.append(0)
  x_list_list.append(x_list)

flag = a
while flag != 0:
  if int(x_list_list[0][1]) > b:
    x_list_list[0][1] -= int(b)
    for j in range(flag):
      x_list_list[j][2] += b
    del_list = dequeue(x_list_list)
    enqueue(del_list)
  elif int(x_list[0][1]) <= b:
    for j in range(flag):
      x_list_list[j][2] += x_list_list[0][1]
    x_list_list[0][1] = 0
    flag -= 1
    print x_list_list[0][0],x_list_list[0][2]
    dequeue(x_list_list)

### FIXED CODE ###

import sys

def isEmpty(S):
  if len(S) == 0:
    return True

def isFull(S):
  if len(S) >= 100000:
    return True

def enqueue(x):
  if isFull(x_list_list):
    print 'Error'
  x_list_list.append(x)

def dequeue(x_list_list):
  if isEmpty(x_list_list):
    print 'Error'
  del_list = x_list_list[0]
  x_list_list.pop(0)
  return(del_list)

y = sys.stdin.readline()
a, b = y.split(" ")
a = int(a)
b = int(b)

S = []
x_list_list = []
run_time = 0

for i in range(a):
  text = raw_input()
  x_list = text.split()
  x_list[1] = int(x_list[1])
  x_list.append(0)
  x_list_list.append(x_list)

flag = a
while flag != 0:
  if x_list_list[0][1] > b:
    x_list_list[0][1] -= int(b)
    run_time += b
    del_list = dequeue(x_list_list)
    enqueue(del_list)
  else:
    run_time += x_list_list[0][1]
    x_list_list[0][2] = run_time
    x_list_list[0][1] = 0
    flag -= 1
    print x_list_list[0][0],x_list_list[0][2]
    dequeue(x_list_list)
n,a,b = map(int, input().split())
ans = 0

def find_sum(x):
    count = 0
    while x > 0:
        count += x % 10
        x = x // 10

    return count

for i in range(1, n+1):
    count = find_sum(i)
    if A <= count <= B:
        ans += n

print(ans)

### FIXED CODE ###

n,a,b = map(int, input().split())
print(sum(i for i in range(1, n+1) if a <= sum(map(int, str(i))) <= b))
# 1 <= N <= 1000000
N = int(input())

total = []

# N項目までに含まれる->N項目は含まない。だからN項目は+1で外す。
for x in range(1, N+1):
    if x % 15 == 0:
        "FizzBuzz"
    elif x % 5 == 0:
        "Buzz"
    elif x % 3 == 0:
        "Fizz"
    else:
        print(total)
        total.append(x) #リストに加える
print(sum(total))


### FIXED CODE ###

# 1 <= N <= 1000000
N = int(input())

total = []

# N項目までに含まれる->N項目は含まない。だからN項目は+1で外す。
for x in range(1, N+1):
    if x % 15 == 0:
        "FizzBuzz"
    elif x % 5 == 0:
        "Buzz"
    elif x % 3 == 0:
        "Fizz"
    else:
        total.append(x) #リストに加える
print(sum(total))
a, b = map(int, input.split())

print(a*b-a-b+1)

### FIXED CODE ###

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

print(a*b-a-b+1)
input()
d=[int(i) for i in input().split()]
i=0
while True:
  a=d[0]
  del d[0]
  for i in d:
    sum += a*i
print(sum)

### FIXED CODE ###

n=input()
d=[int(i) for i in input().split()]
sum=0
while True:
  a=d[0]
  del d[0]
  if d == []:
    break
  for i in d:
    sum += a*i
print(sum)
N,K=map(int,input().split())
H=[int(input()) for i in range(N)]
A=sorted(H)[::-1]
ans=10**9
for i in range(N-K+1):
  a=A[i]-A[i+2]
  ans=min(ans,a)
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
H=[int(input()) for i in range(N)]
A=sorted(H)[::-1]
ans=10**9
for i in range(N-K+1):
  a=A[i]-A[i+K-1]
  ans=min(ans,a)
print(ans)
import math
from decimal import Decimal
A,B,X = map(Decimal, input().split())
s = X / A

if s > A * B / 2:
    Bu = 2 * s / A - B
    s -= A*Bu
    B -= Bu

A2 = 2 * s / B
print(math.degrees(math.atan(B/(A2))))


### FIXED CODE ###

import math
from decimal import Decimal
A,B,X = map(Decimal, input().split())
s = X / A

if s == A*B:
    print(0)
    exit()
if s > A * B / 2:
    Bu = 2 * s / A - B
    s -= A*Bu
    B -= Bu

A2 = 2 * s / B
print(math.degrees(math.atan(B/(A2))))
N = int(input(N))

if N % 2 == 0:
    print(1-(N/2)/2)
elif:
    odd_N = N//2 + 1
    print(odd_N / N)

### FIXED CODE ###

N = int(input())

if N % 2 == 0:
    print(0.50000000000)
else:
    odd_N = N//2 + 1
    print(odd_N / N)
N = input()
A = list(map(int,input()))

ans=float("inf")
for i in A:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(ans)


### FIXED CODE ###

n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))
N,M,K = map(int, input().split())
field = [[0]*M for i in range(N)]
def reverse(x):
    if x == 0:
        return 1
    else:
        return 0
now = 0
for i in range(N+1):
    if (K - now) % (N - 2 * i) == 0 and (K - now) / (N - 2 * i) <= M and  (K - now) / (N - 2 * i) >= 0:
        print("Yes")
        exit(0)
    elif i == N:
        break
    else:
        for j in range(M):
            field[i][j] = reverse(field[i][j])
            now = sum(map(sum,field))

print("No")



### FIXED CODE ###

N,M,K = map(int, input().split())
field = [[0]*M for i in range(N)]
def reverse(x):
    if x == 0:
        return 1
    else:
        return 0
now = 0
for i in range(N+1):
    if N - 2 * i ==0:
        for j in range(M):
           now += M
    elif (K - now) % (N - 2 * i) == 0 and (K - now) / (N - 2 * i) <= M and  (K - now) / (N - 2 * i) >= 0:
        print("Yes")
        exit(0)
    elif i == N:
        print("No")
        exit(0)
    else:
        now += M
S = input()

ans = 1e10
for i in range(7):
    ans = min(ans, abs(int(S[i:i+3])-753))
print(ans)

### FIXED CODE ###

S = input()

ans = 1e10
for i in range(len(S)-2):
    ans = min(ans, abs(int(S[i:i+3])-753))
print(ans)
N, K = map(int,input().split())
S = input()
if S[K-1] == 'A':
    S[K-1] = 'a'
elif S[K-1] == 'B':
    S[K-1] = 'b'
else:
    S[K-1] = 'c'
print(S)

### FIXED CODE ###

N, K = map(int,input().split())
S = input()
S1 = []
for i in range(N):
    if i == K-1:
        S1.append(S[i].lower())
    else:
        S1.append(S[i])
print(''.join(S1))
N = int(input())
d={}
for i in range(N):
    x, u = map(input().split())
    d[u]=int(x)
print(sum(d["JPY"])+sum(d["BTC"])*380000)

### FIXED CODE ###

N = int(input())
sum=0
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(sum)
N,K = map(int,input().split()) 
l = list(map(int,input().split()))
l.sort(reverse = True)
length = 0
for i in range(K): 
    length += l[i]
print(leng

### FIXED CODE ###

N,K = map(int,input().split()) 
l = list(map(int,input().split()))
l.sort(reverse = True)
length = 0
for i in range(K): 
    length += l[i]
print(length)
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i in range(M):
    s[i],c[i]=map(int,input().split())
ans=[0 for i in range(N+1)]
if(N<max(s)):
    print('-1')
    exit()

else:
    for i in range(M-1):
        if(ans[s[i]]==0):
            ans[s[i]]=c[i]
        for j in range(i+1,M):
            if(s[i]==s[j]):
                if(c[i]!=c[j]):
                    print('-1')
                    exit()


an=0
for i in range(1,N+1):
    if(ans[i]==0):
        pass
    else:
        an=ans[i]*10**(N-i)+an
if(ans[1]==0):
    print('-1')
    exit()
if(an<=0):
    print('-1')
    exit()
print(an)


### FIXED CODE ###

N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i in range(M):
    s[i],c[i]=map(int,input().split())
ans=['#' for i in range(N+1)]

for i in range(M):
    if(ans[s[i]]=='#'):
        ans[s[i]]=str(c[i])
    for j in range(i+1,M):
        if(s[i]==s[j]):
            if(c[i]!=c[j]):
                print('-1')
                exit()

if(2<=N):
    if(ans[1]=='#'):
        ans[1]='1'
    elif(ans[1]=='0'):
        print('-1')
        exit()
else:
    if(ans[1]=='#'):
        ans[1]=0
        pass
    print(ans[1])
    exit()
a=ans[1:]

a=''.join(a).replace('#','0')
print(a)
A = [input().split()]
count = 0
while all(a % 2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)

### FIXED CODE ###

input()
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
  A = [a/2 for a in A]
  count += 1
print(count)
n = int(input())

abc=list()
for i in range(n):
    abc.append([int(e) for e in input().split()])

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

for i in range(n):
    a = abc[i][0] + max(B[-1],C[-1])
    b = abc[i][1] + max(A[-1],C[-1])
    c = abc[i][2] + max(A[-1],B[-1])
    A.append(a)
    B.append(b)
    C.append(c)

print(max(A[-1],B[-1],C[-1]))

### FIXED CODE ###

n = int(input())

abc=list()
for i in range(n):
    abc.append([int(e) for e in input().split()])

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

A.append(abc[0][0])
B.append(abc[0][1])
C.append(abc[0][2])

for i in range(1,n):
    a = abc[i][0] + max(B[-1],C[-1])
    b = abc[i][1] + max(A[-1],C[-1])
    c = abc[i][2] + max(A[-1],B[-1])
    A.append(a)
    B.append(b)
    C.append(c)

print(max(A[-1],B[-1],C[-1]))
N, K = list(map(int, input().split()))
__max = 10**5+1
buff = [0 for i in range(__max)]
a = []
ans = 0
b = 0
for i in range(N):
    _a, _b = list(map(int, input().split()))
    buff[_a] = _b


for i in range(1,__max+1):

    if K <= buff[i]:
        print(i)
        exit()

    K -= buff[i]

### FIXED CODE ###

amax = 100000
cnt = [0 for i in range(amax+1)]


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

for i in range(N):
    a, b = list(map(int, input().split()))
    cnt[a] += b


for ans in range(1, amax+1):
    if K <= cnt[ans]:
        print(ans)
        break
    K -= cnt[ans]
N = int(input())
x = [0] * N
u = [0] * N
for i in range(N):
    x[i],u[i] = map(int, input().split())


ans = []

btc_1 = 380000.0

for i  in range(N):
    if u[i] == "JPY":
        ans.append(x[i])
    else:
        yen = ((x[i])*(btc_1))
        ans.append(yen)

print(sum(ans))


### FIXED CODE ###

N=int(input())
ans=0
for i in range(N):
    x,u=map(str,input().split())
    x=float(x)
    if u=="JPY":
        ans+=x
    else:
        ans+=380000.0*x
print(ans)
2
100 1 1
1 100

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
cnt = 0
for i in range(N):
  cnt += min(A[i]+A[i+1], B[i])
  if A[i] < B[i]:
    A[i+1] = max(A[i+1]+A[i]-B[i], 0)
print(cnt)