Harryxun/stf_run huggingface dataset:
S = input()
max_l = 0
temp_l = 0

for s in S:
    if s == 'A' or s=='G' or s=='C' or s=='T':
        temp_l += 1
        
    else:
      	max_l = max(max_l, temp_l)
        temp_l = 0

print(max_l)


### FIXED CODE ###

S = input()
max_l = 0
temp_l = 0

for s in S:
    if s == 'A' or s=='G' or s=='C' or s=='T':
        temp_l += 1
        max_l = max(max_l, temp_l)
    else:
        temp_l = 0

print(max_l)
import sys
K=int(input())
 
A,B=list(map(int, input().split()))
 
for i in range(A,B+1):
  if i%K==0:
    
    print("Yes")
    sys.exit()

print("No")

### FIXED CODE ###

X=int(input())
i=0
a=100
while a<X:
  n=int(a*1.01)
  a=n
  i+=1
print(i)
S=str(input())

Ans=[int(S[0]+S[1]),int(S[2]+S[3])]


if Ans[0]>12:
    if Ans[1]>12:
        print("NA")
    elif Ans[1]==0:
        print("NA")
    else:
        print("YYMM")
elif Ans[0]==0:
    print("NA")
else:
    if A[1]>12:
        print("MMYY")
    elif A[1]==0:
        print("NA")
    else:
        print("AMBIGUOUS")

### FIXED CODE ###

S=str(input())

Ans=[int(S[0]+S[1]),int(S[2]+S[3])]

if 0<Ans[0]<13 and 0<Ans[1]<13:
    print("AMBIGUOUS")
elif 0<Ans[0]<13:
    print("MMYY")
elif 0<Ans[1]<13:
    print("YYMM")
else:
    print("NA")
n = map(int, raw_input())
a = []
for _ in range(3):
  a.append(raw_input())
ans = 0
for i in range(n):
  diff_chars = set()
  for j in range(3):
    diff_chars.add(a[j][i])
  ans += len(diff_chars) - 1
print ans

### FIXED CODE ###

n = int(raw_input())
a = []
for _ in range(3):
  a.append(raw_input())
ans = 0
for i in range(n):
  diff_chars = set()
  for j in range(3):
    diff_chars.add(a[j][i])
  ans += len(diff_chars) - 1
print ans
#a.append(list(map(int, input().split())))
#b.append(list(map(int, input().split())))
#c.append(list(map(int, input().split())))
a= list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))


count = int(input())

for num in range(count):
    x = int(input())
    for y in range(3):
        if a[y] == x:
            a[y] = 0
    for y in range(3):
        if b[y] == x:
            b[y] = 0
    for y in range(3):
        if c[y] == x:
            c[y] = 0

#ans = 0
#ans = a[0] * a[1] * a[2]
#ans += b[0] * b[1] * b[2]
#ans += c[0] * c[1] * c[2]
#ans += a[0] * b[0] * c[0]
#ans += a[1] * b[1] * c[1]
#ans += a[2] * b[2] * c[2]

#if ans == 0:
#    print("Yes")
if a[0]+a[1]+a[2] == 0:
    print("Yes")
elif b[0]+b[1]+b[2] == 0:
    print("Yes")
elif c[0]+c[1]+c[2] == 0:
    print("Yes")
elif a[0] + b[0] + c[0] ==0:
    print("Yes")
elif a[1] + b[1] + c[1] ==0:
    print("Yes")
elif a[2] + b[2] + c[2] ==0:
    print("Yes")
elif a[0] + b[1] + c[2] == 0:
    print("Yes")
elif a[2] + b[1] + c[0] ==0:
    pritn("Yes")
else:
    print("No")


### FIXED CODE ###


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


count = int(input())

for num in range(count):
    x = int(input())
    for y in range(3):
        if a[y] == x:
            a[y] = 0
    for y in range(3):
        if b[y] == x:
            b[y] = 0
    for y in range(3):
        if c[y] == x:
            c[y] = 0

#ans = 0
#ans = a[0] * a[1] * a[2]
#ans += b[0] * b[1] * b[2]
#ans += c[0] * c[1] * c[2]
#ans += a[0] * b[0] * c[0]
#ans += a[1] * b[1] * c[1]
#ans += a[2] * b[2] * c[2]

#if ans == 0:
#    print("Yes")
if a[0]+a[1]+a[2] == 0:
    print("Yes")
elif b[0]+b[1]+b[2] == 0:
    print("Yes")
elif c[0]+c[1]+c[2] == 0:
    print("Yes")
elif a[0] + b[0] + c[0] ==0:
    print("Yes")
elif a[1] + b[1] + c[1] ==0:
    print("Yes")
elif a[2] + b[2] + c[2] ==0:
    print("Yes")
elif a[0] + b[1] + c[2] == 0:
    print("Yes")
elif a[2] + b[1] + c[0] ==0:
    print("Yes")
else:
    print("No")
X,Y,Z = map(int,input().split)
X,Y = Y,X
X,Z = Z,X
print(X,Y,Z)

### FIXED CODE ###

X,Y,Z = map(int,input().split())
X,Y = Y,X
X,Z = Z,X
print(X,Y,Z)
n=int(input())
h=[int(i) for i in input().split()]
inf=10**10
dp=[inf]*n
def rec(i):
  if dp[i]<inf:
    return dp[i]
  elif i==0:
    return 0
  elif i==1:
    return h[1]-h[0]
  res=min(inf,rec(i-1)+abs(h[i]-h[i-1]),rec(i-2)+abs(h[i]-h[i-2]))
  dp[i]=res
  return res
print(rec(n-1))

### FIXED CODE ###

n=int(input())
h=[int(i) for i in input().split()]
dp=[0]*n
dp[1]=abs(h[1]-h[0])
for i in range(1,n-1):
  dp[i+1]+=min(dp[i]+abs(h[i+1]-h[i]),dp[i-1]+abs(h[i+1]-h[i-1]))
print(dp[n-1])
A,B,C,D,E,F = map(int, input().split())
sugar = 0
judge = 0
for i in range(31):
  for j in range(32):
    for k in range(31):
      for l in range(32):
        if i+j != 0:          
          x = 100*A*i + 100*B*j
          y = C*k + D*l
          if x+y <= F:
            per = 100*y/x
            if per <= E:
              if per > judge:
                judge = per
                sugar = y
                water = x
print(water+sugar,sugar)

### FIXED CODE ###

A,B,C,D,E,F = map(int, input().split())
W = set()
for a in range(0,F+1,100*A):
  for b in range(0,F+1,100*B):
    W.add(a+b)
S = set()
for c in range(0,F+1,C):
  for d in range(0,F+1,D):
    S.add(c+d)
rate = -1
for w in W:
  for s in S:
    if 0 < w+s <= F and s*100 <= E*w:
      if s/(s+w) > rate:
        rate = s/(s+w)
        ans = w+s,s
print(ans[0],ans[1])
a,b,c = map(int, input().split()
print('Yes') if a<=c<=b else print('No')


### FIXED CODE ###

a,b,c = map(int, input().split())
print('Yes') if a<=c<=b else print('No')
n,m = [int(x) for x in input().split()]
py = []
for i in range(m):
    p,y = [int(x) for x in input().split()]
    py.append([p,y,i+1])

def zero(num):
    return str(num).zfill(6)


if m == 1:
    print(zero(py[0])+zero(1))
else:
    year_py = sorted(py, key=lambda x: x[1])
    dic = {x: 0 for x in range(1,m+1)}

    for i in range(m):
        dic[year_py[i][0]] += 1
        year_py[i].append(dic[year_py[i][0]])
    yb_py = sorted(year_py, key=lambda x: x[2])

    for i in range(m):
        print(zero(yb_py[i][0]) + zero(yb_py[i][3]))

### FIXED CODE ###

n,m = [int(x) for x in input().split()]
py = []
for i in range(m):
    p,y = [int(x) for x in input().split()]
    py.append([p,y,i+1])

def zero(num):
    return str(num).zfill(6)


if m == 1:
    print(zero(py[0][0])+zero(1))
else:
    year_py = sorted(py, key=lambda x: x[1])
    dic = {str(x): 0 for x in range(1,n+1)}

    for i in range(m):
        dic[str(year_py[i][0])] += 1
        year_py[i].append(dic[str(year_py[i][0])])
    yb_py = sorted(year_py, key=lambda x: x[2])

    for i in range(m):
        print(zero(yb_py[i][0]) + zero(yb_py[i][3]))
A = int(input())
if (0<=A and A<=100):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

A, B, C = map(int, input().split())
if (A<B and B<C):
    print("Yes")
else:
    print("No")
H,W = map(input().spilt())
w,h = map(input().spilt())
print((H - h) * (W - w))

### FIXED CODE ###

H,W = map(int,input().split())
h,w = map(int,input().split())
print((H - h) * (W - w))
s = str(input())

while 'B' in s:
    if s[0] == 'B':
    s=s[1:]
    s=s.replace('0B','')
    s=s.replace('1B','')

print(s)

### FIXED CODE ###

s = str(input())

while 'B' in s:
    if s[0] == 'B':
        s=s[1:]
    s=s.replace('0B','')
    s=s.replace('1B','')

print(s)
import numpy as np


def resolve():
    N = int(input())
    d = [int(i) for i in input().split()]
    d = np.array(d)
    count = 0
    for i in range(100000):
        if (np.where(d >= i)[0].size == np.where(d < i)[0].size):
            count += 1
    print(count)
    
resolve()

### FIXED CODE ###

import numpy as np
def resolve():
    N = int(input())
    d = [int(i) for i in input().split()]
    d = np.array(d)
    d = np.sort(d)
    print(d[N // 2] - d[N // 2 - 1])
resolve()
n =int(input())
ls =list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans = 1
	for a in A:
		ans *= a
		if ans > 1000000000000000000:
			ans = -1;
			break;
		
print(ans)

### FIXED CODE ###

n =int(input())
ls =list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans = 1
	for a in ls:
		ans *= a
		if ans > 1000000000000000000:
			ans = -1;
			break;
		
	print(ans)
import math
def kyori(a,b,c,d):
    return math.sqrt(a**2+b**2-2*a*b*math.cos(abs(c-d))


A, B, H, M = [int(i) for i in input().split()]
h = H* 2*math.pi/12 #rad
m = M* 2*math.pi/60 #rad
#print(h, "\n", m)


k=kyori(A,B,h,m)
print(k)

### FIXED CODE ###

import math

def kyori(a,b,c,d):
    return math.sqrt(a**2+b**2-2*a*b*math.cos(abs(c-d)))

A, B, H, M = [int(i) for i in input().split()]
m = M* 2*math.pi/60 #rad
h = H* 2*math.pi/12+ M*2*math.pi/60/12 #rad
#print(h, "\n", m)


k=kyori(A,B,h,m)
print(k)
N = int(input())
*l = map(int, input().split())
print("YES" if len(l)==len(set(l)) else "NO")

### FIXED CODE ###

N = int(input())
*l, = map(int, input().split())
print("YES" if len(l)==len(set(l)) else "NO")
def find(n):
    if root[n] < 0:
        return n
    else:
        root[n] = find(root[n])
        return root[n]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if root[x] > root[y]:
        x, y = y, x

    root[x] += root[y]
    root[y] = x

def size(x):
    return -root[find(x)]

def same(x,y):
    return find(x) == find(y)

def member(x):
    rt = find(x)
    return [i for i in range(n) if find(i) == rt]

def roots():
    return [i for i, x in enumerate(root) if x < 0]

def member_count(x):
    return len(roots())

def all_group_members():
    return {r: member(r) for r in roots()}

n , m = map(int,input().split())
root = [-1 for i in range(n)]

for _ in range(m):
    a , b = map(int,input().split())
    unite(a,b)

print(len(all_group_members())-1)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

for _ in range(m):
    a , b = map(lambda x:int(x)-1,input().split())
    uf.union(a , b)
    
print(uf.group_count()-1)
N = int(input())
A = {input().split()}
print('YNEOS'[len(A)==N::2]

### FIXED CODE ###

N = int(input())
A = set(input().split())
print('YNEOS'[len(A)!=N::2])
x=input().split()
n=int(x[0])
a=int(x[1])
b=int(x[2])
v=input().split()
x=0
while x<n:
    v[x]=int(v[x])
    x+=1
v.sort()
ave=0
for i in range(a):
    ave+=v[-i-1]
print(ave/a)
up=1
down=1
ans=0
x=v[-a:].count(v[-a])
y=v.count(v[-a])
if v[-1]!=v[-a]:
    
    for i in range(2,y+1):
        up*=i
    for i in range(2,x):
        down*=i
    for i  in range(2, y-x+1):
        down*=i
    print(up//down)
else:
    ii=a
    while v[-ii]==v[-1] and ii<=b:
        up=1
        down=1
        for i in range(1,y+1):
            up*=i
        for i in range(1,ii+1):
            down*=i
        for i  in range(1, y-ii+1):
            down*=i
        ans+=(up//down)
        ii+=1
    print(ans)


### FIXED CODE ###

import decimal
def ncr(x,y):
	ans=1
	q=x-y
	while x>y:
		ans*=x
		x=x-1
	
	while q>1:
		ans=ans/q
		q=q-1
	
	return ans

x=input().split()
n=int(x[0])
a=int(x[1])
b=int(x[2])
v=[0]*n
x = input().split()
ind=0
M={1:0}
M2={1:0}
for i in x:
	v[ind]=int(i)
	if int(i) in M:
		M[v[ind]]+=1
	else:
		M[v[ind]]=1
	ind+=1
v.sort(reverse=True)

cnt=0
ind=0
m=0
while cnt<a:
	cnt+=1
	m=decimal.Decimal((cnt-1)*m+v[ind])/decimal.Decimal(cnt)
	if v[ind] in M2:
		M2[v[ind]]+=1
	else:
		M2[v[ind]]=1
	ind+=1
while cnt<b:
	if (cnt*m+v[ind])/(cnt+1)<m:
		break
	else:
		cnt+=1;
		if v[ind] in M2:
			M2[v[ind]]+=1
		else:
			M2[v[ind]]=1
		ind+=1
print(m)
maxw=cnt;
ways=0;
for i in range(int(cnt),a-1,-1):
	if v[ind-1] not in M2:
			M2[v[ind]]=0
	if v[ind-1] not in M:
			M[v[ind-1]]=0
	#print(M[v[ind-1]],M2[v[ind-1]])
	ways+=ncr(M[v[ind-1]],M2[v[ind-1]])
	
	M2[v[ind-1]]-=1

print(round(ways))
A, B = map(int, input())

if abs(A - K) == abs(B - K):
  print(K)
else:
  print('IMPOSSIBLE')

### FIXED CODE ###

A, B = map(int, input().split())
 
if (A + B)%2 == 0:
  k = (A + B)/2
  print(round(k))
else:
  print('IMPOSSIBLE')
N, H = map(int, input().split())
slash = 0
Throw = []
for _ in range(N):
    a, b = map(int, input().split())
    slash = max(slash, a)
    if b > a: Throw.append(b)    
#slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその刀をダメージが大きい順に投げる
Throw = sorted([th for th in Throw if th > slash], reversed=True)
dmg, cnt = 0, 0
for throw in Throw:
    if dmg >= H: break
    dmg += throw
    cnt += 1
if dmg < H:
    from math import ceil
    cnt += ceil((H-dmg)/slash)
print(cnt)

### FIXED CODE ###

N, H = map(int, input().split())
slash = 0
Throw = []
for _ in range(N):
    a, b = map(int, input().split())
    slash = max(slash, a)
    if b > a: Throw.append(b)    
#slash=斬撃最大ダメージ、投げてslash超のダメージが出るならばその剣をダメージが大きい順に投げる
import heapq as hq
Throw = [-th for th in Throw if th > slash]
hq.heapify(Throw)

dmg, cnt = 0, 0
while len(Throw) != 0:
    if dmg >= H: break
    dmg += -hq.heappop(Throw)
    cnt += 1
if dmg < H:
    from math import ceil
    cnt += ceil((H-dmg)/slash)
print(cnt)
O = input()
E = input()
ans = ''

for i in range(len(O)):
    ans += O[i]
    ans += E[i]

print(ans)

### FIXED CODE ###

O = input()
E = input()
ans = ''

for i in range(len(O)):
    ans += O[i]
    if i != len(E):
        ans += E[i]

print(ans)
a,b,c=map(int,input().split())
print(min(a+b, b+c, c+a)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(min(a+b, b+c, c+a))
import numpy as np
import itertools
from statistics import mean
n = int(input())
lis = [list(map(int, input().split())) for i in range(n)]
dislis = []
for i in range(n):
    dislis.append([])
    for j in range(n):
        dislis[i].append(np.sqrt((lis[i][0]-lis[j][0])**2 + (lis[i][1]-lis[j][1])**2))

lenlis = []
cnt = 0
for v in itertools.permutations(range(n+1)[1:], n):
    cnt += 1
    lenlis.append([])
    for i in range(len(v)):
        if i != len(v)-2:
            lenlis[cnt-1].append(dislis[v[i-1]-1][v[i]-1])
anslis = []
cntcnt = 0
for i in lenlis:
    anslis.append(sum(lenlis[cntcnt]))
    cntcnt += 1
print(mean(anslis))

### FIXED CODE ###

import math
import itertools
n = int(input())
lis = [list(map(int, input().split())) for i in range(n)]
dislis = []
for i in range(n):
    dislis.append([])
    for j in range(n):
        dislis[i].append(math.sqrt((lis[i][0]-lis[j][0])**2 + (lis[i][1]-lis[j][1])**2))

lenlis = []
cnt = 0
for v in itertools.permutations(range(n+1)[1:], n):
    cnt += 1
    lenlis.append([])
    for i in range(len(v)):
        if i != len(v)-2:
            lenlis[cnt-1].append(dislis[v[i-1]-1][v[i]-1])
anslis = []
cntcnt = 0
for i in lenlis:
    anslis.append(sum(lenlis[cntcnt]))
    cntcnt += 1
print(sum(anslis)/len(anslis))
N,M = input().split()
l = [0]*int(N) #flg
m = [0]*int(N) #counter
c =0

for i in range(int(M)+1):
    p,s = input().split()
    if s =="AC":
        if l[int(p)-1]==1:
            pass
        else:
            l[int(p)-1] = 1
            c += m[int(p)-1]
    elif s == "WA":
        m[int(p)-1] += 1



print(l.count(1),c)





### FIXED CODE ###

N,M = input().split()
l = [0]*int(N) #flg
m = [0]*int(N) #counter
c =0

for i in range(int(M)):
    p,s = input().split()
    if s =="AC":
        if l[int(p)-1]==1:
            pass
        else:
            l[int(p)-1] = 1
            c += m[int(p)-1]
    elif s == "WA":
        m[int(p)-1] += 1



print(l.count(1),c)
import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    idxlist = [[] for _ in range(n)]
    d = []
    dp = [INF for _ in range(n + 1)]
    dp[0] = 1

    for i in range(n):
        tmp = ni()
        tmp -= 1
        if i > 0 and d[-1] == tmp:
            d.append(-1)
            continue
        d.append(tmp)
        idxlist[tmp].append(i)

    for i, di in enumerate(d):
        dp[i + 1] = dp[i]
        if di == -1:
            continue
        bidx = bisect.bisect_left(idxlist[di], i)
        if bidx - 1 >= 0:
            dp[i + 1] += dp[idxlist[di][bidx - 1] + 1]
            dp[i + 1] %= MOD

    print(dp[n])


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    last = [-1 for _ in range(2 * 10 ** 5 + 1)]
    dp = [INF for _ in range(n + 1)]
    dp[0] = 1

    d = [ni()-1 for _ in range(n)]

    for i, di in enumerate(d):
        dp[i + 1] = dp[i]
        if last[di] != -1:
            if i - last[di] != 1:
                dp[i + 1] += dp[last[di] + 1]
                dp[i + 1] %= MOD
        last[di] = i

    print(dp[n])


if __name__ == '__main__':
    main()
n,l=map(int,input().split())

taste = []
teste_zettaichi = []

for i in range(n):
    taste.append(l+i-1)
    teste_zettaichi = abs(taste[i])

print(sum(taste) - min(teste_zettaichi))

### FIXED CODE ###

num = input()
#num = str(code)

if num[0] == num[1] or num[1] == num[2] or num[2] == num[3]:
    print('Bad')
else:
    print('Good')
H,W=map(int,input().split())

l=[]
for i in range(H):
  l.append(list(input()))

c=0
while True:
  c+=1
  for i in range(H):
    for j in range(W):
      x=l[i][j]
      if x=='#':
        if i>0 and i<H-1 and j>0 and j<W-1:
          if l[i-1][j]=='.':
            l[i-1][j]='a'
          if l[i+1][j]=='.':
            l[i+1][j]='a'
          if l[i][j-1]=='.':
            l[i][j-1]='a'
          if l[i][j+1]=='.':
            l[i][j+1]='a'
  
        if i==0 and j==0:
          if l[i][j+1]=='.':
            l[i][j+1]='a'
          if l[i+1][j]=='.':
            l[i+1][j]='a'
  
        if i==0 and j>0 and j<W-1:
          if l[i+1][j]=='.':
            l[i+1][j]='a'
          if l[i][j-1]=='.':
            l[i][j-1]='a'
          if l[i][j+1]=='.':
            l[i][j+1]='a'
  
        if i==0 and j==W-1:
          if l[i][j-1]=='.':
            l[i][j-1]='a'
          if l[i+1][j]=='.':
            l[i+1][j]='a'
  
        if i>0 and i<H-1 and j==0:
          if l[i-1][j]=='.':
            l[i-1][j]='a'
          if l[i][j+1]=='.':
            l[i][j+1]='a'
          if l[i+1][j]=='.':
            l[i+1][j]='a'
  
        if i>0 and i<H-1 and j==W-1:
          if l[i-1][j]=='.':
            l[i-1][j]='a'
          if l[i][j-1]=='.':
            l[i][j-1]='a'
          if l[i+1][j]=='.':
            l[i+1][j]='a'
  
        if i==H-1 and j==0:
          if l[i-1][j]=='.':
            l[i-1][j]='a'
          if l[i][j+1]=='.':
            l[i][j+1]='a'
  
        if i==H-1 and j>0 and j<W-1:
          if l[i-1][j]=='.':
            l[i-1][j]='a'
          if l[i][j-1]=='.':
            l[i][j-1]='a'
          if l[i][j+1]=='.':
            l[i][j+1]='a'
  
        if i==H-1 and j==W-1:
          if l[i-1][j]=='.':
            l[i-1][j]='a'
          if l[i][j-1]=='.':
            l[i][j-1]='a'
  
  f=False
  for i in range(H):
    if 'a' not in l[i]:
      f=True
    else:
      l[i]=list(''.join(l[i]).replace('a','#'))

  if f:
    break

print(c)

### FIXED CODE ###

import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  h,w=LI()
  field=[list(S()) for _ in range(h)]
  d=0

  q=collections.deque()
  nokori=h*w
  dist=[[-1]*w for _ in range(h)]
  for i in range(h):
    for j in range(w):
      if field[i][j]=='#':
        q.append((i,j))
        dist[i][j]=0
        nokori-=1

  while q:
    if nokori==0:
      return d

    y,x=q.popleft()

    for dy,dx in dd:
      ny=y+dy
      nx=x+dx

      if 0<=ny and ny<h and 0<=nx and nx<w:
        if field[ny][nx]=='.':
          field[ny][nx]='#'
          d=dist[y][x]+1
          dist[ny][nx]=d
          q.append((ny,nx))
          nokori-=1

  return d

# main()
print(main())
n=int(input())
kei = 0.0
for i in range(n):
    x,u=map(str,input().split())
    if u=="JPY":
        kei += float(x[i])
    else:
        kei += float(x[i])*380000.0
print(kei)

### FIXED CODE ###

n=int(input())
kei = 0.0
for i in range(n):
    x,u=map(str,input().split())
    if u=="JPY":
        kei += float(x)
    else:
        kei += float(x)*380000.0
print(kei)
a, b = map(int, input().split())
print(a,b)
c = []
if b - a >= 2019:
    print(0)
else:
    for i in range(a,b):
        for j in range(i+1,b+1):
            c.append((i*j)%2019)
#print(c)
print(min(c))


### FIXED CODE ###

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

if b-a >= 2019:
    print(0)
else:
    c = []
    for i in range(a,b):
        for j in range(i+1,b+1):
            c.append(i*j % 2019)
    #print(c)
    print(min(c))
import itertools
def main():
    N,M,Q = map(int,input().split())
    q = []
    for i in range(Q):
        a,b,c,d = map(int,input().split())
        q.append([a-1,b-1,c,d])
    A = [i for i in range(1,M+1)]
    if N==10:

        ans = 0
        for i, qq in enumerate(q):
            if A[qq[1]] - A[qq[0]] == qq[2]:
                ans += qq[3]
        print(ans)

    else:
        aa = list(itertools.combinations(A,N))
        ans = 0

        for i, cc in enumerate(aa):
            ans1 = 0
            for j, qq in enumerate(q):
                if cc[qq[1]] - cc[qq[0]] == qq[2]:
                    ans1 += qq[3]
            # print(ans1,cc)
            ans = max(ans,ans1)
        print(ans)

if __name__=='__main__':
    main()


### FIXED CODE ###

import itertools
def main():
    N,M,Q = map(int,input().split())
    q = []
    for i in range(Q):
        a,b,c,d = map(int,input().split())
        q.append([a-1,b-1,c,d])
    A = [i for i in range(1,M+1)]
    # if N==10:
    #
    #     ans = 0
    #     for i, qq in enumerate(q):
    #         if A[qq[1]] - A[qq[0]] == qq[2]:
    #             ans += qq[3]
    #     print(ans)
    #
    # else:
    aa = list(itertools.combinations_with_replacement(A,N))
    ans = 0

    for i, cc in enumerate(aa):
        ans1 = 0
        for j, qq in enumerate(q):
            if cc[qq[1]] - cc[qq[0]] == qq[2]:
                ans1 += qq[3]
            # print(ans1,cc)
        ans = max(ans,ans1)
    print(ans)

if __name__=='__main__':
    main()
4
2 3 4 1
13 5 8 24
45 9 15

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
sumc = 0

for count in range(N-1):
    if A[count+1] - A[count] == 1:
        sumc = sumc + C[A[count]-1]

print(sumc + sum(B))